generated from bazel-contrib/rules-template
-
Notifications
You must be signed in to change notification settings - Fork 23
191 lines (158 loc) · 5.9 KB
/
ci.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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
dev-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: DamianReeves/write-file-action@master
with:
path: .bazelrc.ci
contents: ${{secrets.BAZELRC_CI || '# no rbe access'}}
write-mode: overwrite
- name: Everything except //pycross/...
run: |
bazel test -- //... -//pycross/...
e2e-test-multi-bazel:
name: Default Python version tests - Bazel ${{matrix.bazel-version}}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
bazel-version: ["6.x", "7.x"]
env:
USE_BAZEL_VERSION: ${{matrix.bazel-version}}
steps:
- uses: actions/checkout@v2
- uses: DamianReeves/write-file-action@master
with:
path: e2e/workspace/.bazelrc.ci
contents: ${{secrets.BAZELRC_CI || '# no rbe access'}}
write-mode: overwrite
- name: run e2e tests - workspace
working-directory: e2e/workspace
run: |
bazel test //...
- name: run e2e tests - bzlmod
working-directory: e2e/bzlmod
run: |
bazel test -- //... -//lock_file/...
- name: run e2e tests - bzlmod + static lock file
if: matrix.bazel-version != '6.x'
working-directory: e2e/bzlmod
run: |
bazel test //lock_file/...
- name: run pycross tests as consumer
working-directory: e2e/bzlmod
run: |
bazel test @rules_pycross//pycross/...
workspace-e2e-test:
name: workspace e2e test - Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
# This needs to stay in sync with e2e/workspace/WORKSPACE
python-version: ["3.10.11", "3.11.6", "3.12.0"]
defaults:
run:
working-directory: e2e/workspace
steps:
- uses: actions/checkout@v2
- uses: DamianReeves/write-file-action@master
with:
path: e2e/workspace/.bazelrc.ci
contents: ${{secrets.BAZELRC_CI || '# no rbe access'}}
write-mode: overwrite
- name: run e2e tests
run: |
bazel test //...
bzlmod-e2e-test-gen:
name: bzlmod e2e test/generate - Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
# This needs to stay in sync with e2e/bzlmod/MODULE.bazel
python-version: ["3.10.11", "3.11.6", "3.12.0"]
defaults:
run:
working-directory: e2e/bzlmod
steps:
- uses: actions/checkout@v2
- uses: DamianReeves/write-file-action@master
with:
path: e2e/bzlmod/.bazelrc.ci
contents: ${{secrets.BAZELRC_CI || '# no rbe access'}}
write-mode: overwrite
- name: run e2e tests
run: |
bazel test //... --@rules_python//python/config_settings:python_version=${{ matrix.python-version }}
- name: build zstandard wheels for macos and linux
run: |
ARTIFACT_PATH="${{ runner.temp }}/testwheel-out/${{ matrix.python-version }}/${{ matrix.os }}"
mkdir -p "$ARTIFACT_PATH"
for plat in macos_arm64 linux_x86_64; do
bazel build //pdm:zstandard_build \
--@rules_python//python/config_settings:python_version=${{ matrix.python-version }} \
--platforms=@zig_sdk//platform:$plat \
--output_groups=all_files
cp bazel-bin/pdm/zstandard_build/zstandard-*.whl "$ARTIFACT_PATH/$(cat bazel-bin/pdm/zstandard_build/zstandard-*.whl.name)"
done;
- uses: actions/upload-artifact@v3
with:
name: built-test-wheel
path: ${{ runner.temp }}/testwheel-out
bzlmod-e2e-test-check:
name: bzlmod e2e test/check - Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }}
needs: bzlmod-e2e-test-gen
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
# This needs to stay in sync with e2e/bzlmod/MODULE.bazel
python-version: ["3.10.11", "3.11.6", "3.12.0"]
defaults:
run:
working-directory: e2e/bzlmod
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Ensure latest pip
run: |
python -m pip install --upgrade pip
- uses: actions/download-artifact@v3
with:
name: built-test-wheel
path: ${{ runner.temp }}/testwheel-out
- name: Check wheels
run: |
ARTIFACT_PATH="${{ runner.temp }}/testwheel-out/${{ matrix.python-version }}"
case "${{ matrix.os }}" in
macos-latest) wheel_plat="macosx" ;;
*) wheel_plat="linux" ;;
esac
for wheel in $(find $ARTIFACT_PATH -name '*.whl' | grep "$wheel_plat"); do
rm -rf "${{ runner.temp }}/env"
python3 -m venv "${{ runner.temp }}/env"
. "${{ runner.temp }}/env/bin/activate"
shasum -a 256 "$wheel"
pip install "$wheel"
python3 test_zstandard.py
deactivate
done;