|
1 | 1 | name: Create and upload release |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - tags: |
6 | | - - 'v*' |
| 4 | + workflow_run: |
| 5 | + workflows: ["Python Package using pip"] |
| 6 | + types: |
| 7 | + - completed |
7 | 8 |
|
8 | 9 | jobs: |
9 | | - test-linux: |
| 10 | + release: |
| 11 | + # Only run if the triggering run was for a tag starting with v |
| 12 | + if: > |
| 13 | + github.event.workflow_run.conclusion == 'success' && |
| 14 | + startsWith(github.event.workflow_run.head_branch, 'v') |
10 | 15 | runs-on: ubuntu-latest |
11 | 16 | strategy: |
12 | 17 | max-parallel: 5 |
13 | 18 |
|
14 | 19 | steps: |
15 | 20 | - uses: actions/checkout@v4 |
16 | 21 |
|
17 | | - - name: Set up Python 3.11.2 |
18 | | - uses: actions/setup-python@v3 |
| 22 | + - name: Download pytest-results artifact from previous workflow |
| 23 | + uses: actions/download-artifact@v4 |
19 | 24 | with: |
20 | | - python-version: '3.11.2' |
21 | | - |
22 | | - - name: Add conda to system path |
23 | | - run: | |
24 | | - # $CONDA is an environment variable pointing to the root of the miniconda directory |
25 | | - echo $CONDA/bin >> $GITHUB_PATH |
26 | | - |
27 | | - - name: Install dependencies |
28 | | - run: | |
29 | | - conda env update --file environment.yaml |
30 | | - |
31 | | - - name: Lint with flake8 |
32 | | - run: | |
33 | | - conda install flake8 |
34 | | - # stop the build if there are Python syntax errors or undefined names |
35 | | - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
36 | | - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
37 | | - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
38 | | - |
39 | | - - name: Test with pytest |
40 | | - run: | |
41 | | - source activate bemol |
42 | | - pytest tests/ -vvs |
43 | | - # store the latest run results as release artifact |
44 | | - zip -r pytest-results.zip tests/results/ |
| 25 | + name: pytest-results |
| 26 | + run-id: ${{ github.event.workflow_run.id }} |
| 27 | + path: . |
45 | 28 |
|
46 | 29 | - name: Create Release |
47 | 30 | id: create_release |
|
0 commit comments