-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e929b0a
commit bb1ab95
Showing
2 changed files
with
35 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,47 @@ | ||
--- | ||
name: Foundry Setup | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
foundry-version: | ||
required: true | ||
type: string | ||
outputs: | ||
installation_dir: | ||
installation-dir: | ||
description: "The installation directory of Foundry toolchain" | ||
value: ${{ jobs.setup.outputs.installation_dir }} | ||
key: | ||
value: ${{ jobs.setup.outputs.installation-dir }} | ||
cache-key: | ||
description: "The cache key for Foundry toolchain" | ||
value: ${{ jobs.setup.outputs.key }} | ||
value: ${{ jobs.setup.outputs.cache-key }} | ||
|
||
jobs: | ||
pre-setup: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
foundry_version: ${{ steps.set-version.outputs.foundry_version }} | ||
steps: | ||
- name: Set Foundry version | ||
id: set-version | ||
run: | | ||
echo "foundry_version=nightly-f625d0fa7c51e65b4bf1e8f7931cd1c6e2e285e9" >> "$GITHUB_OUTPUT" | ||
setup: | ||
runs-on: ubuntu-latest | ||
needs: pre-setup | ||
outputs: | ||
key: ${{ steps.set-key.outputs.key }} | ||
installation_dir: ${{ steps.find-path.outputs.installation_dir }} | ||
cache-key: ${{ steps.set-cache-key.outputs.cache-key }} | ||
installation-dir: ${{ steps.find-path.outputs.installation-dir }} | ||
steps: | ||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: ${{ needs.pre-setup.outputs.foundry_version }} | ||
version: ${{ inputs.foundry-version }} | ||
- name: Print forge version | ||
run: forge --version | ||
# Unfortunately, the `foundry-toolchain` action installs it in a randomly generated location, so we must determine it ourselves | ||
# Unfortunately, the `foundry-toolchain` action installs it in a | ||
# randomly generated location, so we must determine it ourselves | ||
- name: Determine Foundry installation path | ||
id: find-path | ||
run: | | ||
installation_path=$(which forge) | ||
installation_dir=$(dirname $installation_path) | ||
echo "installation_dir=$installation_dir" >> "$GITHUB_OUTPUT" | ||
echo "installation-dir=$installation_dir" >> "$GITHUB_OUTPUT" | ||
- name: Cached Foundry toolchain | ||
uses: actions/cache/save@v3 | ||
with: | ||
path: ${{ steps.find-path.outputs.installation_dir }} | ||
key: ${{ runner.os }}-foundry-${{ needs.pre-setup.outputs.foundry_version }} | ||
- name: Set key | ||
id: set-key | ||
path: ${{ steps.find-path.outputs.installation-dir }} | ||
key: ${{ runner.os }}-foundry-${{ inputs.foundry-version }} | ||
- name: Set cache key | ||
id: set-cache-key | ||
run: | | ||
echo "key=${{ runner.os }}-foundry-${{ needs.pre-setup.outputs.foundry_version }}" >> "$GITHUB_OUTPUT" | ||
echo "cache-key=${{ runner.os }}-foundry-${{ inputs.foundry-version }}" >> "$GITHUB_OUTPUT" |