forked from TristanCacqueray/python-dhall
-
-
Notifications
You must be signed in to change notification settings - Fork 6
182 lines (182 loc) · 8.01 KB
/
ci.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
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
jobs:
bump:
if: "github.event_name == 'release' && github.event.action == 'created'"
name: Bump minor version
needs:
- lint
runs-on: ubuntu-latest
steps:
- uses: "actions/checkout@v2"
with:
ref: master
- name: Setup python 3.10
uses: "actions/setup-python@v3"
with:
python-version: '3.10'
- name: Install Rust
uses: "actions-rs/toolchain@v1"
with:
override: 'true'
toolchain: stable
- name: Install dependencies
run: "python -m pip install --upgrade pip\ncargo install cargo-bump\npython -m pip install poetry\ntouch Cargo.toml.orig\npython -m poetry install"
- name: Bump and push
run: "cargo bump patch\npoetry version patch\ngit config user.name github-actions\ngit config user.email [email protected]\ngit add Cargo.toml pyproject.toml\ngit commit -m \"Bump version (automatic commit)\"\ngit push"
lint:
name: Lint check
runs-on: ubuntu-latest
steps:
- uses: "actions/checkout@v2"
- name: Install dhall
uses: "dhall-lang/setup-dhall@v4"
with:
version: '1.41.1'
- if: "github.event.name != 'pull_request'"
name: Check github actions workflow
run: "dhall lint .github/workflows/*.dhall\nyaml-to-dhall ./.github/workflows/schema.dhall < .github/workflows/ci.yml > expected.dhall\ndhall diff ./expected.dhall ./.github/workflows/ci.dhall"
- name: Setup python 3.10
uses: "actions/setup-python@v3"
with:
python-version: '3.10'
- name: Install dependencies
run: "python -m pip install --upgrade pip\npython -m pip install black isort autoflake"
- name: Check lint
run: "isort . --check --diff\nblack . --check"
linuxBuild:
container: quay.io/pypa/manylinux_2_24_x86_64
name: Build/test/publish Linux
needs:
- lint
runs-on: ubuntu-latest
steps:
- name: Install Rust
uses: "actions-rs/toolchain@v1"
with:
override: 'true'
toolchain: stable
- uses: "actions/checkout@v2"
- name: Install dependencies
run: "python${{ matrix.python-version }} -m pip install --upgrade pip\npython${{ matrix.python-version }} -m pip install poetry\ntouch Cargo.toml.orig\npython${{ matrix.python-version }} -m poetry install"
- if: "!(github.event_name == 'release' && github.event.action == 'created')"
name: Build and test python package
run: "python${{ matrix.python-version }} -m poetry run maturin build --strip --interpreter python${{ matrix.python-version }}\npython${{ matrix.python-version }} -m poetry run maturin develop\npython${{ matrix.python-version }} -m poetry run pytest tests"
- if: "github.event_name == 'release' && github.event.action == 'created'"
name: "Build and test python package (Release)"
run: "python${{ matrix.python-version }} -m poetry run maturin build --release --strip --interpreter python${{ matrix.python-version }}\npython${{ matrix.python-version }} -m poetry run maturin develop\npython${{ matrix.python-version }} -m poetry run pytest tests"
- name: Install wheels
run: "python${{ matrix.python-version }} -m pip install target/wheels/dhall*manylinux*.whl"
- env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "startsWith(github.ref, 'refs/tags/') && github.event_name == 'release' && github.event.action == 'created'"
name: Release
uses: "softprops/action-gh-release@v1"
with:
files: "target/wheels/dhall*.whl"
- env:
MATURIN_PASSWORD: "${{ secrets.PYPI }}"
if: "startsWith(github.ref, 'refs/tags/') && github.event_name == 'release' && github.event.action == 'created'"
name: PyPI publish
run: "python${{ matrix.python-version }} -m poetry run maturin publish --no-sdist --username __token__ --interpreter python${{ matrix.python-version }}"
strategy:
fail-fast: true
matrix:
python-version:
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- '3.11'
macBuild:
name: Build/test/publish Mac
needs:
- lint
runs-on: macos-latest
steps:
- name: "Setup python ${{ matrix.python-version }}"
uses: "actions/setup-python@v3"
with:
python-version: "${{ matrix.python-version }}"
- name: Install Rust
uses: "actions-rs/toolchain@v1"
with:
override: 'true'
toolchain: stable
- uses: "actions/checkout@v2"
- name: Install dependencies
run: "python -m pip install --upgrade pip\npython -m pip install poetry\ntouch Cargo.toml.orig\npython -m poetry install"
- if: "!(github.event_name == 'release' && github.event.action == 'created')"
name: Build and test python package
run: "python -m poetry run maturin build --strip --interpreter python${{ matrix.python-version }}\npython -m poetry run maturin develop\npython -m poetry run pytest tests"
- if: "github.event_name == 'release' && github.event.action == 'created'"
name: "Build and test python package (Release)"
run: "python -m poetry run maturin build --release --strip --interpreter python${{ matrix.python-version }}\npython -m poetry run maturin develop\npython -m poetry run pytest tests"
- name: Install wheels
run: "python -m pip install target/wheels/dhall*.whl"
- env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "startsWith(github.ref, 'refs/tags/') && github.event_name == 'release' && github.event.action == 'created'"
name: Release
uses: "softprops/action-gh-release@v1"
with:
files: "target/wheels/dhall*.whl"
- env:
MATURIN_PASSWORD: "${{ secrets.PYPI }}"
if: "startsWith(github.ref, 'refs/tags/') && github.event_name == 'release' && github.event.action == 'created'"
name: PyPI publish
run: "python -m poetry run maturin publish --no-sdist --username __token__ --interpreter python${{ matrix.python-version }}"
strategy:
fail-fast: true
matrix:
python-version:
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- '3.11'
windowsBuild:
name: Build/test/publish Windows
needs:
- lint
runs-on: windows-latest
steps:
- name: Install Rust
uses: "actions-rs/toolchain@v1"
with:
override: 'true'
toolchain: stable
- uses: "actions/checkout@v2"
- name: Install dependencies
run: "python -m pip install --upgrade pip\npython -m pip install poetry\ntouch Cargo.toml.orig\npython -m poetry install"
- if: "!(github.event_name == 'release' && github.event.action == 'created')"
name: Build and test python package
run: "python -m poetry run maturin build --strip\npython -m poetry run maturin develop\npython -m poetry run pytest tests"
- if: "github.event_name == 'release' && github.event.action == 'created'"
name: "Build and test python package (Release)"
run: "python -m poetry run maturin build --release --strip\npython -m poetry run maturin develop\npython -m poetry run pytest tests"
- name: Install wheels
run: "python -m pip install --find-links=target\\wheels dhall"
- env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "startsWith(github.ref, 'refs/tags/') && github.event_name == 'release' && github.event.action == 'created'"
name: Release
uses: "softprops/action-gh-release@v1"
with:
files: "target/wheels/dhall*.whl"
- env:
MATURIN_PASSWORD: "${{ secrets.PYPI }}"
if: "startsWith(github.ref, 'refs/tags/') && github.event_name == 'release' && github.event.action == 'created'"
name: PyPI publish
run: python -m poetry run maturin publish --no-sdist --username __token__
name: CI
on:
pull_request:
branches:
- master
push:
branches:
- master
release:
types:
- created
schedule:
- cron: "20 23 * * 6"