name: ci on: pull_request: push: branches: - "main" schedule: - cron: "6 */12 * * *" jobs: # test_javascript: # runs-on: ubuntu-latest # environment: docker # steps: # - name: Check out code # uses: actions/checkout@v3 # - name: Setup pnpm # uses: pnpm/action-setup@v4 # with: # run_install: | # - recursive: true # args: [--frozen-lockfile, --strict-peer-dependencies] # - name: Unit test all packages # run: pnpm test -r test_phoenix: name: Tests & Checks runs-on: ubuntu-22.04 timeout-minutes: 600 permissions: contents: read pull-requests: write env: MIX_ENV: test TRACKER_URL: http://localhost:8666/announce WHITELIST_URL: http://localhost:8666/whitelist WHITELIST_USERNAME: ${{ secrets.WHITELIST_USERNAME }} WHITELIST_PASSWORD: ${{ secrets.WHITELIST_PASSWORD }} WHITELIST_PASSWORD_CADDY: ${{ secrets.WHITELIST_PASSWORD_CADDY }} WHITELIST_FEED_URL: http://localhost:4000/torrents AWS_BUCKET: ${{ secrets.AWS_BUCKET }} AWS_HOST: ${{ secrets.AWS_HOST }} AWS_REGION: ${{ secrets.AWS_REGION }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} PUBLIC_S3_ENDPOINT: ${{ secrets.PUBLIC_S3_ENDPOINT }} SITE_URL: https://futureporn.net SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }} # @blocking @see https://gitea.com/gitea/act_runner/issues/506 services: db: image: postgres:16 ports: - 5432:5432 env: POSTGRES_DB: bright_test POSTGRES_USER: postgres POSTGRES_PASSWORD: password opentracker: image: gitea.futureporn.net/futureporn/opentracker:latest ports: - 8666:8666 env: WHITELIST_USERNAME: ${{ secrets.WHITELIST_USERNAME }} WHITELIST_PASSWORD_CADDY: ${{ secrets.WHITELIST_PASSWORD_CADDY }} # @todo delete WHITELIST_PASSWORD ASAP. we're waiting for futureporn/opentracker to update # We've corrected it to WHITELIST_PASSWORD_CADDY in the Caddyfile, # but the change isn't live in the container yet. WHITELIST_PASSWORD: ${{ secrets.WHITELIST_PASSWORD_CADDY }} WHITELIST_FEED_URL: https://bright.futureporn.net/torrents steps: - name: Setup FFmpeg uses: FedericoCarboni/setup-ffmpeg@v3 - name: Setup futureporn cache dir run: | mkdir -p ~/.cache/futureporn - name: Setup PIP packages uses: insightsengineering/pip-action@v2 with: packages: | torrentfile - name: Checkout code uses: actions/checkout@v4 - name: Setup Erlang and Elixir uses: erlef/setup-beam@v1.17 with: elixir-version: "1.16.0-otp-26" otp-version: "26.0" - name: Mix and build cache uses: actions/cache@v4 with: path: | deps _build key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} restore-keys: ${{ runner.os }}-mix- - name: Get dependencies run: mix deps.get working-directory: ./apps/bright - name: Code analyzers run: | mix format --check-formatted mix compile --warnings-as-errors working-directory: ./apps/bright # @blocking @see https://github.com/nektos/act/issues/2529 - name: Unit tests run: | mix test --only=unit working-directory: ./apps/bright - name: Integration tests run: | mix test --only=integration working-directory: ./apps/bright - name: Acceptance tests run: | mix test --only=acceptance working-directory: ./apps/bright - name: Uncategorized tests (ideally there should be none) run: | mix test --exclude=acceptance --exclude=unit --exclude=integration working-directory: ./apps/bright - name: Code coverage run: | mix coveralls working-directory: ./apps/bright - name: Check for banned HTML elements (i.e. ) run: | if grep -R '' ./lib; then echo "Found banned element '' inside ./lib. Please use <.link> instead." exit 1 fi working-directory: ./apps/bright