Skip to content

Commit

Permalink
Simplfying CI setup and bind to Rust 1.83
Browse files Browse the repository at this point in the history
  • Loading branch information
timrogers committed Nov 30, 2024
1 parent e15b2db commit 87b1d6c
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 85 deletions.
55 changes: 7 additions & 48 deletions .github/workflows/build_and_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,9 @@ jobs:
- name: Install libudev-dev
run: sudo apt-get update && sudo apt-get install libudev-dev
if: matrix.job.os == 'ubuntu-latest' || matrix.job.os == 'self-hosted'
- name: Cache Rust dependencies
uses: actions/[email protected]
with:
path: target
key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.OS }}-build-
- name: Install latest Rust nightly
uses: actions-rs/toolchain@v1
with:
profile: minimal
components: rustc, cargo
toolchain: nightly
override: true
target: ${{ matrix.job.target }}
- name: Run cargo build --release
uses: actions-rs/cargo@v1
with:
args: --release --target=${{ matrix.job.target }}
command: build
- uses: Swatinem/rust-cache@v2
- name: Build in release mode
run: cargo build --release --target=${{ matrix.job.target }}
- name: Sanitise Git ref for use in filenames
id: sanitise_ref
run: echo "::set-output name=value::$(echo "${{ github.ref_name }}" | tr '/' '_')"
Expand Down Expand Up @@ -164,20 +147,7 @@ jobs:
- uses: actions/checkout@v4
- name: Install libudev-dev
run: sudo apt-get update && sudo apt-get install libudev-dev
- name: Cache Rust dependencies
uses: actions/[email protected]
with:
path: target
key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.OS }}-build-
- name: Install latest Rust nightly
uses: actions-rs/toolchain@v1
with:
profile: minimal
components: rustc, cargo
toolchain: nightly
override: true
- uses: Swatinem/rust-cache@v2
- name: Install cargo-edit
run: cargo install cargo-edit
- name: Set the version to a dummy version to allow publishing
Expand Down Expand Up @@ -234,19 +204,8 @@ jobs:
- uses: actions/checkout@v4
- name: Install libudev-dev
run: sudo apt-get update && sudo apt-get install libudev-dev
- name: Cache Rust dependencies
uses: actions/[email protected]
with:
path: target
key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.OS }}-build-
- name: Install latest Rust nightly
uses: actions-rs/toolchain@v1
with:
profile: minimal
components: rustc, cargo
toolchain: nightly
override: true
- uses: Swatinem/rust-cache@v2
- name: Build in release mode
run: cargo build --release --target=${{ matrix.job.target }}
- name: Publish to Crates.io
run: cargo publish --token ${{ secrets.CRATES_IO_API_TOKEN }}
69 changes: 32 additions & 37 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,35 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Install libudev-dev
run: sudo apt-get update && sudo apt-get install libudev-dev

- name: Install latest Rust nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
components: rustc, rustfmt, clippy

- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Set up Python
uses: actions/setup-python@v5

- name: Detect code style issues
uses: pre-commit/[email protected]
env:
SKIP: no-commit-to-branch

- name: Generate patch file
if: failure()
run: |
git diff-index -p HEAD > "${PATCH_FILE}"
[ -s "${PATCH_FILE}" ] && echo "UPLOAD_PATCH_FILE=${PATCH_FILE}" >> "${GITHUB_ENV}"
env:
PATCH_FILE: pre-commit.patch

- name: Upload patch artifact
if: failure() && env.UPLOAD_PATCH_FILE != null
uses: actions/upload-artifact@v4
with:
name: ${{ env.UPLOAD_PATCH_FILE }}
path: ${{ env.UPLOAD_PATCH_FILE }}
- name: Install libudev-dev
run: sudo apt-get update && sudo apt-get install libudev-dev

- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Set up Python
uses: actions/setup-python@v5

- uses: Swatinem/rust-cache@v2

- name: Detect code style issues
uses: pre-commit/[email protected]
env:
SKIP: no-commit-to-branch

- name: Generate patch file
if: failure()
run: |
git diff-index -p HEAD > "${PATCH_FILE}"
[ -s "${PATCH_FILE}" ] && echo "UPLOAD_PATCH_FILE=${PATCH_FILE}" >> "${GITHUB_ENV}"
env:
PATCH_FILE: pre-commit.patch

- name: Upload patch artifact
if: failure() && env.UPLOAD_PATCH_FILE != null
uses: actions/upload-artifact@v4
with:
name: ${{ env.UPLOAD_PATCH_FILE }}
path: ${{ env.UPLOAD_PATCH_FILE }}
5 changes: 5 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[toolchain]
channel = "1.83.0"
components = [ "rustc", "rustfmt", "clippy" ]
targets = [ "x86_64-unknown-linux-gnu", "aarch64-unknown-linux-gnu", "x86_64-apple-darwin", "aarch64-apple-darwin", "x86_64-pc-windows-msvc" ]
profile = "minimal"

0 comments on commit 87b1d6c

Please sign in to comment.