Skip to content

Commit

Permalink
Add 'hugr-llvm/' from commit '2d9bfce9ee7b9d460bfa63465850dac49b5c6e1f'
Browse files Browse the repository at this point in the history
git-subtree-dir: hugr-llvm
git-subtree-mainline: c5b597d
git-subtree-split: 2d9bfce
  • Loading branch information
doug-q committed Oct 21, 2024
2 parents c5b597d + 2d9bfce commit f9ad559
Show file tree
Hide file tree
Showing 170 changed files with 14,870 additions and 0 deletions.
1 change: 1 addition & 0 deletions hugr-llvm/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/snapshots/*.snap -diff
11 changes: 11 additions & 0 deletions hugr-llvm/.github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# for syntax see https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#codeowners-syntax

# base rule, hugr-llvm team is codeowner for whole repo
* @CQCL/hugr-llvm

# Add specific rules below.
# Lower the rule, higher the precedence

# The release PRs that trigger publication to PyPI always modify the changelog.
# We require those PRs to be approved by someone with release permissions.
CHANGELOG.md @doug-q @aborgna-q @ss2165 @cqc-alec
6 changes: 6 additions & 0 deletions hugr-llvm/.github/change-filters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Filters used by [dorny/path-filters](https://github.com/dorny/paths-filter)
# to detect changes in each subproject, and only run the corresponding jobs.

rust:
- "src/**"
- "Cargo.*"
13 changes: 13 additions & 0 deletions hugr-llvm/.github/workflows/add-to-project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Add issues to project board
on:
issues:
types:
- opened

jobs:
add-to-project:
uses: CQCL/hugrverse-actions/.github/workflows/add-to-project.yml@main
with:
project-url: https://github.com/orgs/CQCL-DEV/projects/10
secrets:
GITHUB_PAT: ${{ secrets.ADD_TO_PROJECT_PAT }}
213 changes: 213 additions & 0 deletions hugr-llvm/.github/workflows/ci-rs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
name: Continuous integration 🦀

on:
push:
branches:
- main
pull_request:
branches:
- main
merge_group:
types: [checks_requested]
workflow_dispatch: {}

env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
RUSTFLAGS: "--cfg=ci_run"
MIRIFLAGS: '-Zmiri-permissive-provenance' # Required due to warnings in bitvec 1.0.1
CI: true # insta snapshots behave differently on ci
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
HUGR_TEST_SCHEMA: "1"

jobs:
# Check if changes were made to the relevant files.
# Always returns true if running on the default branch, to ensure all changes are throughly checked.
changes:
name: Check for changes in Rust files
runs-on: ubuntu-latest
# Required permissions
permissions:
pull-requests: read
# Set job outputs to values from filter step
outputs:
rust: ${{ github.ref_name == github.event.repository.default_branch || steps.filter.outputs.rust }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: .github/change-filters.yml

check:
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: mozilla-actions/[email protected]
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: install-llvm
run: "sudo apt-get update && sudo apt-get install -y llvm-14"
- name: Check formatting
run: cargo fmt -- --check
- name: Run clippy
run: cargo clippy --all-targets --workspace -- -D warnings
- name: Build docs
run: cargo doc --no-deps --workspace
env:
RUSTDOCFLAGS: "-Dwarnings"


benches:
name: Build benchmarks 🏋️
needs: changes
# if: ${{ needs.changes.outputs.rust == 'true' && github.event_name != 'merge_group' }}
if: false # TODO
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: mozilla-actions/[email protected]
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
# - name: Build benchmarks with no features
# run: cargo bench --verbose --no-run --workspace --no-default-features
- name: Build benchmarks with all features
run: cargo bench --verbose --no-run --workspace

# # Run tests on Rust stable
# tests-stable-no-features:
# needs: changes
# if: ${{ needs.changes.outputs.rust == 'true' }}
# runs-on: ubuntu-latest
# name: tests (Rust stable, no features)
# steps:
# - uses: actions/checkout@v4
# - uses: mozilla-actions/[email protected]
# - name: install-llvm
# run: "sudo apt-get update && sudo apt-get install -y llvm-14"
# - id: toolchain
# uses: dtolnay/rust-toolchain@master
# with:
# toolchain: 'stable'
# - name: Configure default rust toolchain
# run: rustup override set ${{steps.toolchain.outputs.name}}
# - name: Build with no features
# run: cargo test --verbose --workspace --no-default-features --no-run
# - name: Tests with no features
# run: cargo test --verbose --workspace --no-default-features

# Run tests on Rust stable
tests-stable-all-features:
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' }}
runs-on: ubuntu-latest
name: tests (Rust stable, all features)
steps:
- uses: actions/checkout@v4
- uses: mozilla-actions/[email protected]
- name: install-llvm
run: "sudo apt-get update && sudo apt-get install -y llvm-14"
- id: toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: 'stable'
- name: Configure default rust toolchain
run: rustup override set ${{steps.toolchain.outputs.name}}
- name: Build with all features
run: cargo test --verbose --workspace --no-run
- name: Tests with all features
run: cargo test --verbose --workspace

# Run tests on other toolchains
tests-other:
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' && github.event_name != 'merge_group' }}
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
rust: ['1.75', 'beta', 'nightly']
name: tests (Rust ${{ matrix.rust }})
steps:
- uses: actions/checkout@v4
- uses: mozilla-actions/[email protected]
- name: install-llvm
run: "sudo apt-get update && sudo apt-get install -y llvm-14"
- id: toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- name: Configure default rust toolchain
run: rustup override set ${{steps.toolchain.outputs.name}}
- name: Build with all features
run: cargo test --verbose --workspace --no-run
- name: Tests with all features
run: cargo test --verbose --workspace

# This is a meta job to mark successful completion of the required checks,
# even if they are skipped due to no changes in the relevant files.
required-checks:
name: Required checks 🦀
needs: [changes, check,
# tests-stable-no-features,
tests-stable-all-features]
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
steps:
- name: Fail if required checks failed
# This condition should simply be `if: failure() || cancelled()`,
# but there seems to be a bug in the github workflow runner.
#
# See https://github.com/orgs/community/discussions/80788

# needs.tests-stable-no-features.result == 'failure' || needs.tests-stable-no-features.result == 'cancelled' ||
if: |
needs.changes.result == 'failure' || needs.changes.result == 'cancelled' ||
needs.check.result == 'failure' || needs.check.result == 'cancelled' ||
needs.tests-stable-all-features.result == 'failure' || needs.tests-stable-all-features.result == 'cancelled'
run: |
echo "Required checks failed"
echo "Please check the logs for more information"
exit 1
- name: Pass if required checks passed
run: |
echo "All required checks passed"
coverage:
needs: [changes,
# tests-stable-no-features,
tests-stable-all-features, tests-other, check]
# Run only if there are changes in the relevant files and the check job passed or was skipped
if: always() && !failure() && !cancelled() && needs.changes.outputs.rust == 'true' && github.event_name != 'merge_group'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: mozilla-actions/[email protected]
- uses: dtolnay/rust-toolchain@master
with:
# Nightly is required to count doctests coverage
#
# Pinned nightly version until this gets resolved
# https://github.com/rust-lang/rust/issues/125474
toolchain: 'nightly-2024-05-22'
components: llvm-tools-preview
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Run tests with coverage instrumentation
run: |
cargo llvm-cov clean --workspace
cargo llvm-cov --no-report --workspace --doctests
- name: Generate coverage report
run: cargo llvm-cov report --codecov --output-path coverage.json
- name: Upload coverage to codecov.io
uses: codecov/codecov-action@v4
with:
files: coverage.json
name: rust
flags: rust
token: ${{ secrets.CODECOV_TOKEN }}
9 changes: 9 additions & 0 deletions hugr-llvm/.github/workflows/drop-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: cleanup caches by a branch
on:
pull_request:
types:
- closed

jobs:
drop-cache:
uses: CQCL/hugrverse-actions/.github/workflows/drop-cache.yml@main
20 changes: 20 additions & 0 deletions hugr-llvm/.github/workflows/pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Check Conventional Commits format
on:
pull_request_target:
branches:
- main
types:
- opened
- edited
- synchronize
- labeled
- unlabeled
merge_group:
types: [checks_requested]

jobs:
check-title:
name: check-title
uses: CQCL/hugrverse-actions/.github/workflows/pr-title.yml@main
secrets:
GITHUB_PAT: ${{ secrets.HUGRBOT_PAT }}
25 changes: 25 additions & 0 deletions hugr-llvm/.github/workflows/release-plz.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Automatic changelog, version bumping, and semver-checks with release-plz for rust projects
name: Release-plz 🦀

on:
push:
branches:
- main

jobs:
release-plz:
name: Release-plz
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.HUGRBOT_PAT }}
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run release-plz
uses: MarcoIeni/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.HUGRBOT_PAT }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
18 changes: 18 additions & 0 deletions hugr-llvm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Devenv
.devenv*
devenv.local.nix

# direnv
.direnv

# pre-commit
.pre-commit-config.yaml


# Added by cargo

/target
/.envrc
/result
*.snap.new
/.vscode/
Loading

0 comments on commit f9ad559

Please sign in to comment.