Skip to content

Commit

Permalink
ci: saikyou
Browse files Browse the repository at this point in the history
  • Loading branch information
Mogyuchi committed Feb 16, 2024
1 parent 88f4f23 commit ce39f46
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
24 changes: 24 additions & 0 deletions .github/actions/rust-info/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-action.json

name: rust info
description: get rust info

outputs:
package-names:
description: package name "foo"
value: ${{steps.cargo.outputs.package-names}}
host:
description: host "x86_64-unknown-linux-gnu"
value: ${{steps.rustc.outputs.host}}

runs:
using: composite
steps:
- id: cargo
run: |
echo "package-names=$(cargo metadata --no-deps | jq --compact-output '.packages | map(.name)')" >> $GITHUB_OUTPUT
shell: bash
- id: rustc
run: |
echo "host=$(rustc -vV | awk '/host/ { print $2 }')" >> $GITHUB_OUTPUT
shell: bash
5 changes: 5 additions & 0 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ jobs:
with:
toolchain: stable
components: clippy
- id: rustc
uses: ./.github/actions/rust-info
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
shared-key: ${{ fromJson(steps.rustc.outputs.package-names)[0] }}
key: ${{ steps.rustc.outputs.host }}
- name: Run Clippy
run: cargo clippy --all-targets --all-features
5 changes: 4 additions & 1 deletion .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,11 @@ jobs:
with:
toolchain: stable
target: ${{ matrix.target }}
- id: rustc
uses: ./.github/actions/rust-info
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
shared-key: ${{ fromJson(steps.rustc.outputs.package-names)[0] }}
key: ${{ matrix.target }}
- name: Install cross
if: ${{ !matrix.os && matrix.use-cross }}
Expand Down Expand Up @@ -96,7 +99,7 @@ jobs:
needs: build
permissions:
packages: write
runs-on: 'ubuntu-latest'
runs-on: "ubuntu-latest"
outputs:
image_tags: ${{ steps.meta.outputs.tags }}
env:
Expand Down

0 comments on commit ce39f46

Please sign in to comment.