fp/.gitea/workflows/tests.yaml
CJ_Clippy e38d780092
Some checks failed
ci / build (push) Failing after 26s
ci / Tests & Checks (push) Failing after 15s
use less common port
2025-02-15 04:52:27 -08:00

172 lines
4.8 KiB
YAML

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: 600
permissions:
contents: read
pull-requests: write
env:
MIX_ENV: test
TRACKER_URL: ${{ vars.TRACKER_URL }}
WHITELIST_URL: ${{ vars.WHITELIST_URL }}
WHITELIST_USERNAME: ${{ secrets.WHITELIST_USERNAME }}
WHITELIST_PASSWORD: ${{ secrets.WHITELIST_PASSWORD }}
WHITELIST_PASSWORD_CADDY: ${{ secrets.WHITELIST_PASSWORD_CADDY }}
WHITELIST_FEED_URL: ${{ vars.WHITELIST_FEED_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 }}
services:
db:
image: postgres:16
ports:
- 5432:5432
env:
POSTGRES_DB: ${{ vars.DB_NAME }}
POSTGRES_USER: ${{ vars.DB_USER }}
POSTGRES_PASSWORD: ${{ secrets.DB_PASS }}
tracker-helper:
image: gitea.futureporn.net/futureporn/tracker-helper:latest
ports:
- 5063:5063
env:
WL_FIFO_PATH: /etc/opentracker/adder.fifo
WL_FILE_PATH: /etc/opentracker/whitelist
WL_CREDENTIALS: ${{ secrets.WL_CREDENTIALS }}
WL_PORT: 5063
volumes:
- /tmp/futureporn/opentracker:/etc/opentracker
opentracker:
image: gitea.futureporn.net/futureporn/opentracker:latest
ports:
- 6969:6969
env:
WHITELIST_FEED_URL: https://bright.futureporn.net/torrents
volumes:
- /tmp/futureporn/opentracker:/etc/opentracker
steps:
- name: wait a few seconds
run: sleep 30
- name: Debug services
run: docker ps -a
# - 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: tracker-helper service check
run: curl http://tracker-helper:5063/health
# - name: Check opentracker pingability
# run: ping -c 3 opentracker
- name: opentracker service check
run: |
getent hosts opentracker
curl -v http://opentracker:6969/stats
- name: Check postgres pingability
run: ping -c 3 db
- name: postgres service check
env:
PGPASSWORD: ${{ secrets.DB_PASS }}
run: psql --host=db --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
- 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. <a>)
run: |
if grep -R '</a>' ./lib; then
echo "Found banned element '<a>' inside ./lib. Please use <.link> instead."
exit 1
fi
working-directory: ./apps/bright