-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #241 from phac-nml/fix/ci
Fix GitHub CI Tests
- Loading branch information
Showing
2 changed files
with
165 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,24 @@ | ||
name: Galaxy Tool Linting and Tests for Push and PR | ||
name: Galaxy Tool Linting and Tests for push and PR | ||
on: | ||
pull_request: # Run on all PRs | ||
pull_request: | ||
paths-ignore: | ||
- '.github/**' | ||
- 'deprecated/**' | ||
- 'docs/**' | ||
- '*' | ||
push: | ||
branches: # Run on any push to development or master | ||
branches: | ||
- development | ||
- main | ||
- master | ||
paths-ignore: | ||
- '.github/**' | ||
- 'deprecated/**' | ||
- 'docs/**' | ||
- '*' | ||
env: | ||
GALAXY_FORK: galaxyproject | ||
GALAXY_BRANCH: release_22.05 | ||
GALAXY_BRANCH: release_23.1 | ||
MAX_CHUNKS: 4 | ||
MAX_FILE_SIZE: 1M | ||
concurrency: | ||
|
@@ -49,17 +60,17 @@ jobs: | |
- name: Determine latest commit in the Galaxy repo | ||
id: get-galaxy-sha | ||
run: echo "galaxy-head-sha=$(git ls-remote https://github.com/${{ env.GALAXY_FORK }}/galaxy refs/heads/${{ env.GALAXY_BRANCH }} | cut -f1)" >> $GITHUB_OUTPUT | ||
- uses: actions/setup-python@v1 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Cache .cache/pip | ||
uses: actions/cache@v2 | ||
uses: actions/cache@v3 | ||
id: cache-pip | ||
with: | ||
path: ~/.cache/pip | ||
key: pip_cache_py_${{ matrix.python-version }}_gxy_${{ steps.get-galaxy-sha.outputs.galaxy-head-sha }} | ||
- name: Cache .planemo | ||
uses: actions/cache@v2 | ||
uses: actions/cache@v3 | ||
id: cache-planemo | ||
with: | ||
path: ~/.planemo | ||
|
@@ -70,7 +81,7 @@ jobs: | |
run: pip install wheel | ||
- name: Install flake8 | ||
run: pip install flake8 flake8-import-order | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Fake a Planemo run to update cache and determine commit range, repositories, and chunks | ||
|
@@ -103,26 +114,36 @@ jobs: | |
matrix: | ||
python-version: ['3.7'] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
- uses: actions/setup-python@v1 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Cache .cache/pip | ||
uses: actions/cache@v2 | ||
uses: actions/cache@v3 | ||
id: cache-pip | ||
with: | ||
path: ~/.cache/pip | ||
key: pip_cache_py_${{ matrix.python-version }}_gxy_${{ needs.setup.outputs.galaxy-head-sha }} | ||
|
||
- name: Set fail level for pull request | ||
if: ${{ github.event_name == 'pull_request' }} | ||
run: | ||
echo "FAIL_LEVEL=warn" >> "$GITHUB_ENV" | ||
- name: Set fail level for merge | ||
if: ${{ github.event_name != 'pull_request' }} | ||
run: | ||
echo "FAIL_LEVEL=error" >> "$GITHUB_ENV" | ||
- name: Planemo lint | ||
uses: galaxyproject/planemo-ci-action@v1 | ||
id: lint | ||
with: | ||
mode: lint | ||
fail-level: ${{ env.FAIL_LEVEL }} | ||
repository-list: ${{ needs.setup.outputs.repository-list }} | ||
tool-list: ${{ needs.setup.outputs.tool-list }} | ||
- uses: actions/upload-artifact@v2 | ||
- uses: actions/upload-artifact@v3 | ||
if: ${{ failure() }} | ||
with: | ||
name: 'Tool linting output' | ||
|
@@ -132,21 +153,21 @@ jobs: | |
flake8: | ||
name: Lint Python scripts | ||
needs: setup | ||
if: ${{ needs.setup.outputs.repository-list != '' }} | ||
if: ${{ github.event_name == 'pull_request' && needs.setup.outputs.repository-list != '' }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ['3.7'] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
- uses: actions/setup-python@v1 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Cache .cache/pip | ||
uses: actions/cache@v2 | ||
uses: actions/cache@v3 | ||
id: cache-pip | ||
with: | ||
path: ~/.cache/pip | ||
|
@@ -155,7 +176,7 @@ jobs: | |
run: pip install flake8 flake8-import-order | ||
- name: Flake8 | ||
run: echo '${{ needs.setup.outputs.repository-list }}' | xargs -d '\n' flake8 --output-file pylint_report.txt --tee | ||
- uses: actions/upload-artifact@v2 | ||
- uses: actions/upload-artifact@v3 | ||
if: ${{ failure() }} | ||
with: | ||
name: 'Python linting output' | ||
|
@@ -164,21 +185,21 @@ jobs: | |
lintr: | ||
name: Lint R scripts | ||
needs: setup | ||
if: ${{ needs.setup.outputs.repository-list != '' }} | ||
if: ${{ github.event_name == 'pull_request' && needs.setup.outputs.repository-list != '' }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-20.04] | ||
r-version: ['release'] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
r-version: ${{ matrix.r-version }} | ||
- name: Cache R packages | ||
uses: actions/cache@v2 | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ env.R_LIBS_USER }} | ||
key: r_cache_${{ matrix.os }}_${{ matrix.r-version }} | ||
|
@@ -194,7 +215,7 @@ jobs: | |
- name: lintr | ||
run: | | ||
library(lintr) | ||
linters <- linters_with_defaults(line_length_linter = NULL, cyclocomp_linter = NULL, object_usage_linter = NULL) | ||
linters <- linters_with_defaults(line_length_linter = NULL, cyclocomp_linter = NULL, object_usage_linter = NULL, object_name_linter = NULL) | ||
con <- file("repository_list.txt", "r") | ||
status <- 0 | ||
while (TRUE) { | ||
|
@@ -214,7 +235,7 @@ jobs: | |
} | ||
quit(status = status) | ||
shell: Rscript {0} | ||
- uses: actions/upload-artifact@v2 | ||
- uses: actions/upload-artifact@v3 | ||
if: ${{ failure() }} | ||
with: | ||
name: 'R linting output' | ||
|
@@ -226,7 +247,7 @@ jobs: | |
if: ${{ github.event_name == 'pull_request' && needs.setup.outputs.repository-list != '' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Check file sizes | ||
|
@@ -241,7 +262,7 @@ jobs: | |
cat file_size_report.txt | ||
exit 1 | ||
fi | ||
- uses: actions/upload-artifact@v2 | ||
- uses: actions/upload-artifact@v3 | ||
if: ${{ failure() }} | ||
with: | ||
name: 'File size report' | ||
|
@@ -269,27 +290,29 @@ jobs: | |
ports: | ||
- 5432:5432 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
- uses: actions/setup-python@v1 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Cache .cache/pip | ||
uses: actions/cache@v2 | ||
uses: actions/cache@v3 | ||
id: cache-pip | ||
with: | ||
path: ~/.cache/pip | ||
key: pip_cache_py_${{ matrix.python-version }}_gxy_${{ needs.setup.outputs.galaxy-head-sha }} | ||
- name: Cache .planemo | ||
uses: actions/cache@v2 | ||
uses: actions/cache@v3 | ||
id: cache-planemo | ||
with: | ||
path: ~/.planemo | ||
key: planemo_cache_py_${{ matrix.python-version }}_gxy_${{ needs.setup.outputs.galaxy-head-sha }} | ||
- name: Get number of CPU cores | ||
uses: SimenB/github-actions-cpu-cores@v1 | ||
id: cpu-cores | ||
- name: Clean dotnet folder for space | ||
run: rm -Rf /usr/share/dotnet | ||
- name: Planemo test | ||
uses: galaxyproject/planemo-ci-action@v1 | ||
id: test | ||
|
@@ -302,8 +325,8 @@ jobs: | |
chunk-count: ${{ needs.setup.outputs.chunk-count }} | ||
galaxy-slots: ${{ steps.cpu-cores.outputs.count }} | ||
# Limit each test to 15 minutes | ||
test_timeout: 900 | ||
- uses: actions/upload-artifact@v2 | ||
test_timeout: 1800 | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: 'Tool test output ${{ matrix.chunk }}' | ||
path: upload | ||
|
@@ -316,20 +339,20 @@ jobs: | |
combine_outputs: | ||
name: Combine chunked test results | ||
needs: [setup, test] | ||
if: ${{ needs.setup.outputs.repository-list != '' }} | ||
if: ${{ always() && needs.setup.outputs.repository-list != '' }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ['3.7'] | ||
steps: | ||
- uses: actions/download-artifact@v2 | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
path: artifacts | ||
- uses: actions/setup-python@v1 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Cache .cache/pip | ||
uses: actions/cache@v2 | ||
uses: actions/cache@v3 | ||
id: cache-pip | ||
with: | ||
path: ~/.cache/pip | ||
|
@@ -340,7 +363,7 @@ jobs: | |
with: | ||
mode: combine | ||
html-report: true | ||
- uses: actions/upload-artifact@v2 | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: 'All tool test results' | ||
path: upload | ||
|
@@ -349,25 +372,31 @@ jobs: | |
id: check | ||
with: | ||
mode: check | ||
- name: Check if all test chunks succeeded | ||
run: | | ||
NFILES=$(ls artifacts/ | grep "Tool test output" | wc -l) | ||
if [[ "${{ needs.setup.outputs.chunk-count }}" != "$NFILES" ]]; then | ||
exit 1 | ||
fi | ||
# deploy the tools to the toolsheds (first TTS for testing) | ||
deploy: | ||
name: Deploy | ||
needs: [setup, lint, flake8, lintr, combine_outputs] | ||
needs: [setup, lint, combine_outputs] | ||
if: ${{ (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' ) && github.repository_owner == 'phac-nml' }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ['3.7'] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
- uses: actions/setup-python@v1 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Cache .cache/pip | ||
uses: actions/cache@v2 | ||
uses: actions/cache@v3 | ||
id: cache-pip | ||
with: | ||
path: ~/.cache/pip | ||
|
@@ -388,6 +417,28 @@ jobs: | |
shed-target: toolshed | ||
shed-key: ${{ secrets.TS_API_KEY }} | ||
|
||
deploy-report: | ||
name: Report deploy status | ||
needs: [deploy] | ||
if: ${{ always() && needs.deploy.result != 'success' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' ) && github.repository_owner == 'phac-nml' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
# report to the PR if deployment failed | ||
- name: Get PR object | ||
uses: 8BitJonny/[email protected] | ||
id: getpr | ||
with: | ||
sha: ${{ github.event.after }} | ||
- name: Create comment | ||
uses: peter-evans/create-or-update-comment@v2 | ||
with: | ||
token: ${{ secrets.PAT }} | ||
issue-number: ${{ steps.getpr.outputs.number }} | ||
body: | | ||
Attention: deployment ${{ needs.deploy.result }}! | ||
https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
determine-success: | ||
name: Check workflow success | ||
needs: [setup, lint, flake8, lintr, file_sizes, combine_outputs] | ||
|
@@ -409,4 +460,3 @@ jobs: | |
- name: Check tool test status | ||
if: ${{ needs.combine_outputs.result != 'success' && needs.combine_outputs.result != 'skipped' }} | ||
run: exit 1 | ||
|
Oops, something went wrong.