RSpec CI #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: RSpec CI | |
on: | |
# allow running action manually | |
workflow_dispatch: | |
# trigger on push to master branch | |
pull_request: | |
branches: | |
- main | |
jobs: | |
CI: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: read | |
steps: | |
- name: Create folders | |
run: | | |
mkdir -p /opt/workshops/ | |
cd /opt/workshops | |
# Checkout the repository code | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Start Docker containers | |
run: | | |
docker compose up --wait | |
- name: Create dev/test databases | |
run: | | |
docker exec $(docker ps --filter 'name=rails' -q) bash -lc "bundle exec rails db:create" | |
- name: Migrate dev/test databases | |
run: | | |
docker exec $(docker ps --filter 'name=rails' -q) bash -lc "bundle exec rails db:migrate" | |
- name: Run RSpec tests | |
run: | | |
docker exec $(docker ps --filter 'name=rails' -q) bash -lc "bundle exec rspec" |