-
Notifications
You must be signed in to change notification settings - Fork 6
93 lines (79 loc) · 2.57 KB
/
forge-build.yml
File metadata and controls
93 lines (79 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: "Build a Forge project and cache the artifacts and the dependencies"
on:
workflow_call:
inputs:
cache-path:
default: |
cache
node_modules
out
out-optimized
required: false
type: "string"
foundry-profiles:
default: |
optimized
test-optimized
description: "Foundry profiles for which to build the contracts, end line-separated"
required: false
type: "string"
foundry-version:
default: "v1.3.6"
description: "Foundry version to use"
required: false
type: "string"
name:
default: "Forge build"
required: false
type: "string"
working-directory:
default: "."
required: false
type: "string"
outputs:
# See https://github.com/actions/cache/issues/1566
cache-status:
description: "Descriptive cache status: 'primary', 'fallback', or 'not-found'"
value: ${{ jobs.forge-build.outputs.cache-status }}
jobs:
forge-build:
name: ${{ inputs.name }}
defaults:
run:
working-directory: ${{ inputs.working-directory }}
runs-on: "ubuntu-latest"
outputs:
cache-status: ${{ steps.cache-step.outputs.cache-status }}
steps:
- name: "Check out the repo"
uses: "actions/checkout@v4"
- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"
with:
version: ${{ inputs.foundry-version }}
# If a cache is found for the primary key, the cache is restored. Otherwise, a new cache is created.
- name: "Cache Foundry artifacts and Node.js dependencies"
id: "cache-step"
uses: "sablier-labs/gha-utils/.github/actions/evm-cache@main"
with:
cache-path: ${{ inputs.cache-path }}
- name: "Install Bun"
uses: "oven-sh/setup-bun@v2"
with:
bun-version: "latest"
- name: "Install the Node.js dependencies"
run: "bun install --frozen-lockfile"
- name: "Show the Forge config"
run: "forge config"
- name: "Build contracts with the specified profiles"
run: | # shell
echo "${{ inputs.foundry-profiles }}" | while read profile; do
if [ -n "$profile" ]; then
echo "Building with profile: $profile"
FOUNDRY_PROFILE=$profile forge build
fi
done
- name: "Add summary"
run: | # shell
echo "## Forge Build result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY