-
Notifications
You must be signed in to change notification settings - Fork 414
87 lines (70 loc) · 2.89 KB
/
tests.yml
File metadata and controls
87 lines (70 loc) · 2.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Tests
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
env:
ASSETS_COMMAND: assets
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Create .env
run: |
cat > .env <<EOF
APP_ENV=testing
APP_URL=http://nginx
PAYMENT_SANDBOX=true
EOF
- name: Create .env.testing
run: |
ln -s .env .env.testing
- name: Create .env.dusk.local
run: |
ln -s .env .env.dusk.local
- name: Get current date
id: current-date
run: echo "today=$(date '+%Y%m%d')" >> "$GITHUB_OUTPUT"
- name: Cache ip2asn
uses: actions/cache@v5
with:
path: database/ip2asn/
key: ip2asn-${{ steps.current-date.outputs.today }}
restore-keys: ip2asn-
- name: Cache composer
uses: actions/cache@v5
with:
path: .docker/.cache/composer/files/
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Spin up Docker dev environment
run: ./bin/docker_dev.sh -d
- name: Wait for migrations to be done
run: docker compose logs -t -f migrator & docker compose wait migrator || true
- name: Wait for assets building to be done
run: docker compose logs -t -f assets & docker compose wait assets || true
- name: Generate docs
run: docker compose exec php /app/docker/development/entrypoint.sh artisan scribe:generate
- name: Run PHPUnit
run: docker compose exec php /app/docker/development/entrypoint.sh test phpunit
# TODO: workaround things (beatmaps) being indexed during test above and not cleaned up.
# This used to cause beatmap listing returning cursor with Long.MIN_VALUE for null timetamp
# and errors out when trying to get the next page (es can't parse such value for timestamp)
# but has since been fixed.
# Something should still be done regarding es index between tests though.
- name: Clean indexes
run: docker compose exec php /app/docker/development/entrypoint.sh artisan es:index-documents --no-interaction
- name: Run Dusk
run: docker compose exec php /app/docker/development/entrypoint.sh artisan dusk
- name: Run karma
run: docker compose run --rm testjs
# this only tests that the rollback functions are valid and doesn't check
# if they actually do what they're expected to do.
- name: Migration rollback test
run: |
docker compose exec php /app/docker/development/entrypoint.sh artisan migrate:reset | tee rollback.log
grep -Fq 'no rolling back from this migration =)' rollback.log