Sitelet https://github.com/mowind/compilers/commit/54f38aa0d5c53352282d7f30552605d2a0e055cf
Skip to content

Commit 54f38aa

Browse files
authored
feat(ci): add & enable ci/cd (foundry-rs#1)
* feat: add ci/cd * chore: adding execute permissions * chore: missing deps * permissions * add msrv * fix: push missing node_modules folder * chore: do not run anvil * chore: ignore it tests
1 parent a40ec54 commit 54f38aa

20 files changed

Lines changed: 7920 additions & 8 deletions

File tree

‎.clippy.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
msrv = "1.65"
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#!/usr/bin/env bash
2+
# Installs Solc and Geth binaries
3+
# Note: intended for use only with CI (x86_64 Ubuntu, MacOS or Windows)
4+
set -e
5+
6+
GETH_BUILD=${GETH_BUILD:-"1.11.2-73b01f40"}
7+
8+
BIN_DIR=${BIN_DIR:-"$HOME/bin"}
9+
10+
PLATFORM="$(uname -s | awk '{print tolower($0)}')"
11+
if [ "$PLATFORM" != "linux" ] && [ "$PLATFORM" != "darwin" ]; then
12+
EXT=".exe"
13+
fi
14+
15+
main() {
16+
mkdir -p "$BIN_DIR"
17+
cd "$BIN_DIR"
18+
export PATH="$BIN_DIR:$PATH"
19+
if [ "$GITHUB_PATH" ]; then
20+
echo "$BIN_DIR" >> "$GITHUB_PATH"
21+
fi
22+
23+
install_geth &
24+
g=$!
25+
install_solc &
26+
wait $g $!
27+
28+
echo ""
29+
echo "Installed Geth:"
30+
geth version
31+
echo ""
32+
echo "Installed Solc:"
33+
solc --version
34+
}
35+
36+
# Installs geth from https://geth.ethereum.org/downloads
37+
install_geth() {
38+
case "$PLATFORM" in
39+
linux|darwin)
40+
name="geth-$PLATFORM-amd64-$GETH_BUILD"
41+
curl -s "https://gethstore.blob.core.windows.net/builds/$name.tar.gz" | tar -xzf -
42+
mv -f "$name/geth" ./
43+
rm -rf "$name"
44+
chmod +x geth
45+
;;
46+
*)
47+
name="geth-windows-amd64-$GETH_BUILD"
48+
zip="$name.zip"
49+
curl -so "$zip" "https://gethstore.blob.core.windows.net/builds/$zip"
50+
unzip "$zip"
51+
mv -f "$name/geth.exe" ./
52+
rm -rf "$name" "$zip"
53+
;;
54+
esac
55+
}
56+
57+
# Installs solc from https://binaries.soliditylang.org (https://github.com/ethereum/solc-bin)
58+
install_solc() {
59+
bins_url="https://binaries.soliditylang.org"
60+
case "$PLATFORM" in
61+
linux) bins_url+="/linux-amd64";;
62+
darwin) bins_url+="/macosx-amd64";;
63+
*) bins_url+="/windows-amd64";;
64+
esac
65+
66+
list=$(curl -s "$bins_url/list.json")
67+
# use latest version
68+
if [ -z "$SOLC_VERSION" ]; then
69+
SOLC_VERSION="$(echo "$list" | jq -r ".latestRelease")"
70+
fi
71+
bin=$(echo "$list" | jq -r ".releases[\"$SOLC_VERSION\"]")
72+
73+
if [ "$bin" = "null" ]; then
74+
echo "Invalid Solc version: $SOLC_VERSION" 1>&2
75+
exit 1
76+
fi
77+
78+
# windows versions <= 0.7.1 use .zip
79+
if [[ "$bin" = *.zip ]]; then
80+
echo "Cannot install solc <= 0.7.1" 1>&2
81+
exit 1
82+
fi
83+
84+
curl -so "$bin" "$bins_url/$bin"
85+
mv -f "$bin" "solc$EXT"
86+
chmod +x "solc$EXT"
87+
}
88+
89+
main

‎.github/workflows/ci.yml‎

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
name: test ${{ matrix.flags.name }} (${{ matrix.os }})
11+
runs-on: ${{ matrix.os }}
12+
timeout-minutes: 30
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
17+
flags:
18+
- name: no default features
19+
flags: --no-default-features
20+
- name: default features
21+
flags: ""
22+
- name: all features
23+
flags: --all-features
24+
steps:
25+
- uses: actions/checkout@v3
26+
- uses: dtolnay/rust-toolchain@stable
27+
- name: Install test binaries
28+
shell: bash
29+
run: ./.github/scripts/install_test_binaries.sh
30+
- name: Install nextest
31+
uses: taiki-e/install-action@nextest
32+
- uses: Swatinem/rust-cache@v2
33+
- name: test ${{ matrix.flags.flags }}
34+
shell: bash
35+
run: |
36+
cargo nextest run \
37+
${{ matrix.flags.flags }} \
38+
-E "!(kind(test))" \
39+
--retries 2
40+
41+
feature-checks:
42+
name: feature checks
43+
runs-on: ubuntu-latest
44+
timeout-minutes: 45
45+
steps:
46+
- uses: actions/checkout@v3
47+
- uses: dtolnay/rust-toolchain@stable
48+
- uses: taiki-e/install-action@cargo-hack
49+
- uses: Swatinem/rust-cache@v2
50+
- name: cargo hack
51+
run: cargo hack check --feature-powerset --depth 1 --all-targets
52+
53+
clippy:
54+
name: clippy
55+
runs-on: ubuntu-latest
56+
timeout-minutes: 30
57+
steps:
58+
- uses: actions/checkout@v3
59+
- uses: dtolnay/rust-toolchain@clippy
60+
- uses: Swatinem/rust-cache@v2
61+
- name: clippy
62+
run: cargo clippy --workspace --all-features --all-targets
63+
env:
64+
RUSTFLAGS: "-D warnings"
65+
66+
docs:
67+
name: docs
68+
runs-on: ubuntu-latest
69+
timeout-minutes: 30
70+
steps:
71+
- uses: actions/checkout@v3
72+
- uses: dtolnay/rust-toolchain@nightly
73+
with:
74+
components: rust-docs
75+
- uses: Swatinem/rust-cache@v2
76+
- name: doc
77+
run: cargo doc --workspace --all-features --no-deps --document-private-items
78+
env:
79+
RUSTDOCFLAGS: "--cfg docsrs -D warnings"
80+
81+
fmt:
82+
name: fmt
83+
runs-on: ubuntu-latest
84+
timeout-minutes: 30
85+
steps:
86+
- uses: actions/checkout@v3
87+
- uses: dtolnay/rust-toolchain@nightly
88+
with:
89+
components: rustfmt
90+
- name: fmt --check
91+
run: cargo fmt --all --check

‎.gitignore‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
/Cargo.lock
33

44
cache/
5-
artifacts/
65

76
.vscode
87
/.envrc

‎Cargo.toml‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@ serde_json = "1.0"
2525

2626
# tracing
2727
tracing = "0.1.37"
28+
tracing-subscriber = { version = "0.3.17", default-features = false }
29+
tracing-futures = "0.2.5"
2830

2931
tiny-keccak = { version = "2.0.2", default-features = false }
3032
sha2 = { version = "0.10.7", default-features = false, optional = true }
3133
md-5 = "0.10.5"
3234

33-
semver = { version = "1", features = ["serde"] }
35+
semver = { version = "1.0", features = ["serde"] }
3436
walkdir = "2.3"
3537
once_cell = "1.18"
3638
regex = "1.9"
@@ -59,6 +61,18 @@ svm = { package = "svm-rs", version = "0.3", default-features = false, features
5961
], optional = true }
6062
svm-builds = { package = "svm-rs-builds", version = "0.2", optional = true }
6163
tokio = { version = "1.32", features = ["rt-multi-thread"] }
64+
tokio-tungstenite = { version = "0.20", default-features = false }
65+
futures = { version = "0.3.28", default-features = false, features = ["std"] }
66+
futures-core = "0.3.28"
67+
futures-util = "0.3.28"
68+
futures-executor = "0.3.28"
69+
futures-channel = "0.3.28"
70+
futures-locks = { version = "0.7.1", default-features = false }
71+
futures-timer = { version = "3.0.2", default-features = false, features = ["wasm-bindgen"] }
72+
pin-project = "1.1"
73+
reqwest = { version = "0.11.19", default-features = false }
74+
url = { version = "2.4", default-features = false }
75+
6276

6377
[dev-dependencies]
6478
criterion = { version = "0.5", features = ["async_tokio"] }

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Utilities for working with native `solc` and compiling projects.
44

55
To also compile contracts during `cargo build` (so that ethers `abigen!` can pull in updated abi automatically) you can configure a `foundry_compilers::Project` in your `build.rs` file
66

7-
First add `ethers-solc` to your cargo build-dependencies.
7+
First add `foundry-compilers` to your cargo build-dependencies.
88

99
Once you compiled the project, you can configure cargo change detection with `rerun_if_sources_changed`, so that cargo will execute the `build.rs` file if a contract in the sources directory has changed
1010

0 commit comments

Comments
 (0)