|
| 1 | +# Run the old Travis tests within GitHub Actions, and upload the CodeClimate Report |
| 2 | +# |
| 3 | +# If nektos/act is installed as a GitHub CLI extension... |
| 4 | +# https://github.com/nektos/act#installation-as-github-cli-extension |
| 5 | +# ...then run this locally with: |
| 6 | +# gh act -j test |
| 7 | +# Appending to $PATH: https://www.scivision.dev/github-actions-path-append/ |
| 8 | +# Conditionals predicated on status-codes: |
| 9 | +# https://github.com/orgs/community/discussions/25809 |
| 10 | +# |
| 11 | +# One can *try* action-validator, but there are false-negatives: |
| 12 | +# (https://github.com/mpalmer/action-validator |
| 13 | +# |
| 14 | +# State does *not* persist between jobs... |
| 15 | +# https://github.com/actions/checkout/issues/19 |
| 16 | +# ...so all this needs to happen in a single job. |
| 17 | +# |
| 18 | + name: Tests |
| 19 | + on: |
| 20 | + push: |
| 21 | + branches: |
| 22 | + - 1.0.x |
| 23 | + - master |
| 24 | + pull_request: |
| 25 | + branches: |
| 26 | + - 1.0.x |
| 27 | + - master |
| 28 | + env: |
| 29 | + CC_TEST_REPORTER_ID: ec48bb03c72db6b43ce71fd488110b4707abfde4386c144d886d711378d8db64 |
| 30 | + jobs: |
| 31 | + test: |
| 32 | + runs-on: ubuntu-latest |
| 33 | + steps: |
| 34 | + - uses: actions/checkout@v3 |
| 35 | + - name: Get BLAST |
| 36 | + working-directory: /opt |
| 37 | + run: wget -c "https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/2.12.0/ncbi-blast-2.12.0+-x64-linux.tar.gz" && tar xvf ncbi-blast-*.tar.gz |
| 38 | + - name: BLAST PATH |
| 39 | + run: mkdir /opt/bin && echo "/opt/bin:/opt/ncbi-blast-2.12.0+/bin" >> $GITHUB_PATH |
| 40 | + - name: Get Chromium |
| 41 | + run: sudo apt-get update && sudo apt-get install -y chromium-bsu chromium-driver |
| 42 | + - name: Get CodeClimate |
| 43 | + working-directory: /opt |
| 44 | + run: wget -c "https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64" -O bin/cc-test-reporter && chmod +x bin/cc-test-reporter |
| 45 | + - name: Set up Ruby |
| 46 | + uses: ruby/setup-ruby@v1 |
| 47 | + with: |
| 48 | + ruby-version: '3.2' |
| 49 | + bundler-cache: true |
| 50 | + - name: Install dependencies |
| 51 | + run: bundle install |
| 52 | + - name: Create SequenceServer config file |
| 53 | + run: bundle exec bin/sequenceserver -s -d spec/database/v5/sample |
| 54 | + - name: CodeClimate before-build hook |
| 55 | + run: cc-test-reporter before-build |
| 56 | + - name: Run main specs and import spec for BLAST 2.9.0+ |
| 57 | + id: rspec |
| 58 | + continue-on-error: true |
| 59 | + run: bundle exec rspec spec/*_spec.rb spec/blast_versions/blast_2.9.0/* |
| 60 | + - name: CodeClimate after-build (success) |
| 61 | + if: steps.rspec.outcome == 'success' |
| 62 | + run: cc-test-reporter after-build --exit-code 0 |
| 63 | + - name: CodeClimate after-build (failure) |
| 64 | + if: steps.rspec.outcome != 'success' |
| 65 | + run: cc-test-reporter after-build --exit-code 1 |
| 66 | + - name: upload code coverage results |
| 67 | + uses: actions/upload-artifact@v3 |
| 68 | + if: success() || failure() |
| 69 | + with: |
| 70 | + name: code-coverage-report |
| 71 | + path: coverage |
0 commit comments