@@ -15,10 +15,123 @@ jobs:
1515 - id : versions
1616 uses : WIPACrepo/wipac-dev-py-versions-action@v2.5
1717
18- release :
18+
19+ # ###########################################################################
20+ # LINTERS
21+ # ###########################################################################
22+
23+ flake8 :
1924 needs : [ py-versions ]
2025 runs-on : ubuntu-latest
21- concurrency : release
26+ strategy :
27+ fail-fast : false
28+ matrix :
29+ py3 : ${{ fromJSON(needs.py-versions.outputs.matrix) }}
30+ steps :
31+ - uses : actions/checkout@v4
32+ - uses : actions/setup-python@v5
33+ with :
34+ python-version : ${{ matrix.py3 }}
35+ - uses : WIPACrepo/wipac-dev-flake8-action@v1.3
36+ with :
37+ max-complexity : 10 # ideal is ~10-15
38+
39+ mypy :
40+ needs : [ py-versions ]
41+ runs-on : ubuntu-latest
42+ strategy :
43+ fail-fast : false
44+ matrix :
45+ py3 : ${{ fromJSON(needs.py-versions.outputs.matrix) }}
46+ steps :
47+ - uses : actions/checkout@v4
48+ - uses : actions/setup-python@v5
49+ with :
50+ python-version : ${{ matrix.py3 }}
51+ - uses : WIPACrepo/wipac-dev-mypy-action@v2.0
52+
53+
54+ # ###########################################################################
55+ # PACKAGING
56+ # ###########################################################################
57+
58+ writable-branch-detect :
59+ runs-on : ubuntu-latest
60+ outputs :
61+ OKAY : ${{ steps.detect.outputs.OKAY }}
62+ steps :
63+ - name : is this a bot-writable branch?
64+ id : detect
65+ # dependabot can't access normal secrets
66+ # & don't run non-branch triggers (like tags)
67+ # & we don't want to trigger an update on PR's merge to main/master/default (which is a branch)
68+ run : |
69+ set -euo pipefail
70+ echo "now: $(date -u +"%Y-%m-%dT%H:%M:%S.%3N")"
71+ if [[ \
72+ ${{github.actor}} != 'dependabot[bot]' && \
73+ ${{github.ref_type}} == 'branch' && \
74+ ${{format('refs/heads/{0}', github.event.repository.default_branch)}} != ${{github.ref}} \
75+ ]]; then
76+ echo "OKAY=true" >> "$GITHUB_OUTPUT"
77+ echo "yes, this branch is compatible"
78+ else
79+ echo "OKAY=false" >> "$GITHUB_OUTPUT"
80+ echo "no, this branch is incompatible"
81+ fi
82+
83+ py-setup :
84+ needs : [ writable-branch-detect ]
85+ runs-on : ubuntu-latest
86+ steps :
87+ - if : needs.writable-branch-detect.outputs.OKAY == 'true'
88+ uses : actions/checkout@v4
89+ with :
90+ token : ${{ secrets.PERSONAL_ACCESS_TOKEN }}
91+ - if : needs.writable-branch-detect.outputs.OKAY == 'true'
92+ uses : WIPACrepo/wipac-dev-py-setup-action@v4.5
93+ with :
94+ python_min : 3.12
95+ author : WIPAC Developers
96+ author_email : developers@icecube.wisc.edu
97+ keywords_comma : " WIPAC, CI/CD, gitops, testbed"
98+ auto_mypy_option : True
99+
100+ py-dependencies :
101+ needs : [ writable-branch-detect ]
102+ runs-on : ubuntu-latest
103+ steps :
104+ - if : needs.writable-branch-detect.outputs.OKAY == 'true'
105+ uses : actions/checkout@v4
106+ with :
107+ token : ${{ secrets.PERSONAL_ACCESS_TOKEN }}
108+ - if : needs.writable-branch-detect.outputs.OKAY == 'true'
109+ uses : WIPACrepo/wipac-dev-py-dependencies-action@v2.1
110+ with :
111+ use_directory : true
112+
113+
114+ # ###########################################################################
115+ # TESTS
116+ # ###########################################################################
117+
118+
119+ # ###########################################################################
120+ # RELEASE
121+ # ###########################################################################
122+
123+ release :
124+ # only run on main/master/default
125+ if : format('refs/heads/{0}', github.event.repository.default_branch) == github.ref
126+ needs : [
127+ py-versions,
128+ flake8,
129+ mypy,
130+ py-setup,
131+ py-dependencies
132+ ]
133+ runs-on : ubuntu-latest
134+ concurrency : release # prevent any possible race conditions
22135 steps :
23136 - uses : actions/checkout@v4
24137 with :
34147 ignore-paths : |
35148 resources/foo/**
36149 assets/**
150+ .github/**
37151
38152 - uses : WIPACrepo/wipac-dev-py-build-action@main
39153 if : steps.next-version.outputs.version != ''
0 commit comments