Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(workflow): upgrade actions and compiler checks #533

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 27 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
name: CI


on:
workflow_dispatch:
workflow_dispatch: {}
pull_request:
push:
branches:
- master

defaults:
run:
shell: bash

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

Expand All @@ -28,86 +33,89 @@ jobs:
if: always()
run: |
output=$(forge build --skip test)

if echo "$output" | grep -q "Warning"; then
echo "$output"
echo "$output" >> "$GITHUB_OUTPUT"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this?

exit 1
fi

- name: Check compatibility with 0.8.0
id: v0_8_0
if: always()
run: |
output=$(forge build --skip test --use solc:0.8.0)

if echo "$output" | grep -q "Warning"; then
echo "$output"
echo "$output" >> "$GITHUB_OUTPUT"
exit 1
fi

- name: Check compatibility with 0.7.6
id: v0_7_6
if: always()
run: |
output=$(forge build --skip test --use solc:0.7.6)

if echo "$output" | grep -q "Warning"; then
echo "$output"
echo "$output" >> "$GITHUB_OUTPUT"
exit 1
fi

- name: Check compatibility with 0.7.0
id: v0_7_0
if: always()
run: |
output=$(forge build --skip test --use solc:0.7.0)

if echo "$output" | grep -q "Warning"; then
echo "$output"
echo "$output" >> "$GITHUB_OUTPUT"
exit 1
fi

- name: Check compatibility with 0.6.12
id: v0_6_12
if: always()
run: |
output=$(forge build --skip test --use solc:0.6.12)

if echo "$output" | grep -q "Warning"; then
echo "$output"
echo "$output" >> "$GITHUB_OUTPUT"
exit 1
fi

- name: Check compatibility with 0.6.2
id: v0_6_2
if: always()
run: |
output=$(forge build --skip test --use solc:0.6.2)

if echo "$output" | grep -q "Warning"; then
echo "$output"
echo "$output" >> "$GITHUB_OUTPUT"
exit 1
fi

# via-ir compilation time checks.
- name: Measure compilation time of Test with 0.8.17 --via-ir
if: always()
id: ir_0_8_17
run: forge build --skip test --contracts test/compilation/CompilationTest.sol --use solc:0.8.17 --via-ir

- name: Measure compilation time of TestBase with 0.8.17 --via-ir
if: always()
id: ir_0_8_17_base
run: forge build --skip test --contracts test/compilation/CompilationTestBase.sol --use solc:0.8.17 --via-ir

- name: Measure compilation time of Script with 0.8.17 --via-ir
if: always()
id: ir_0_8_17_script
run: forge build --skip test --contracts test/compilation/CompilationScript.sol --use solc:0.8.17 --via-ir

- name: Measure compilation time of ScriptBase with 0.8.17 --via-ir
if: always()
id: ir_0_8_17_script_base
run: forge build --skip test --contracts test/compilation/CompilationScriptBase.sol --use solc:0.8.17 --via-ir

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

Expand All @@ -120,10 +128,10 @@ jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ on:
jobs:
sync-release-branch:
runs-on: ubuntu-latest
if: startsWith(github.event.release.tag_name, 'v1')
if: ${{ github.repository_owner == 'foundry-rs' && startsWith(github.event.release.tag_name, 'v1') }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably this change is to prevent the job running on forks?

steps:
- name: Check out the repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: v1

# the email is derived from the bots user id
# found here: https://api.github.com/users/github-actions%5Bbot%5D
- name: Configure Git
run: |
git config user.name github-actions[bot]
Expand Down