ci: upload code coverage even when tests fail.
This commit is contained in:
24
.github/workflows/test.yaml
vendored
24
.github/workflows/test.yaml
vendored
@@ -14,6 +14,10 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ubuntu:20.04
|
container: ubuntu:20.04
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DEBIAN_FRONTEND: noninteractive
|
DEBIAN_FRONTEND: noninteractive
|
||||||
PARALLEL_WORKERS: 8 # number of parallel tests to run
|
PARALLEL_WORKERS: 8 # number of parallel tests to run
|
||||||
@@ -25,9 +29,6 @@ jobs:
|
|||||||
GIT_COMMIT_SHA: ${{ github.sha }}
|
GIT_COMMIT_SHA: ${{ github.sha }}
|
||||||
GIT_BRANCH: ${{ github.ref }}
|
GIT_BRANCH: ${{ github.ref }}
|
||||||
|
|
||||||
# https://docs.codecov.io/docs
|
|
||||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
|
|
||||||
DATABASE_URL: postgresql://danbooru:danbooru@postgres/danbooru
|
DATABASE_URL: postgresql://danbooru:danbooru@postgres/danbooru
|
||||||
ARCHIVE_DATABASE_URL: postgresql://danbooru:danbooru@postgres/danbooru
|
ARCHIVE_DATABASE_URL: postgresql://danbooru:danbooru@postgres/danbooru
|
||||||
DANBOORU_SECRET_KEY_BASE: 1234
|
DANBOORU_SECRET_KEY_BASE: 1234
|
||||||
@@ -59,26 +60,39 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Install OS dependencies
|
- name: Install OS dependencies
|
||||||
run: |
|
run: |
|
||||||
apt-get update
|
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
|
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
|
ln -sf /usr/bin/yarnpkg /usr/bin/yarn
|
||||||
|
|
||||||
- name: Install Ruby dependencies
|
- name: Install Ruby dependencies
|
||||||
run: BUNDLE_DEPLOYMENT=true bundle install --jobs 4
|
run: BUNDLE_DEPLOYMENT=true bundle install --jobs 4
|
||||||
|
|
||||||
- name: Install Javascript dependencies
|
- name: Install Javascript dependencies
|
||||||
run: yarn install
|
run: yarn install
|
||||||
|
|
||||||
- name: Prepare database
|
- name: Prepare database
|
||||||
run: config/docker/prepare-tests.sh
|
run: config/docker/prepare-tests.sh
|
||||||
|
|
||||||
# https://docs.codeclimate.com/docs/configuring-test-coverage
|
# https://docs.codeclimate.com/docs/configuring-test-coverage
|
||||||
- name: Prepare test coverage for Code Climate
|
- name: Prepare test coverage for Code Climate
|
||||||
run: |
|
run: |
|
||||||
wget https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
|
wget https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
|
||||||
chmod +x test-reporter-latest-linux-amd64
|
chmod +x test-reporter-latest-linux-amd64
|
||||||
./test-reporter-latest-linux-amd64 before-build
|
./test-reporter-latest-linux-amd64 before-build
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: bin/rails test
|
run: bin/rails test
|
||||||
|
|
||||||
- name: Upload test coverage to Code Climate
|
- 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
|
- 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 }}
|
||||||
|
|||||||
Reference in New Issue
Block a user