1- # Run the old Travis tests within GitHub Actions, and upload the CodeClimate Report
2- #
31# If nektos/act is installed as a GitHub CLI extension...
42# https://github.com/nektos/act#installation-as-github-cli-extension
53# ...then run this locally with:
64# gh act -j test
75# 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- #
6+
187 name : Tests
198 on :
209 push :
2110 branches :
22- - 1.0.x
2311 - master
2412 pull_request :
2513 branches :
26- - 1.0.x
2714 - master
2815 env :
2916 CC_TEST_REPORTER_ID : ec48bb03c72db6b43ce71fd488110b4707abfde4386c144d886d711378d8db64
3219 runs-on : ubuntu-latest
3320 steps :
3421 - uses : actions/checkout@v3
22+
3523 - name : Get BLAST
3624 working-directory : /opt
37- run : wget -c "https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/2.14.1/ncbi-blast-2.14.1+-x64-linux.tar.gz" && tar xvf ncbi-blast-*.tar.gz
25+ run : wget -c "https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/2.15.0/ncbi-blast-2.15.0+-x64-linux.tar.gz" && tar xvf ncbi-blast-*.tar.gz
26+
3827 - name : BLAST PATH
39- run : mkdir /opt/bin && echo "/opt/bin:/opt/ncbi-blast-2.14.1+/bin" >> $GITHUB_PATH
40- - uses : browser-actions/setup-chrome@latest
41- - run : chrome --version
28+ run : mkdir /opt/bin && echo "/opt/bin:/opt/ncbi-blast-2.15.0+/bin" >> $GITHUB_PATH
29+
4230 - name : Get CodeClimate
4331 working-directory : /opt
4432 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
33+
34+ - uses : browser-actions/setup-chrome@latest
35+ - run : chrome --version
36+
4537 - name : Set up Ruby
4638 uses : ruby/setup-ruby@v1
4739 with :
4840 ruby-version : ' 3.2'
4941 bundler-cache : true
42+
5043 - name : Install Ruby dependencies
5144 run : bundle install
45+
5246 - name : Setup Node.js
5347 uses : actions/setup-node@v3
5448 with :
5549 node-version : ' 16'
50+
5651 - name : Install NPM Dependencies
5752 run : npm install
53+
54+ - name : Instal Jest
55+ run : npm install --save-dev jest
56+
5857 - name : Build JS and CSS assets
5958 run : npm run build
59+
6060 - name : Check assets were compiled and checked-in
6161 continue-on-error : true
6262 run : |
6666 echo "Changes detected in 'public' directory. Please compile assets locally and commit the changes."
6767 exit 1
6868 fi
69+
6970 - name : Create SequenceServer config file
7071 run : bundle exec bin/sequenceserver -s -d spec/database/v5/sample
72+
7173 - name : CodeClimate before-build hook
7274 run : cc-test-reporter before-build
75+
7376 - name : Run main specs and import spec for BLAST 2.9.0+
74- id : rspec
75- continue-on-error : true
77+ id : rspec_tests
7678 run : bundle exec rspec spec/*_spec.rb spec/blast_versions/blast_2.9.0/*
77- - name : CodeClimate after-build (success)
78- if : steps.rspec.outcome == 'success'
79- run : cc-test-reporter after-build --exit-code 0
80- - name : CodeClimate after-build (failure)
81- if : steps.rspec.outcome != 'success'
82- run : cc-test-reporter after-build --exit-code 1
83- - name : upload code coverage results
79+ continue-on-error : true
80+
81+ - name : upload rspec coverage report
8482 uses : actions/upload-artifact@v3
85- if : success() || failure()
8683 with :
87- name : code-coverage-report
84+ name : rspec- code-coverage-report
8885 path : coverage
86+
87+ - name : format-coverage (Rspec)
88+ run : cc-test-reporter format-coverage --output coverage/codeclimate_rspec.json
89+
90+ - name : Jest tests
91+ id : jest_tests
92+ run : npm test -- --coverage
93+ continue-on-error : true
94+
95+ - name : upload Jest coverage report
96+ uses : actions/upload-artifact@v3
97+ with :
98+ name : jest-code-coverage-report
99+ path : coverage/lcov-report/
100+
101+ - name : format-coverage (Jest)
102+ run : cc-test-reporter format-coverage coverage/lcov.info --input-type lcov --output coverage/codeclimate_jest.json
103+
104+ - name : sum-coverage
105+ run : cc-test-reporter sum-coverage --parts 2 coverage/codeclimate_*.json
106+
107+ - name : upload coverage to code-CodeClimate
108+ run : cc-test-reporter upload-coverage
109+
110+ - name : Assert both test suites passed in full
111+ if : steps.rspec_tests.outcome != 'success' || steps.jest_tests.outcome != 'success'
112+ run : exit 1
0 commit comments