-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (93 loc) · 3.09 KB
/
wipac-cicd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: wipac ci/cd
on: [push]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# don't cancel on main/master/default
cancel-in-progress: ${{ format('refs/heads/{0}', github.event.repository.default_branch) != github.ref }}
env:
BOT_NAME: wipacdevbot # needed to "Allow specified actors to bypass required pull requests" (pushing to main)
BOT_EMAIL: [email protected]
jobs:
flake8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: WIPACrepo/[email protected]
mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: WIPACrepo/[email protected]
py-setup:
runs-on: ubuntu-latest
steps:
# dependabot can't access normal secrets
# & don't run non-branch triggers (like tags)
- if: |
github.actor != 'dependabot[bot]' &&
github.ref_type == 'branch'
name: checkout (only for non-dependabot non-default branches)
uses: actions/checkout@v3
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- if: |
github.actor != 'dependabot[bot]' &&
github.ref_type == 'branch'
name: wipac-dev-py-setup-action (only for non-dependabot non-default branches)
uses: WIPACrepo/[email protected]
with:
base-keywords: IceCube
git_committer_name: ${{ env.BOT_NAME }}
git_committer_email: ${{ env.BOT_EMAIL }}
py-versions:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.versions.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- id: versions
uses: WIPACrepo/[email protected]
unit-tests:
needs: [py-versions]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
py3: ${{ fromJSON(needs.py-versions.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: ${{ matrix.py3 }}
- name: pip install
run: |
pip install --upgrade pip wheel setuptools
pip install .[tests]
- name: test
run: |
pytest -vvv tests/unit
- name: dump comparison json files
if: always()
run: |
more *.json | cat
release:
# only run on main/master/default
if: format('refs/heads/{0}', github.event.repository.default_branch) == github.ref
needs: [flake8, mypy, py-setup, unit-tests]
runs-on: ubuntu-latest
concurrency: release
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Python Semantic Release
uses: python-semantic-release/[email protected]
with:
git_committer_name: ${{ env.BOT_NAME }}
git_committer_email: ${{ env.BOT_EMAIL }}
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
repository_username: __token__
repository_password: ${{ secrets.WIPAC_PYPI_TOKEN }}