Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 43 additions & 65 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,88 +1,66 @@
name: Rust Check

on: push
on:
push:
branches: [main]
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
check:
name: Cargo Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: taiki-e/install-action@v1
with:
tool: cargo-hack@0.6.28,cargo-make
- run: cargo make check
clippy:
name: Clippy Lints
name: Run Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy
override: true
- uses: taiki-e/install-action@v1
with:
tool: cargo-hack@0.6.28,cargo-make
- run: cargo make clippy
- uses: actions/checkout@v5
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@cargo-hack
- uses: taiki-e/install-action@cargo-deny
- uses: taiki-e/install-action@cargo-make

- name: Check Formatting
run: cargo fmt --all -- --check

- name: Run cargo deny
run: cargo make deny

- name: Run Clippy
run: cargo make clippy

deadlinks:
name: Cargo Deadlinks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: taiki-e/install-action@v1
- uses: actions/checkout@v5
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@cargo-make
- uses: taiki-e/install-action@v2
with:
tool: cargo-deadlinks,cargo-make
- run: cargo make deadlinks
deny:
name: Cargo Deny
runs-on: ubuntu-latest
strategy:
matrix:
checks:
- advisories
- bans licenses sources
tool: cargo-deadlinks
- run: cargo make --cwd rigetti-pyo3 deadlinks

# Prevent sudden announcement of a new advisory from failing ci:
continue-on-error: ${{ matrix.checks == 'advisories' }}

steps:
- uses: actions/checkout@v2
- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check ${{ matrix.checks }}
msrv:
name: Cargo MSRV
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v5
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@cargo-hack
- uses: taiki-e/install-action@cargo-make
- uses: taiki-e/install-action@v2
with:
toolchain: stable
override: true
- uses: taiki-e/install-action@v1
with:
tool: cargo-msrv,cargo-make
- run: cargo make msrv-verify
tool: cargo-msrv
- run: cargo make --cwd rigetti-pyo3 msrv-verify
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not apply these to optipy as well?


test:
name: Cargo Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: taiki-e/install-action@v1
with:
tool: cargo-hack@0.6.28,cargo-make
- uses: actions/checkout@v5
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@cargo-hack
- uses: taiki-e/install-action@cargo-make
- run: cargo make test
47 changes: 30 additions & 17 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
inputs:
type:
Expand All @@ -16,24 +19,34 @@ on:

jobs:
prepare-release:
if: ${{ ! (github.event_name == 'push' && contains(github.event.head_commit.message, 'prepare release [skip ci]' )) }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For readability, I would have preferred this, assuming it parses correctly

if: ${{ github.event_name != 'push' || ! contains(github.event.head_commit.message, 'prepare release [skip ci]' ) }}

runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.PAT }}
- name: Install Knope
uses: knope-dev/action@v1
with:
version: 0.7.0 # Test before updating, breaking changes likely: https://github.com/knope-dev/action#install-latest-version
- run: |
git config --global user.name "${{ github.triggering_actor }}"
git config --global user.email "${{ github.triggering_actor}}@users.noreply.github.com"
- name: Prepare Prerelease
run: knope --prerelease-label rc release
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.type == 'prerelease')
- name: Prepare Release
run: knope release
if: github.event_name == 'workflow_dispatch'
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: Swatinem/rust-cache@v2

- name: Configure Git
run: |
git config --global user.name "${{ github.triggering_actor }}"
git config --global user.email "${{ github.triggering_actor}}@users.noreply.github.com"

- name: Install Knope
uses: knope-dev/action@v2.1.0
with:
version: 0.21.3 # Test before updating, breaking changes likely: https://github.com/knope-dev/action#install-latest-version

- name: Dry-run Release
run: knope release --verbose --dry-run
if: github.event_name == 'pull_request'

- name: Prepare Prerelease
run: knope release --verbose --prerelease-label=rc
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.type == 'prerelease')

- name: Release
run: knope release --verbose
if: github.event_name == 'workflow_dispatch' && inputs.type == 'release'
30 changes: 30 additions & 0 deletions .github/workflows/publish-crates.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Publish Crates

on:
release:
types: [published]
workflow_dispatch:
description: "Manually publish release"

jobs:
publish-rigetti-pyo3:
Comment on lines +9 to +10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't have applied at the time of the PR, but with Rust 1.90 we now have cargo publish --workspace

if: ${{ github.event_name == 'workflow_dispatch' || startswith(github.event.release.tag_name, 'rigetti-pyo3/v') }}

runs-on: ubuntu-latest
name: Publish rigetti-pyo3
steps:
- uses: actions/checkout@v5
- uses: Swatinem/rust-cache@v2
- run: |
cargo publish -p rigetti-pyo3 --locked --token ${{ secrets.CRATES_IO_TOKEN }}
publish-optipy:
if: ${{ github.event_name == 'workflow_dispatch' || startswith(github.event.release.tag_name, 'optipy/v') }}

runs-on: ubuntu-latest
name: Publish optipy
steps:
- uses: actions/checkout@v5
- uses: Swatinem/rust-cache@v2
- run: |
cargo publish -p optipy --locked --token ${{ secrets.CRATES_IO_TOKEN }}
24 changes: 0 additions & 24 deletions .github/workflows/release.yml

This file was deleted.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/target
/Cargo.lock
Loading
Loading