ci: upload code coverage even when tests fail.

This commit is contained in:
evazion
2020-06-15 18:11:23 -05:00
parent 4c56447d66
commit 52367c79e2

View File

@@ -14,6 +14,10 @@ jobs:
runs-on: ubuntu-latest
container: ubuntu:20.04
defaults:
run:
shell: bash
env:
DEBIAN_FRONTEND: noninteractive
PARALLEL_WORKERS: 8 # number of parallel tests to run
@@ -25,9 +29,6 @@ jobs:
GIT_COMMIT_SHA: ${{ github.sha }}
GIT_BRANCH: ${{ github.ref }}
# https://docs.codecov.io/docs
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
DATABASE_URL: postgresql://danbooru:danbooru@postgres/danbooru
ARCHIVE_DATABASE_URL: postgresql://danbooru:danbooru@postgres/danbooru
DANBOORU_SECRET_KEY_BASE: 1234
@@ -59,26 +60,39 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Install OS dependencies
run: |
apt-get update
apt-get -y install --no-install-recommends build-essential ruby ruby-dev ruby-bundler git nodejs yarnpkg webpack ffmpeg mkvtoolnix libvips-dev libxml2-dev postgresql-server-dev-all wget
ln -sf /usr/bin/yarnpkg /usr/bin/yarn
- name: Install Ruby dependencies
run: BUNDLE_DEPLOYMENT=true bundle install --jobs 4
- name: Install Javascript dependencies
run: yarn install
- name: Prepare database
run: config/docker/prepare-tests.sh
# https://docs.codeclimate.com/docs/configuring-test-coverage
- name: Prepare test coverage for Code Climate
run: |
wget https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
chmod +x test-reporter-latest-linux-amd64
./test-reporter-latest-linux-amd64 before-build
- name: Run tests
run: bin/rails test
- name: Upload test coverage to Code Climate
run: ./test-reporter-latest-linux-amd64 after-build --debug
if: ${{ !cancelled() }}
run: GIT_COMMITTED_AT="$(date -u +%s)" ./test-reporter-latest-linux-amd64 after-build --debug
# https://docs.codecov.io/docs
- name: Upload test coverage to Codecov.io
run: bash <(curl -s https://codecov.io/bash)
if: ${{ !cancelled() }}
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}