Skip to content

Commit

Permalink
build: Upgrade Rust toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
siketyan committed Oct 20, 2023
1 parent 6c980f6 commit 4124312
Show file tree
Hide file tree
Showing 4 changed files with 347 additions and 444 deletions.
124 changes: 50 additions & 74 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,77 +17,73 @@ env:
jobs:
checks:
runs-on: ubuntu-22.04
permissions:
checks: write
contents: read
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

- name: Install latest stable
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
override: true
components: rustfmt,clippy

- uses: Swatinem/rust-cache@76686c56f2b581d1bb5bda44b51f7e24bd9b8b8e
- uses: Swatinem/rust-cache@v2

- name: Install libpcsclite
run: sudo apt update && sudo apt install libpcsclite-dev

# - run: rm -f rust-toolchain.toml

- name: Run clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --workspace --exclude jpki-ffi-generic
run: cargo +stable clippy --workspace --exclude jpki-ffi-generic

# - name: Run clippy
# uses: auguwu/clippy-action@1.3.0
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# check-args: --workspace,--exclude,jpki-ffi-generic

- name: Run rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all --check
run: cargo fmt --all --check

- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --workspace --exclude jpki-ffi-generic --exclude jpki-ffi-android --verbose
run: cargo test --workspace --exclude jpki-ffi-generic --exclude jpki-ffi-android --verbose

checks-nightly:
runs-on: ubuntu-22.04
permissions:
checks: write
contents: read
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

- name: Install nightly-2023-02-04
uses: actions-rs/toolchain@v1
- name: Install nightly-2023-10-20
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2023-02-04
override: true
toolchain: nightly-2023-10-20
components: rustfmt,clippy

- uses: Swatinem/rust-cache@76686c56f2b581d1bb5bda44b51f7e24bd9b8b8e
- uses: Swatinem/rust-cache@v2

- name: Install libpcsclite
run: sudo apt update && sudo apt install libpcsclite-dev

- name: Run clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: -p jpki-ffi-generic
run: cargo clippy -p jpki-ffi-generic

- name: Run rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all --check
# - name: Run clippy
# uses: auguwu/clippy-action@1.3.0
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# check-args: --workspace,--exclude,jpki-ffi-generic

- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: -p jpki-ffi-generic --verbose
run: cargo test -p jpki-ffi-generic --verbose

build:
needs:
Expand All @@ -113,13 +109,13 @@ jobs:
android: false
additionalFeatures: '--features pcsc'
- target: x86_64-apple-darwin
host: macos-12
host: macos-13-large
artifact: jpki-cli
cli: true
android: false
additionalFeatures: '--features pcsc'
- target: aarch64-apple-darwin
host: macos-12
host: macos-13-xlarge
artifact: jpki-cli
cli: true
android: false
Expand All @@ -140,21 +136,17 @@ jobs:

runs-on: ${{ matrix.host }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

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

- id: cache-key
run: echo "::set-output name=key::$(echo '${{ toJSON(matrix) }}' | shasum -a 256)"

- uses: Swatinem/rust-cache@76686c56f2b581d1bb5bda44b51f7e24bd9b8b8e
- uses: Swatinem/rust-cache@v2
with:
key: ${{ steps.cache-key.outputs.key }}

Expand Down Expand Up @@ -205,62 +197,49 @@ jobs:
- checks-nightly
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

- name: Install nightly-2023-02-04
uses: actions-rs/toolchain@v1
- name: Install nightly-2023-10-20
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2023-02-04
override: true
target: ${{ matrix.target }}
toolchain: nightly-2023-10-20
components: rustfmt,clippy

- uses: Swatinem/rust-cache@76686c56f2b581d1bb5bda44b51f7e24bd9b8b8e
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.features }}

- name: Install libpcsclite
run: sudo apt update && sudo apt install libpcsclite-dev

- name: Build (FFI/Generic)
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose --release --all-features -p jpki-ffi-generic
run: cargo build --verbose --release --all-features -p jpki-ffi-generic

deploy:
runs-on: ubuntu-22.04
if: ${{ github.event_name == 'release' }}
needs:
- build
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

- name: Install latest stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@76686c56f2b581d1bb5bda44b51f7e24bd9b8b8e
- uses: Swatinem/rust-cache@v2

- name: Install libpcsclite
run: sudo apt update && sudo apt install libpcsclite-dev

- name: Log into crates.io
uses: actions-rs/cargo@v1
with:
command: login
args: ${{ secrets.CRATES_IO_TOKEN }}
run: cargo login ${{ secrets.CRATES_IO_TOKEN }}

- name: Publish to crates.io (Core)
uses: actions-rs/cargo@v1
with:
command: publish
args: --verbose --allow-dirty -p jpki
run: cargo publish --verbose --allow-dirty -p jpki

- name: Publish to crates.io (CLI)
run: |
Expand All @@ -271,7 +250,4 @@ jobs:
done
- name: Publish to crates.io (FFI/Generic)
uses: actions-rs/cargo@v1
with:
command: publish
args: --verbose --allow-dirty -p jpki-ffi-generic
run: cargo publish --verbose --allow-dirty -p jpki-ffi-generic
Loading

0 comments on commit 4124312

Please sign in to comment.