generated from bazel-contrib/rules-template
-
Notifications
You must be signed in to change notification settings - Fork 26
148 lines (124 loc) · 4.95 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
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:
main-tests:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v2
- name: .bazelrc.ci
run: |
python -c "import os; file = open('.bazelrc.ci', 'w'); file.write(os.environ['BAZELRC_CI']); file.close()"
shell: bash
env:
BAZELRC_CI: ${{secrets.BAZELRC_CI}}
- name: bazel test //docs/... //pycross/...
run: |
bazel --bazelrc=.github/workflows/ci.bazelrc --bazelrc=.bazelrc test -- //pycross/...
workspace-smoke-test:
name: workspace smoke test - Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: tests/smoke_workspace
steps:
- uses: actions/checkout@v2
- name: .bazelrc.ci
run: |
python -c "import os; file = open('.bazelrc.ci', 'w'); file.write(os.environ['BAZELRC_CI']); file.close()"
shell: bash
env:
BAZELRC_CI: ${{secrets.BAZELRC_CI}}
- name: run smoke tests
run: |
bazel test //...
bzlmod-smoke-test-gen:
name: bzlmod smoke 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 tests/smoke_bzlmod/MODULE.bazel
python-version: ["3.10.12", "3.11.6", "3.12.0"]
defaults:
run:
working-directory: tests/smoke_bzlmod
steps:
- uses: actions/checkout@v2
- name: .bazelrc.ci
run: |
python -c "import os; file = open('.bazelrc.ci', 'w'); file.write(os.environ['BAZELRC_CI']); file.close()"
shell: bash
env:
BAZELRC_CI: ${{secrets.BAZELRC_CI}}
- name: run smoke 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_x86_64 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-smoke-test-check:
name: bzlmod smoke test/check - Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }}
needs: bzlmod-smoke-test-gen
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
# This needs to stay in sync with tests/smoke_bzlmod/MODULE.bazel
python-version: ["3.10.12", "3.11.6", "3.12.0"]
defaults:
run:
working-directory: tests/smoke_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;