Repository navigation
146 lines (121 loc) · 4.2 KB
/
Copy pathcd.yml
File metadata and controls
146 lines (121 loc) · 4.2 KB
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
name: CD
on:
push:
branches: [test-publish]
tags:
- '*'
release:
types: [published]
permissions:
contents: read
jobs:
build-sdist:
if: github.repository_owner == 'sgkit-dev'
name: Build sdist
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
persist-credentials: false
- name: Install uv and set the python version
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0
with:
python-version: "3.12"
enable-cache: false
- name: Build sdist
run: uv build --sdist -o dist
- name: Upload artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: build-sdist
path: dist/*.tar.gz
if-no-files-found: error
build-wheels:
if: github.repository_owner == 'sgkit-dev'
needs: [build-sdist]
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-24.04, macos-14, windows-2025, macos-15-intel]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
persist-credentials: false
- name: Download sdist
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: build-sdist
- name: Copy sdist
run: cp *.tar.gz sdist.tar.gz
- name: Install uv and set the python version
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0
with:
python-version: "3.12"
enable-cache: false
- name: Install cibuildwheel
run: uv sync --locked --only-group wheels
- name: Set CIBW_ARCHS_MACOS based on native arch
if: runner.os == 'macOS'
shell: bash
run: |
ARCH=$(uname -m)
if [ "$ARCH" = "x86_64" ]; then
echo "CIBW_ARCHS_MACOS=x86_64" >> "$GITHUB_ENV"
elif [ "$ARCH" = "arm64" ]; then
echo "CIBW_ARCHS_MACOS=arm64" >> "$GITHUB_ENV"
else
echo "Unknown macOS architecture: $ARCH"
exit 1
fi
- name: Build wheels
run: uv run --only-group wheels cibuildwheel sdist.tar.gz
- name: Upload artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: build-wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl
if-no-files-found: error
publish-to-pypi:
if: github.repository_owner == 'sgkit-dev' && github.event_name == 'release'
needs: [build-sdist, build-wheels]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/vcztools
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: build-*
path: dist
merge-multiple: true
- name: Show artifacts
run: ls -lah dist
- uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1
publish-to-testpypi:
if: github.repository_owner == 'sgkit-dev' && github.event_name == 'push' && (github.ref_name == 'test-publish' || startsWith(github.event.ref, 'refs/tags'))
needs: [build-sdist, build-wheels]
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/vcztools
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: build-*
path: dist
merge-multiple: true
- name: Show artifacts
run: ls -lah dist
- uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1
with:
verbose: true
repository-url: https://test.pypi.org/legacy/