Skip to content

Merge pull request #392 from openstax/achievements-badge #2289

Merge pull request #392 from openstax/achievements-badge

Merge pull request #392 from openstax/achievements-badge #2289

Workflow file for this run

name: Tests
on:
pull_request:
push:
branches:
- main
jobs:
playwright:
timeout-minutes: 15
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: bahmutov/npm-install@v1
with:
working-directory: frontend
- name: Build and run docker
run: docker compose up -d
- name: Run migrations
run: docker compose exec api bundle exec rake db:migrate
- 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@v19
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: |
npx playwright install chromium --with-deps
npx playwright test
- name: Save test-results of failures
uses: actions/upload-artifact@v4
if: failure()
with:
name: test-results
path: ./frontend/test-results
- name: Shutdown docker compose
if: always()
run: docker compose down
rspec:
timeout-minutes: 5
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
working-directory: backend
- name: Run docker containers
run: docker compose up api postgres_test -d
- name: Run Specs
run: docker compose exec api bundle exec rspec
- name: Stop containers
if: always()
run: docker compose down