-
Notifications
You must be signed in to change notification settings - Fork 6
167 lines (159 loc) · 5.54 KB
/
main.yaml
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
on:
push:
jobs:
nix:
strategy:
matrix:
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v16
with:
# TODO: https://github.com/DeterminateSystems/nix-installer-action/issues/133
source-tag: "v0.32.3"
- uses: DeterminateSystems/magic-nix-cache-action@v8
- uses: cachix/cachix-action@v15
with:
name: nialov
authToken: "${{ secrets.CACHIX_AUTH_TOKEN_NIALOV }}"
- name: Check with nix
# This also builds documentation (fractopo-documentation) so docs job
# does not have to run every time
run: |
nix run .#nix-fast-build -- --skip-cached --no-nom
poetry:
strategy:
matrix:
platform: [ubuntu-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
runs-on: ${{ matrix.platform }}
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v16
with:
# TODO: https://github.com/DeterminateSystems/nix-installer-action/issues/133
source-tag: "v0.32.3"
- uses: DeterminateSystems/magic-nix-cache-action@v8
- uses: cachix/cachix-action@v15
with:
name: nialov
authToken: "${{ secrets.CACHIX_AUTH_TOKEN_NIALOV }}"
- name: Test with poetry on Python ${{ matrix.python-version }}
run: |
nix run .#poetry-run -- ${{ matrix.python-version }} pytest
release:
runs-on: ubuntu-latest
needs: [nix, poetry]
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v16
with:
# TODO: https://github.com/DeterminateSystems/nix-installer-action/issues/133
source-tag: "v0.32.3"
- uses: DeterminateSystems/magic-nix-cache-action@v8
- uses: cachix/cachix-action@v15
with:
name: nialov
authToken: "${{ secrets.CACHIX_AUTH_TOKEN_NIALOV }}"
- name: Build package with poetry
run: |
nix run .#poetry -- check
nix run .#poetry -- build
- name: Check that version in pyproject.toml is equivalent to tag
if: >
github.event_name == 'push'
&& startsWith(github.ref, 'refs/tags')
run: |
nix run .#sync-git-tag-with-poetry
git diff --exit-code
- name: Publish distribution 📦 to PyPI on tagged commit pushes
# Publish to PyPI on tagged commit pushes on master
if: >
github.event_name == 'push'
&& startsWith(github.ref, 'refs/tags')
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
- name: Create incremental changelog
run: >
sed -n '3,/## v[[:digit:]].[[:digit:]].[[:digit:]]/p' CHANGELOG.md | head -n -2
> RELEASE_CHANGELOG.md
# sed -n '2,/Release Changelog/p' CHANGELOG.md | head -n -4
- name: Echo RELEASE_CHANGELOG.md
run: cat RELEASE_CHANGELOG.md
- name: Publish release on GitHub
if: >
github.event_name == 'push'
&& startsWith(github.ref, 'refs/tags')
uses: softprops/action-gh-release@v2
with:
body_path: RELEASE_CHANGELOG.md
files: |
dist/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
docs:
if: >
github.event_name == 'push'
&& startsWith(github.ref, 'refs/heads/master')
needs: [nix]
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v16
with:
# TODO: https://github.com/DeterminateSystems/nix-installer-action/issues/133
source-tag: "v0.32.3"
- uses: DeterminateSystems/magic-nix-cache-action@v8
- uses: cachix/cachix-action@v15
with:
name: nialov
authToken: "${{ secrets.CACHIX_AUTH_TOKEN_NIALOV }}"
- name: Build documentation
run: |
nix build .#fractopo.passthru.documentation.doc
cp -Lr --no-preserve=mode,ownership,timestamps "$(find ./result-doc/ -maxdepth 4 -type 'd' -path '*html*')" ./docs
- uses: actions/upload-pages-artifact@v3
with:
# Upload folder with static docs
path: "docs/"
- uses: actions/configure-pages@v5
- id: deployment
uses: actions/deploy-pages@v4
docker:
runs-on: ubuntu-latest
needs: [nix]
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v16
with:
# TODO: https://github.com/DeterminateSystems/nix-installer-action/issues/133
source-tag: "v0.32.3"
- uses: DeterminateSystems/magic-nix-cache-action@v8
- uses: cachix/cachix-action@v15
with:
name: nialov
authToken: "${{ secrets.CACHIX_AUTH_TOKEN_NIALOV }}"
- name: Push to registry
env:
PUSHER_TOKEN: ${{ secrets.PUSHER_TOKEN }}
REGISTRY: ${{ secrets.REGISTRY }}
PROJECT: ${{ secrets.PROJECT }}
# TODO: Should not run unless on master branch?
run: |
nix run .#push-fractopo-validation-image -- "$REGISTRY" "$PROJECT" "$PUSHER_TOKEN"