Files
nairobi/.github/workflows/tests.yml
Javi Martín 8ed8cc8b93 Use Coveralls Github Action to send test reports
Coveralls stopped working back in July when we reached build number 3790
because back when we used Travis we created builds from numbers 3791 to
35700.

After trying to change the numbers in several ways, all of them
resulting in a "No build matching CI build number" message, we're trying
the Github Action provided by Coveralls instead. In order to make it
work, we need to add the `simplecov-lcov` gem and generate the report at
`coverage/lcov.info`. Note that, for some reason, `simplecov-lcov`
doesn't seem to depend on `simplecov` and we need `simplecov` 0.18 or
later, so we're manually adding this dependency as well.
2022-11-29 14:51:22 +01:00

79 lines
2.2 KiB
YAML

name: tests
on:
push:
branches:
- master
pull_request:
branches-ignore:
- i18n_master
permissions:
contents: read
jobs:
tests:
runs-on: ubuntu-latest
timeout-minutes: 60
services:
postgres:
image: postgres:10.10
ports: ["5432:5432"]
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
env:
POSTGRES_USER: consul
POSTGRES_PASSWORD: ""
env:
TEST_COVERAGE: 1
PGUSER: consul
POSTGRES_HOST: postgres
RAILS_ENV: test
strategy:
fail-fast: false
matrix:
ci_node_total: [5]
ci_node_index: [0, 1, 2, 3, 4]
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Setup NPM
uses: actions/setup-node@v1
- name: Copy secrets and database files
run: for i in config/*.example; do cp "$i" "${i/.example}"; done
- name: Setup database
run: bundle exec rake db:setup
- name: Compile assets
run: bundle exec rake assets:precompile > /dev/null 2>&1
- name: Run test suite
env:
KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC }}
KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }}
KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }}
KNAPSACK_PRO_FIXED_QUEUE_SPLIT: true
KNAPSACK_PRO_LOG_LEVEL: info
run: bin/knapsack_pro_rspec
- name: Coveralls Parallel
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: run-${{ matrix.ci_node_index }}
parallel: true
- name: Upload screenshots
if: failure()
uses: actions/upload-artifact@v2
with:
name: screenshots
path: tmp/screenshots
coveralls:
permissions:
contents: none
runs-on: ubuntu-latest
needs: tests
steps:
- name: Finish coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true