From 52367c79e217d44599b948855f179bbb7900d060 Mon Sep 17 00:00:00 2001 From: evazion Date: Mon, 15 Jun 2020 18:11:23 -0500 Subject: [PATCH] ci: upload code coverage even when tests fail. --- .github/workflows/test.yaml | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 0c503fe4b..53485a29a 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -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 }}