Skip to content

Commit

Permalink
Replace deprecated workflow functions (#1108)
Browse files Browse the repository at this point in the history
  • Loading branch information
eike-hass authored Feb 13, 2023
1 parent 9b9976a commit 3068959
Show file tree
Hide file tree
Showing 19 changed files with 110 additions and 164 deletions.
17 changes: 7 additions & 10 deletions .github/actions/publish/publish-rust/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,18 @@ inputs:
runs:
using: "composite"
steps:
- name: Install Rust stable toolchain
uses: actions-rs/toolchain@v1
- name: Setup Rust
uses: './.github/actions/rust/rust-setup'
with:
toolchain: stable
profile: minimal
override: true
os: ${{ runner.os }}
job: ${{ github.job }}

- name: Install cargo-release
uses: actions-rs/cargo@v1
with:
command: install
args: --version ^0.21 cargo-release
shell: bash
run: cargo install --version ^0.21 cargo-release

- name: Publish library to crates.io
shell: sh
shell: bash
run: |
echo "dry-run: '${{ inputs.dry-run }}'"
echo "version: '${{ inputs.version }}'"
Expand Down
21 changes: 8 additions & 13 deletions .github/actions/release/bump-versions/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,19 @@ inputs:
runs:
using: "composite"
steps:
- name: Install Rust stable toolchain
uses: actions-rs/toolchain@v1
- name: Setup Rust
uses: './.github/actions/rust/rust-setup'
with:
toolchain: stable
profile: minimal
override: true
os: ${{ runner.os }}
job: ${{ github.job }}

- name: Install cargo-workspaces
uses: actions-rs/cargo@v1
with:
command: install
args: --version ^0.2 cargo-workspaces
shell: bash
run: cargo install --version ^0.2 cargo-workspaces

- name: Install cargo-edit # to use cargo add and set-version
uses: actions-rs/cargo@v1
with:
command: install
args: -f --no-default-features --features "add set-version" --version ^0.8 cargo-edit
shell: bash
run: cargo install -f --no-default-features --features "set-version" --version ^0.8 cargo-edit

- name: Bump Rust crate versions
shell: bash
Expand Down
43 changes: 24 additions & 19 deletions .github/actions/rust/rust-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,23 @@ inputs:
target:
description: 'Additionally install specified target for this toolchain, ex. x86_64-apple-darwin'
required: false
profile:
description: 'Execute rustup set profile {value} before installing the toolchain, ex. minimal'
toolchain:
description: 'Toolchain to install. Default: stable.'
required: false
default: stable
components:
description: 'Comma-separated string of additional components to install e.g. `clippy`, `rustfmt`'
required: false
default: 'minimal'
os:
description: 'OS of the runner, used for cache key construction.'
required: true
job:
description: 'Name of the job, used for cache key construction.'
required: true
cargo-cache-enabled:
description: 'Cache cargo folder. Default: false.'
required: false
default: ''
target-cache-enabled:
description: 'Cache build artifacts from the target path. Default: false.'
required: false
Expand All @@ -33,26 +40,25 @@ runs:
using: "composite"
steps:

- name: Get current date linux / macos
if: inputs.os == 'macos-latest' || inputs.os == 'ubuntu-latest'
shell: sh
- name: Get current date
shell: bash
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV

- name: Get current date windows
if: inputs.os == 'windows-latest'
shell: pwsh
run: echo "CURRENT_DATE=$(Get-Date -Format "yyyy-MM-dd")" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@9cd00a88a73addc8617065438eff914dd08d0955
id: toolchain
with:
toolchain: stable
override: true
profile: ${{ inputs.profile }}
target: ${{ inputs.target }}
toolchain: ${{ inputs.toolchain }}
targets: ${{ inputs.target }}
components: ${{ inputs.components }}

- name: Override toolchain
shell: bash
run: rustup override set ${{ steps.toolchain.outputs.name }}

- name: Cache cargo
uses: actions/[email protected]
if: inputs.cargo-cache-enabled == 'true'
with:
# https://doc.rust-lang.org/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci
path: |
Expand All @@ -72,9 +78,8 @@ runs:
# Allows dependencies updated on crates.io between runs to trigger storing an updated cache,
# which hashing Cargo.toml files alone does not.
- name: Cargo update
uses: actions-rs/cargo@v1
with:
command: update
run: cargo update
shell: bash

- name: Cache build target
uses: actions/[email protected]
Expand Down
14 changes: 3 additions & 11 deletions .github/actions/rust/sccache/setup-sccache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ runs:

- name: Install sccache (macos-latest)
if: inputs.os == 'macos-latest'
shell: sh
shell: bash
run: |
brew update --preinstall
brew install sccache
- name: Install sccache (ubuntu-latest)
if: inputs.os == 'ubuntu-latest'
shell: sh
shell: bash
run: |
SCCACHE_DOWNLOAD_LINK=https://github.com/mozilla/sccache/releases/download
SCCACHE_VERSION=v0.2.15
Expand All @@ -40,15 +40,7 @@ runs:
choco install sccache
- name: Start sccache
if: inputs.os == 'macos-latest' || inputs.os == 'ubuntu-latest'
shell: sh
run: |
sccache --start-server
sccache -s
- name: Start sccache
if: inputs.os == 'windows-latest'
shell: 'pwsh'
shell: bash
run: |
sccache --start-server
sccache -s
9 changes: 1 addition & 8 deletions .github/actions/rust/sccache/stop-sccache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@ runs:
steps:

- name: Stop sccache
if: inputs.os == 'macos-latest' || inputs.os == 'ubuntu-latest'
shell: sh
run: |
sccache --stop-server || true
- name: Stop sccache
if: inputs.os == 'windows-latest'
shell: 'pwsh'
shell: bash
run: |
sccache --stop-server || true
2 changes: 1 addition & 1 deletion .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
44 changes: 16 additions & 28 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
outputs:
core-modified: ${{ steps.change-detection.outputs.core-modified }} # map step output to job output
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Run change detection
Expand All @@ -57,7 +57,7 @@ jobs:
CORE_MODIFIED=false
fi
echo CORE_MODIFIED=$CORE_MODIFIED
echo "::set-output name=core-modified::$CORE_MODIFIED"
echo "{core-modified}={$CORE_MODIFIED}" >> $GITHUB_OUTPUT
build-and-test:
runs-on: ${{ matrix.os }}
Expand All @@ -79,13 +79,14 @@ jobs:
RUSTC_WRAPPER: sccache

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup Rust and cache
uses: './.github/actions/rust/rust-setup'
with:
os: ${{ runner.os }}
job: ${{ github.job }}
cargo-cache-enabled: true
target-cache-enabled: true
sccache-enabled: true
sccache-path: ${{ matrix.sccache-path }}
Expand Down Expand Up @@ -117,22 +118,16 @@ jobs:
if: matrix.os == 'ubuntu-latest'
run: cargo clean

- name: Build all features
uses: actions-rs/cargo@v1
with:
# Build the library, tests, and examples without running them to avoid recompilation in the run tests step
command: build
args: --workspace --tests --examples --all-features --release
# Build the library, tests, and examples without running them to avoid recompilation in the run tests step
- name: Build with all features
run: cargo build --workspace --tests --examples --all-features --release

- name: Start private tangle
if: matrix.os == 'ubuntu-latest'
uses: './.github/actions/private-tangle/setup'

- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --workspace --all-features --release
run: cargo test --workspace --all-features --release

- name: Run Rust examples
# run examples only on ubuntu for now
Expand Down Expand Up @@ -165,26 +160,19 @@ jobs:
- os: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
- name: Setup Rust
uses: './.github/actions/rust/rust-setup'
with:
toolchain: stable
profile: minimal
override: true
os: ${{ runner.os }}
job: ${{ github.job }}

- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path ./libjose/Cargo.toml --release
run: cargo build --manifest-path ./libjose/Cargo.toml --release

- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path ./libjose/Cargo.toml --release
run: cargo test --manifest-path ./libjose/Cargo.toml --release

build-wasm:
needs: check-for-run-condition
Expand All @@ -206,7 +194,7 @@ jobs:
- os: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v1
Expand Down
32 changes: 12 additions & 20 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,45 +20,37 @@ jobs:
fail-fast: false

steps:
- uses: actions/checkout@v2
- name: Install clippy with stable toolchain
uses: actions-rs/toolchain@v1
- uses: actions/checkout@v3

- name: Setup Rust
uses: './.github/actions/rust/rust-setup'
with:
profile: minimal
toolchain: stable
os: ${{ runner.os }}
job: ${{ github.job }}
target: wasm32-unknown-unknown
override: true
components: clippy

# Download a pre-compiled wasm-bindgen binary.
- name: Install wasm-bindgen-cli
uses: jetli/wasm-bindgen-action@24ba6f9fff570246106ac3f80f35185600c3f6c9

- name: core clippy check
uses: actions-rs/clippy-check@v1
uses: actions-rs-plus/clippy-check@b09a9c37c9df7db8b1a5d52e8fe8e0b6e3d574c4
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets --all-features -- -D warnings
name: core

- name: Wasm clippy check
uses: actions-rs/clippy-check@v1
uses: actions-rs-plus/clippy-check@b09a9c37c9df7db8b1a5d52e8fe8e0b6e3d574c4
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --manifest-path ./bindings/wasm/Cargo.toml --target wasm32-unknown-unknown --all-targets --all-features -- -D warnings
name: wasm

# Deactivated while the crate is broken, which is the case due to the removal of identity_account_storage.
# - name: stronghold-nodejs clippy check
# uses: actions-rs/clippy-check@v1
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# uses: actions-rs-plus/clippy-check@b09a9c37c9df7db8b1a5d52e8fe8e0b6e3d574c4
# with:
# args: --manifest-path ./bindings/stronghold-nodejs/Cargo.toml --all-targets --all-features -- -D warnings
# name: stronghold-nodejs

- name: libjose clippy check
uses: actions-rs/clippy-check@v1
uses: actions-rs-plus/clippy-check@b09a9c37c9df7db8b1a5d52e8fe8e0b6e3d574c4
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --manifest-path ./libjose/Cargo.toml --all-targets --all-features -- -D warnings
name: libjose
Loading

0 comments on commit 3068959

Please sign in to comment.