-
Notifications
You must be signed in to change notification settings - Fork 3
82 lines (78 loc) · 2.56 KB
/
tests.yml
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
name: Tests
on:
pull_request:
push:
branches:
- main
jobs:
playwright:
timeout-minutes: 60
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: bahmutov/npm-install@v1
with:
working-directory: frontend
- name: Build docker image
run: ./frontend/docker/build
- name: Build and run backend docker
run: |
docker-compose run api bundle exec rake db:migrate
docker-compose up -d
- name: log docker status
run: |
sleep 30
docker ps -a
docker logs kinetic_api_1
curl -i http://localhost:4006/api/v1/openapi.json
docker logs kinetic_api_1
- name: Wait for api to boot
working-directory: frontend
run: yarn run wait-on http://localhost:4006/api/v1/openapi.json
- name: Generate bindings
run: docker compose exec api bundle exec rake openstax_openapi:generate_model_bindings[1]
- name: Check for changes in bindings
uses: tj-actions/verify-changed-files@v13
id: verify-changed-files
with:
files: |
frontend/src/api
- name: Fail if bindings changed
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
echo "Changed files: ${{ steps.verify_changed_files.outputs.changed_files }}"
exit 1
- name: Run specs
working-directory: frontend
run: |
yarn
npx playwright install chromium --with-deps
npx playwright test
- name: Save test-results of failures
uses: actions/upload-artifact@v3
if: failure()
with:
name: test-results
path: ./frontend/test-results
- name: Shutdown docker compose
if: always()
run: docker-compose down
rspec:
timeout-minutes: 10
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Build docker image and run specs within it
run: |
CI_ENV=`bash <(curl -s https://codecov.io/env)`
API_DOCKERFILE_EXT=.ci docker-compose build
docker-compose run -T -e CI_ENV="$CI_ENV" -e ENABLE_CODECOV=1 -e CI=true api /bin/bash -c "bundle config path vendor/bundle; bundle install; bundle exec rspec"
- name: Stop containers
if: always()
run: docker-compose down