Better toolchain/environment setup, and integration tests #141
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: bazel test //pycross/... | |
# Don't run the requirements test because the ubuntu runner's python version doesn't necessarily match | |
# the development host's. | |
run: bazel --bazelrc=.github/workflows/ci.bazelrc --bazelrc=.bazelrc test -- //pycross/... -//pycross/private:requirements_test | |
smoke-test-gen: | |
name: 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/WORKSPACE | |
# python-version: ["3.10.12", "3.11.6", "3.12.0"] | |
python-version: ["3.12.0"] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: run smoke tests | |
working-directory: tests/smoke | |
run: bazel test //... --@rules_python//python/config_settings:python_version=${{ matrix.python-version }} | |
- name: build zstandard wheels for macos and linux | |
working-directory: tests/smoke | |
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 | |
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 | |
smoke-test-check: | |
name: Smoke test/check - Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }} | |
needs: 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/WORKSPACE | |
# python-version: ["3.10.12", "3.11.6", "3.12.0"] | |
python-version: ["3.12.0"] | |
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 | |
working-directory: tests/smoke | |
run: | | |
ARTIFACT_PATH="${{ runner.temp }}/testwheel-out/${{ matrix.python-version }}" | |
case "${{ matrix.os }}" in | |
macos-latest) wheel_plat="darwin" ;; | |
*) 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" | |
pip install "$wheel" | |
python3 test_zstandard.py | |
done; |