Skip to content

Commit 0960daa

Browse files
Merge pull request #518 from rainlanguage/2026-05-27-regen-artifacts
CopyArtifacts: write trailing newline to match prettier (fix copy-artifacts CI)
2 parents 05a07b5 + 5c29b7f commit 0960daa

2 files changed

Lines changed: 10 additions & 34 deletions

File tree

.github/workflows/copy-artifacts.yaml

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,9 @@ name: copy-artifacts
22
on: [push]
33
jobs:
44
copy-artifacts:
5-
runs-on: ubuntu-latest
6-
steps:
7-
- uses: actions/checkout@v6
8-
- uses: nixbuild/nix-quick-install-action@v30
9-
with:
10-
nix_conf: |
11-
keep-env-derivations = true
12-
keep-outputs = true
13-
- name: Restore and save Nix store
14-
uses: nix-community/cache-nix-action@v7
15-
with:
16-
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
17-
restore-prefixes-first-match: nix-${{ runner.os }}-
18-
gc-max-store-size-linux: 1G
19-
- name: Install soldeer dependencies
20-
if: hashFiles('soldeer.lock') != ''
21-
run: nix develop github:rainlanguage/rainix#sol-shell -c forge soldeer install
22-
- name: Regenerate meta files
23-
run: nix run .#rainlang-prelude
24-
- name: Regenerate pointer artifacts
25-
run: nix develop github:rainlanguage/rainix#sol-shell -c forge script ./script/BuildPointers.sol
26-
- name: Build Solidity
27-
run: nix develop github:rainlanguage/rainix#sol-shell -c forge build
28-
- name: Copy forge artifacts into committed location
29-
run: nix develop github:rainlanguage/rainix#sol-shell -c forge script ./script/CopyArtifacts.sol --ffi
30-
- name: Format (so generated artifacts match committed style)
31-
run: nix develop github:rainlanguage/rainix#sol-shell -c forge fmt
32-
- name: Assert committed artifacts match freshly built
33-
run: |
34-
if ! git diff --exit-code; then
35-
echo "::error::Committed meta/pointer/abi artifacts are stale. Run rainlang-prelude, BuildPointers.sol, CopyArtifacts.sol, forge fmt, and commit."
36-
exit 1
37-
fi
5+
# Shared reusable (rainix#201): build from committed sources and assert the
6+
# committed meta/pointer/abi artifacts are still current. Includes the
7+
# Cachix substitution + 8G GC cap; no prelude (committing the artifacts is
8+
# what removes the need for one). secrets: inherit carries CACHIX_AUTH_TOKEN.
9+
uses: rainlanguage/rainix/.github/workflows/rainix-copy-artifacts.yaml@main
10+
secrets: inherit

script/CopyArtifacts.sol

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ contract CopyArtifacts is Script {
2020
//forge-lint: disable-next-line(unsafe-cheatcode)
2121
vm.removeFile(dst);
2222
}
23+
// Trailing newline so the written file matches the prettier-formatted
24+
// committed artifact (prettier adds a final newline to JSON; without it
25+
// the copy-artifacts determinism check and the prettier hook fight).
2326
//forge-lint: disable-next-line(unsafe-cheatcode)
24-
vm.writeFile(dst, string(artifact));
27+
vm.writeFile(dst, string.concat(string(artifact), "\n"));
2528
}
2629
}

0 commit comments

Comments
 (0)