Skip to content

test

test #1398

Workflow file for this run

name: Rspec
on:
push:
workflow_run:
workflows:
- Rubocop
types:
- completed
jobs:
rspec:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:10.8
env:
POSTGRES_USER: test
POSTGRES_PASSWORD: password
POSTGRES_DB: zero_waste_test
ports:
- 5432:5432
options: >-
--mount type=tmpfs,destination=/var/lib/postgresql/data
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
RAILS_ENV: test
DATABASE_URL: postgres://test:password@localhost:5432/zero_waste_test
USE_STATIC_ASSETS: true
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3.5
bundler-cache: true
- name: Update packages
run: sudo apt-get update
- name: Install system dependencies
run: sudo apt-get install -y libvips42 libvips-dev imagemagick
- uses: actions/setup-node@v1
with:
node-version: "14.x"
registry-url: "https://registry.npmjs.org"
- uses: nanasess/setup-chromedriver@master
- name: Prepare config
run: |
mv config/database.yml.docker config/database.yml
- name: Precompile assets
run: |
bundle exec rails assets:precompile
- name: Run tests
run: |
bundle exec rspec ./spec -f j -o tmp/rspec_results.json -f p
- name: Set up Coverage Environment Variable
run: cat tmp/rspec_results.json
# run: |
# export COVERAGE=$(cat tmp/rspec_results.json | jq '.coverage')
# echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV
- name: RSpec Report
uses: SonicGarden/rspec-report-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
json-path: tmp/rspec_results.json
if: always()
# - name: Create the Badge
# uses: schneegans/[email protected]
# with:
# auth: ${{ secrets.GIST_SECRET }}
# gistID: e79c3ef008afb7fb7474dc1c582416ac
# filename: tmp/rspec_results.json
# label: Test Coverage
# message: ${{ env.COVERAGE }}
# color: green
# namedLogo: ruby