From fd5ce91c32edea5cbbe056645cb591abbf99d57d Mon Sep 17 00:00:00 2001 From: asonix Date: Thu, 8 Feb 2024 15:32:55 -0600 Subject: [PATCH] Remove rust action, use rust cache action --- .forgejo/actions/prepare-rust/action.yaml | 68 ----------------------- .forgejo/workflows/check.yaml | 9 +++ .forgejo/workflows/publish.yaml | 12 ++++ 3 files changed, 21 insertions(+), 68 deletions(-) delete mode 100644 .forgejo/actions/prepare-rust/action.yaml diff --git a/.forgejo/actions/prepare-rust/action.yaml b/.forgejo/actions/prepare-rust/action.yaml deleted file mode 100644 index 210afd7..0000000 --- a/.forgejo/actions/prepare-rust/action.yaml +++ /dev/null @@ -1,68 +0,0 @@ -name: Prepare Rust -description: Prepare an environment to build or test rust packages - -inputs: - targets: - description: "JSON Array of targets to add to rustup" - required: false - default: '[]' - rust-version: - description: "Version of rust to install" - required: true - default: '1.75.0' - -runs: - using: "composite" - steps: - - - name: Install zig - uses: https://github.com/goto-bus-stop/setup-zig@v2 - with: - version: 0.11.0 - - - name: Fetch rust cache - id: cache - uses: https://github.com/actions/cache/restore@v4 - with: - path: | - ~/.cargo/bin - ~/.cargo/registry/index - ~/.cargo/registry/cache - ~/.cargo/git/db - ~/.rustup - target/ - key: rust-${{ inputs.rust-version }}-${{ join(fromJSON(inputs.targets), '-') }}-${{ hashFiles('Cargo.toml') }}-${{ hashFiles('Cargo.lock')}} - - - name: Install rustup and rust - if: steps.cache.outputs.cache-hit != 'true' - uses: https://github.com/dtolnay/rust-toolchain@${{ inputs.rust-version }} - with: - components: clippy - targets: ${{ join(fromJSON(inputs.targets), ',') }} - - - name: Install cargo-zigbuild - if: steps.cache.outputs.cache-hit != 'true' - run: cargo install cargo-zigbuild - - - name: Fetch dependencies - if: steps.cache.outputs.cache-hit != 'true' - run: cargo fetch - - - name: Export path - if: steps.cache.outputs.cache-hit == 'true' - run: | - echo "${HOME}/.cargo/bin" >> "${GITHUB_PATH}" - echo "${HOME}/.rustup/bin" >> "${GITHUB_PATH}" - - - name: Populate rust cache - if: steps.cache.outputs.cache-hit != 'true' - uses: https://github.com/actions/cache/save@v4 - with: - path: | - ~/.cargo/bin - ~/.cargo/registry/index - ~/.cargo/registry/cache - ~/.cargo/git/db - ~/.rustup - target/ - key: ${{ steps.cache.outputs.cache-primary-key }} diff --git a/.forgejo/workflows/check.yaml b/.forgejo/workflows/check.yaml index f1dc5cb..f2f8cf0 100644 --- a/.forgejo/workflows/check.yaml +++ b/.forgejo/workflows/check.yaml @@ -13,6 +13,9 @@ jobs: - name: Checkout pict-rs uses: https://github.com/actions/checkout@v4 + - + name: Cargo Cache + uses: https://git.asonix.dog/asonix/actions/cache-rust-dependencies@main - name: Clippy run: | @@ -27,6 +30,9 @@ jobs: - name: Checkout pict-rs uses: https://github.com/actions/checkout@v4 + - + name: Cargo Cache + uses: https://git.asonix.dog/asonix/actions/cache-rust-dependencies@main - name: Test run: cargo test @@ -46,6 +52,9 @@ jobs: - name: Checkout pict-rs uses: https://github.com/actions/checkout@v4 + - + name: Cargo Cache + uses: https://git.asonix.dog/asonix/actions/cache-rust-dependencies@main - name: Debug builds run: cargo zigbuild --target ${{ matrix.target }} diff --git a/.forgejo/workflows/publish.yaml b/.forgejo/workflows/publish.yaml index 951154f..3e0db65 100644 --- a/.forgejo/workflows/publish.yaml +++ b/.forgejo/workflows/publish.yaml @@ -15,6 +15,9 @@ jobs: - name: Checkout pict-rs uses: https://github.com/actions/checkout@v4 + - + name: Cargo Cache + uses: https://git.asonix.dog/asonix/actions/cache-rust-dependencies@main - name: Clippy run: | @@ -29,6 +32,9 @@ jobs: - name: Checkout pict-rs uses: https://github.com/actions/checkout@v4 + - + name: Cargo Cache + uses: https://git.asonix.dog/asonix/actions/cache-rust-dependencies@main - name: Test run: cargo test @@ -57,6 +63,9 @@ jobs: - name: Checkout pict-rs uses: https://github.com/actions/checkout@v4 + - + name: Cargo Cache + uses: https://git.asonix.dog/asonix/actions/cache-rust-dependencies@main - name: Prepare Platform run: | @@ -212,6 +221,9 @@ jobs: - name: Checkout pict-rs uses: https://github.com/actions/checkout@v4 + - + name: Cargo Cache + uses: https://git.asonix.dog/asonix/actions/cache-rust-dependencies@main - name: Publish Crate run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }}