rspec #2854
Workflow file for this run
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
# For more information see: | |
# - https://docs.github.com/en/actions/guides/building-and-testing-ruby | |
# - https://github.com/niclin/rails-github-actions-example/blob/master/.github/workflows/rails.yml | |
name: rspec | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
merge_group: | |
jobs: | |
test: | |
name: rspec suite | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
# reference: https://github.com/actions/example-services/blob/master/.github/workflows/postgres-service.yml | |
image: postgres:16 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: glowfic_test | |
PGUSER: postgres | |
PGPASSWORD: postgres | |
PGDATABASE: glowfic_test | |
ports: ["5432:5432"] | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
redis: | |
# reference: https://docs.github.com/en/actions/guides/creating-redis-service-containers#running-jobs-in-containers | |
image: redis:7.2 | |
ports: ["6379:6379"] | |
options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5 | |
env: | |
GLOWFIC_DATABASE_USER: postgres | |
GLOWFIC_DATABASE_PASS: postgres | |
GLOWFIC_DATABASE_PORT: 5432 | |
RAILS_ENV: test | |
MINIO_ENDPOINT: http://localhost:9000/ | |
MINIO_ENDPOINT_EXTERNAL: http://localhost:9000/ | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: browser-actions/setup-chrome@v1 | |
- name: Set up MinIO | |
run: | | |
wget --show-progress --progress=dot:mega https://dl.min.io/server/minio/release/linux-amd64/minio | |
chmod +x minio | |
MINIO_ROOT_USER=glowfic_minio MINIO_ROOT_PASSWORD=glowfic_minio ./minio server ./minio-data 2>&1 > minio.log & | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true # runs bundle install (with version based on Gemfile.lock) and automatically caches result | |
- name: Load database schema | |
run: bundle exec rails db:schema:load --trace | |
- name: Run rspec tests and report coverage | |
uses: paambaati/[email protected] | |
with: | |
coverageCommand: bundle exec rspec spec --format documentation --format html --out rspec-results.html | |
env: | |
CC_TEST_REPORTER_ID: a3ae0fa6dd28afe102a694b98ced6bb567577524d44571589c4ed1a68f8cda2d | |
- name: Upload MinIO logs | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: minio-logs | |
path: minio.log | |
- name: Upload RSpec logs | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: rspec-logs | |
path: rspec-results.html | |
- name: Upload Coverage files | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage | |
path: coverage/ |