Use Rust 1.82 in pipelines #594
Workflow file for this run
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: Build | |
on: | |
push: | |
branches: | |
- main | |
- release/* | |
pull_request: | |
branches: | |
- main | |
- release/* | |
- feature/* | |
workflow_dispatch: | |
env: | |
RUSTDOCFLAGS: -Dwarnings | |
CARGO_INCREMENTAL: 0 | |
jobs: | |
fmt: | |
name: Code Style | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install LLVM and Clang | |
uses: KyleMayes/install-llvm-action@v1 | |
with: | |
version: "14.0" | |
- name: Setup rust toolchain | |
uses: ./.github/actions/rust-toolchain | |
with: | |
toolchain: 1.82.0 | |
components: rustfmt clippy | |
- name: cargo fmt | |
run: cargo fmt -v --all -- --check | |
- name: cargo clippy | |
run: cargo clippy -vv --all-targets -- -D warnings | |
- name: cargo doc | |
run: cargo doc -vv --all --no-deps | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
- name: Install Python packages | |
run: | | |
python -m pip install -U pip | |
python -m pip install -r pip/requirements-dev.txt | |
- name: Python formatting | |
run: python -m black --check pip | |
- name: Publish Docs as Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docs | |
path: target/doc | |
benches: | |
name: Benches | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install LLVM and Clang | |
uses: KyleMayes/install-llvm-action@v1 | |
with: | |
version: "14.0" | |
- name: Setup rust toolchain | |
run: rustup show | |
- name: cargo bench | |
run: cargo bench --workspace | |
ci: | |
name: ci | |
runs-on: ${{ matrix.config.os }} | |
env: ${{ matrix.config.env }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { os: "ubuntu-20.04", arch: "amd64", env: { AUDITWHEEL_TAG: "manylinux_2_31_x86_64" } } | |
- { os: "ubuntu-22.04", arch: "amd64", env: { AUDITWHEEL_TAG: "manylinux_2_35_x86_64" } } | |
- { os: "windows-2019", arch: "amd64", env: {} } | |
- { os: "macos-14", arch: "arm64", env: {} } | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup rust toolchain | |
uses: ./.github/actions/rust-toolchain | |
with: | |
toolchain: 1.82.0 | |
components: rustfmt clippy | |
- name: Install LLVM | |
uses: ./.github/actions/install-llvm | |
with: | |
version: "14" | |
os: ${{ matrix.config.os }} | |
directory: ${{ github.workspace }}/target/llvm | |
arch: ${{ matrix.config.arch }} | |
- name: Build | |
run: cargo build -vv --release | |
- name: Test | |
run: cargo test -vv --release -- --nocapture | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
if: ${{ matrix.config.os != 'macos-14' }} | |
- name: Install Unconditional Python packages | |
run: | | |
python -m pip install -U pip | |
python -m pip install -r pip/requirements.txt | |
- name: Install Auditwheel Python packages for Linux | |
run: | | |
python -m pip install -r pip/requirements-manylinux.txt | |
if: ${{ matrix.config.os == 'ubuntu-20.04' || matrix.config.os == 'ubuntu-22.04' }} | |
- name: Package Non-Linux | |
run: | | |
python -m build --verbose --sdist --outdir target/wheels ./pip | |
python -m build --verbose --wheel ./pip | |
if: ${{ matrix.config.os != 'ubuntu-20.04' && matrix.config.os != 'ubuntu-22.04' }} | |
- name: Package Linux | |
run: | | |
python -m build --verbose --sdist --outdir target/wheels ./pip | |
python -m build --verbose --wheel --outdir target/raw-wheels ./pip | |
auditwheel repair --plat $AUDITWHEEL_TAG --wheel-dir target/wheels target/raw-wheels/*.whl | |
if: ${{ matrix.config.os == 'ubuntu-20.04' || matrix.config.os == 'ubuntu-22.04' }} | |
- name: Install Test Python packages | |
run: python -m pip install -r pip/requirements-test.txt | |
- name: Test Wheel | |
run: | | |
python -m pip install --force-reinstall --no-index --find-links=target/wheels qirrunner | |
python -m pytest --verbose pip | |
- name: uninstall qirrunner | |
run: python -m pip uninstall -y qirrunner | |
- name: Test sdist | |
run: | | |
python -m pip install (Resolve-Path ./target/wheels/qirrunner*.tar.gz) | |
python -m pytest --verbose pip | |
shell: pwsh | |
# qir-stdlib Artifact | |
- name: Organize qir-stdlib artifacts (all platforms) | |
run: | | |
New-Item -Path ./target/stdlib -ItemType Directory -Force | |
Copy-Item -Path ./stdlib/include/qir_stdlib.h -Destination ./target/stdlib -Force | |
Copy-Item -Path ./stdlib/NOTICE.txt -Destination ./target/stdlib -Force | |
Copy-Item -Path LICENSE -Destination ./target/stdlib -Force | |
shell: pwsh | |
- name: Organize qir-stdlib artifacts (Linux/Mac) | |
run: | | |
Copy-Item -Path ./target/release/libqir_stdlib.a -Destination ./target/stdlib -Force | |
shell: pwsh | |
if: ${{ matrix.config.os != 'windows-2019' }} | |
- name: Organize qir-stdlib artifacts (Windows) | |
run: | | |
Copy-Item -Path ./target/release/qir_stdlib.lib -Destination ./target/stdlib -Force | |
Copy-Item -Path ./stdlib/include/qir_stdlib.def -Destination ./target/stdlib -Force | |
shell: pwsh | |
if: ${{ matrix.config.os == 'windows-2019' }} | |
- name: qir-stdlib Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: qir-stdlib-${{ matrix.config.os }}-${{ matrix.config.arch }}-artifacts | |
path: ./target/stdlib/ | |
- name: Wheel Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheel-artifacts-${{ matrix.config.os }}-${{ matrix.config.arch }} | |
path: target/wheels/* | |
merge: | |
runs-on: ubuntu-latest | |
needs: ci | |
steps: | |
- name: Merge Wheel Artifacts | |
uses: actions/upload-artifact/merge@v4 | |
with: | |
name: wheels | |
pattern: wheel-artifacts-* | |
docs: | |
runs-on: "ubuntu-22.04" | |
needs: fmt | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download Build Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: docs | |
path: target/doc | |
- name: Index Page Redirection | |
run: echo '<meta http-equiv="refresh" content="0; url=qir_runner">' > target/doc/index.html | |
- name: Publish Docs to GitHub Pages | |
uses: JamesIves/github-pages-deploy-action@4.1.7 | |
with: | |
branch: gh-pages | |
folder: target/doc | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' |