Skip to content

Commit

Permalink
🔨 Add profile to cargo-build composite action
Browse files Browse the repository at this point in the history
The `cargo-build` composite action is currently always building the
default profile, rather than specifying a profile. It will eventually
be necessary to state `"dev"` vs `"release"`, so this attempts to
address this now by creating a workflow parameter that can be specified.

By default, this will still build `dev`.
  • Loading branch information
bitwizeshift committed Dec 16, 2023
1 parent b26f537 commit b1fc91b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions .github/actions/cargo-build/action.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
name: cargo-build
description: "Performs a cargo build, with caching"
inputs:
profile:
default: dev
description: "The build profile to use"
required: false

runs:
using: "composite"
Expand All @@ -15,11 +20,14 @@ runs:
uses: actions/cache@v3
with:
path: target
key: cargo-build-${{ runner.os }}-${{ hashFiles('frameworks/**/*.rs', 'alloy/**/*.rs', 'example/**/*.rs', '**/Cargo.toml', 'Cargo.toml') }}
key: cargo-build-${{ inputs.profile }}-${{ runner.os }}-${{ hashFiles('frameworks/**/*.rs', 'alloy/**/*.rs', 'example/**/*.rs', '**/Cargo.toml', 'Cargo.toml') }}

- name: Build
if: steps.cargo-build.outputs.cache-hit != 'true'
shell: bash
run: |
cargo build --verbose --message-format json \
cargo build \
--verbose \
--profile ${{ inputs.profile }} \
--message-format json \
| cargo-github-annotation

0 comments on commit b1fc91b

Please sign in to comment.