Skip to content

Commit

Permalink
ci: bump Rust version and resolve clippy issues (#160)
Browse files Browse the repository at this point in the history
* build: bump Rust version and update dependencies

* chore: resolve all reported Clippy issues

* build: use the correct Toolchain version

* ci: update GitHub Workflows to use valid actions

* ci: add permissions to `clippy_check`

* chore(GH-160): bump dependencies and disable `thread_local_initializer_can_be_made_const` lint

* chore(GH-160): try fixing `thread_local_initializer_can_be_made_const`

* fix(GH-160): `serialized-stdlib` feature

* ci(GH-160): fix `Test Suite`

* fix(GH-160): resolve `insta` deprecation

* ci(GH-160): add formatting check job

* ci(GH-160): reorganize jobs

* style(GH-160): fix formatting

* build(GH-160): fix `#[cfg(never)]`

* build(GH-160): `#[allow(dead_code)]` on `FinishedRanger::end_token`

* build(GH-160): allow more dead code

* test(GH-160): fix `golden.rs`
  • Loading branch information
JarvisCraft authored May 10, 2024
1 parent ad68a24 commit c5b983e
Show file tree
Hide file tree
Showing 25 changed files with 348 additions and 401 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Checks
on: [ pull_request ]
jobs:
tests:
name: Tests
uses: ./.github/workflows/test.yaml
lints:
name: Lints
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.4
- uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
- uses: auguwu/clippy-action@1.3.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
permissions:
checks: write
formatting:
name: Formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.4
- uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
- uses: actions-rust-lang/rustfmt@v1.1.0

15 changes: 0 additions & 15 deletions .github/workflows/clippy_check.yml

This file was deleted.

68 changes: 18 additions & 50 deletions .github/workflows/release.yml → .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,54 +1,27 @@
name: CI
on: [push]
name: Release
on:
push:
tags: [ 'v*' ]
jobs:
test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all
tests:
uses: ./.github/workflows/test.yaml

cargo-release:
if: startsWith(github.ref, 'refs/tags/') && !endsWith(github.ref, '-test')
needs: [test]
if: !endsWith(github.ref, '-test')
needs: [ tests ]
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- uses: actions/checkout@v4.1.4
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
with:
toolchain: stable
override: true
- name: Install cargo release command
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-release
- name: Run cargo login
uses: actions-rs/cargo@v1
with:
command: login
args: ${{ secrets.CARGO_TOKEN }}
- name: Publish crates
uses: actions-rs/cargo@v1
with:
command: release
args: --no-dev-version --skip-push --skip-tag --no-confirm
- run: cargo install cargo-release
- run: cargo login ${{ secrets.CARGO_TOKEN }}
- run: cargo release --no-dev-version --skip-push --skip-tag --no-confirm

github-release:
if: startsWith(github.ref, 'refs/tags/')
needs: [test]
needs: [ tests ]
strategy:
matrix:
target:
Expand Down Expand Up @@ -108,14 +81,12 @@ jobs:
run: sudo apt update

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
with:
toolchain: stable
override: true
target: ${{ matrix.target }}

- name: Checkout
uses: actions/checkout@v2
- uses: actions/checkout@v4.1.4

- name: Add experimental flags
if: ${{ endsWith(github.ref, '-test' )}}
Expand Down Expand Up @@ -147,10 +118,7 @@ jobs:

- name: Run build
if: ${{ !startsWith(matrix.target, 'aarch64-unknown-linux-') }}
uses: actions-rs/cargo@v1
with:
command: build
args: --bin=jrsonnet --release --target ${{ matrix.target }} ${{ env.EXPERIMENTAL_FLAGS }}
run: cargo build --bin=jrsonnet --release --target ${{ matrix.target }} ${{ env.EXPERIMENTAL_FLAGS }}

- name: Package
shell: bash
Expand All @@ -164,7 +132,7 @@ jobs:
run: shasum -a 256 ${{ matrix.name }} > ${{ matrix.name }}.sha256

- name: Publish
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2.0.4
with:
draft: true
files: "jrsonnet*"
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Test
on: [ workflow_call ]
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.4
- uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
- run: cargo test --all
test-stable:
name: Test on stable
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.4
- name: Install the latest stable toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
with:
toolchain: stable
- run: cargo test --all

Loading

0 comments on commit c5b983e

Please sign in to comment.