44 push :
55 tags :
66 - ' *'
7- branches-ignore :
8- - ' test_docker '
7+ branches :
8+ - ' ** '
99 pull_request :
1010 types : [opened, synchronize, reopened, ready_for_review]
1111
1212jobs :
13+ cancel_previous_runs :
14+ runs-on : ubuntu-latest
15+ steps :
16+ - name : Cancel Previous Runs
17+ uses : styfle/cancel-workflow-action@0.6.0
18+ with :
19+ access_token : ${{ github.token }}
20+
21+ build_images :
22+
23+ needs : cancel_previous_runs
24+ runs-on : ${{ matrix.config.os }}
25+ if : |
26+ !endsWith(github.event.head_commit.message, '# ci skip') &&
27+ (
28+ startsWith(github.ref, 'refs/heads/test_docker') ||
29+ (
30+ startsWith(github.ref, 'refs/heads/main') &&
31+ github.repository == 'openproblems-bio/openproblems'
32+ )
33+ )
34+
35+ env :
36+ BRANCH_NAME : " auto_update_docker_${{ github.run_number }}"
37+
38+ strategy :
39+ fail-fast : false
40+ matrix :
41+ config :
42+ - {name: 'current', os: ubuntu-18.04, python: '3.8' }
43+
44+ steps :
45+ - uses : actions/checkout@v2
46+ with :
47+ fetch-depth : 1000
48+
49+ - name : Set up Python
50+ uses : actions/setup-python@v2
51+ with :
52+ python-version : ${{ matrix.config.python }}
53+
54+ - name : Install package & dependencies
55+ run : |
56+ python -m pip install --upgrade pip
57+ pip install -U wheel setuptools
58+ pip install --editable .[evaluate]
59+ python -c "import openproblems"
60+
61+ - name : Build Docker images
62+ run : |
63+ cd workflow
64+ snakemake -j $(grep -c processor /proc/cpuinfo) docker_build
65+ cd ..
66+
67+ - name : Push Docker images
68+ if : startsWith(github.ref, 'refs/heads/main')
69+ env :
70+ DOCKER_PASSWORD : ${{ secrets.DOCKER_PASSWORD }}
71+ run : |
72+ cd workflow
73+ snakemake -j $(grep -c processor /proc/cpuinfo) docker_push
74+ cd ..
75+ echo "CHANGED=`git diff --exit-code > /dev/null && echo false || echo true`" >> $GITHUB_ENV
76+
77+ - name : Set up Git branch
78+ if : env.CHANGED == 'true' && startsWith(github.ref, 'refs/heads/main')
79+ run : |
80+ git checkout -b $BRANCH_NAME
81+ git push -u origin $BRANCH_NAME
82+
83+ - name : Commit result
84+ if : env.CHANGED == 'true' && startsWith(github.ref, 'refs/heads/main')
85+ uses : EndBug/add-and-commit@v6
86+ with :
87+ author_name : SingleCellOpenProblems
88+ author_email : singlecellopenproblems@protonmail.com
89+ message : ' Update docker version # ci skip'
90+ add : " docker/.version"
91+ branch : ${{ env.BRANCH_NAME }}
92+ push : false
93+
94+ - name : Create Pull Request
95+ if : env.CHANGED == 'true' && startsWith(github.ref, 'refs/heads/main')
96+ uses : peter-evans/create-pull-request@v3
97+ with :
98+ branch : ${{ env.BRANCH_NAME }}
99+ delete-branch : true
100+ base : main
101+ title : ' [auto] Update docker version'
102+ reviewers : scottgigante, dburkhardt
103+
104+ - name : Upload check results on fail
105+ if : failure()
106+ uses : actions/upload-artifact@main
107+ with :
108+ name : ${{ matrix.config.name }}_results
109+ path : check
110+
13111 run_tester :
14112 runs-on : ubuntu-latest
15113
@@ -20,18 +118,18 @@ jobs:
20118 - /tmp:/tmp
21119 options : --user root
22120
23- if : >-
121+ needs : build_images
122+ if : |
123+ always() &&
124+ (needs.build_images.result == 'success' || needs.build_images.result == 'skipped') &&
24125 !endsWith(github.event.head_commit.message, '# ci skip') &&
25126 (
26127 startsWith(github.ref, 'refs/heads') ||
27- github.event.pull_request.draft == false
128+ github.event.pull_request.draft == false &&
129+ !startsWith(github.ref, 'refs/heads/test_docker')
28130 )
29131
30132 steps :
31- - name : Cancel Previous Runs
32- uses : styfle/cancel-workflow-action@0.6.0
33- with :
34- access_token : ${{ github.token }}
35133
36134 - uses : actions/checkout@v2
37135 with :
@@ -74,10 +172,11 @@ jobs:
74172 install_renv("docker/openproblems-r-base/r_requirements.txt")
75173 shell : Rscript {0}
76174
77- - name : Build Docker images
175+ - name : Update Docker images
176+ if : " !(startsWith(github.ref, 'refs/heads/main') && github.repository == 'openproblems-bio/openproblems')"
78177 run : |
79178 cd workflow
80- snakemake -j 4 docker
179+ snakemake -j $(nproc) docker
81180 cd ..
82181
83182 - name : Run tests
@@ -99,8 +198,10 @@ jobs:
99198 needs : run_tester
100199 runs-on : ${{ matrix.config.os }}
101200 if : >-
201+ always() &&
102202 !contains(github.event.head_commit.message, 'ci skip') &&
103- github.event_name == 'push'
203+ github.event_name == 'push' &&
204+ needs.run_tester.result == 'success'
104205
105206 env :
106207 UPDATE_BRANCH_NAME : " auto_update_benchmark_${{ github.run_number }}"
@@ -215,7 +316,15 @@ jobs:
215316 openproblems-cli --version
216317 openproblems-cli --test-hash
217318
319+ - name : Pull Docker images
320+ if : " (startsWith(github.ref, 'refs/heads/main') && github.repository == 'openproblems-bio/openproblems')"
321+ run : |
322+ cd workflow
323+ snakemake -j $(nproc) docker_pull
324+ cd ..
325+
218326 - name : Build Docker images
327+ if : " !(startsWith(github.ref, 'refs/heads/main') && github.repository == 'openproblems-bio/openproblems')"
219328 run : |
220329 cd workflow
221330 snakemake -j $(nproc) docker
@@ -254,8 +363,8 @@ jobs:
254363 -name "${RUN_NAME}" \
255364 -e.PYTHONPATH="${PYTHONPATH}" \
256365 openproblems-bio/nf-openproblems \
257- --branch ${BRANCH} 2>&1 | \
258- grep -v "^WARN: Unable to retrieve AWS batch instance type.*Invalid identifier"
366+ --branch ${BRANCH} | \
367+ tee >( grep --color=never --line-buffered "Monitor the execution with Nextflow Tower using this url" >> $GITHUB_STEP_SUMMARY)
259368 shell : /bin/bash -exou pipefail {0}
260369
261370 - name : Copy results
0 commit comments