name: ci on: pull_request: push: branches: - "main" schedule: - cron: "6 */12 * * *" jobs: test_phoenix: name: Tests & Checks runs-on: ubuntu-22.04 timeout-minutes: 20 permissions: contents: read pull-requests: write env: MIX_ENV: test TRACKER_URL: ${{ vars.TRACKER_URL }} AWS_BUCKET: ${{ vars.AWS_BUCKET }} AWS_HOST: ${{ vars.AWS_HOST }} AWS_REGION: ${{ vars.AWS_REGION }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} PUBLIC_S3_ENDPOINT: ${{ vars.PUBLIC_S3_ENDPOINT }} SITE_URL: https://futureporn.net SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }} WL_URL: ${{ vars.WL_URL }} WL_USERNAME: ${{ secrets.WL_USERNAME }} WL_PASSWORD: ${{ secrets.WL_PASSWORD }} services: db: image: postgres:16 ports: - 5432:5432 env: POSTGRES_DB: ${{ vars.DB_NAME }} POSTGRES_USER: ${{ vars.DB_USER }} POSTGRES_PASSWORD: ${{ secrets.DB_PASS }} options: >- --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 tracker-helper: image: gitea.futureporn.net/futureporn/tracker-helper:latest ports: - 5063:5063 env: WL_FILE_PATH: /var/lib/aquatic/whitelist WL_USERNAME: ${{ secrets.WL_USERNAME }} WL_PASSWORD: ${{ secrets.WL_PASSWORD }} WL_PORT: 5063 volumes: - aquatic:/var/lib/aquatic aquatic: image: gitea.futureporn.net/futureporn/aquatic:latest ports: - 3000:3000 - 9000:9000 volumes: - aquatic:/var/lib/aquatic env: ACCESS_LIST_CONTENTS: "" CONFIG_FILE_CONTENTS: | log_level = 'debug' [network] use_ipv4 = true use_ipv6 = true address_ipv4 = "0.0.0.0:3000" address_ipv6 = "[::]:3000" [statistics] interval = 5 print_to_stdout = true run_prometheus_endpoint = true prometheus_endpoint_address = "0.0.0.0:9000" [access_list] mode = "allow" path = "/var/lib/aquatic/whitelist" [privileges] # Chroot and switch group and user after binding to sockets drop_privileges = true # Chroot to this path chroot_path = "/var/lib/aquatic" # Group to switch to after chrooting group = "nogroup" # User to switch to after chrooting user = "nobody" steps: - name: Install apt packages run: apt-get update && apt-get install -y iputils-ping postgresql - name: tracker-helper service check (localhost) run: curl http://localhost:5063/health # - name: Check opentracker pingability # run: ping -c 3 opentracker - name: aquatic service check run: curl -v http://localhost:9000 # - name: postgres service check # env: # PGPASSWORD: ${{ secrets.DB_PASS }} # run: | # echo "DB_HOST=${{vars.DB_HOST}}, DB_NAME=${{vars.DB_NAME}}, DB_USER=${{vars.DB_USER}}" # psql --host=${{ vars.DB_HOST }} --port=5432 --dbname=${{ vars.DB_NAME }} --username=${{ vars.DB_USER }} --list - 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 with: submodules: false - 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 - 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