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

fix: reference-types error on nightly version #375

Open
wants to merge 8 commits into
base: v0.1.0
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[target.wasm32-unknown-unknown]
rustflags = ["-C", "link-arg=-zstack-size=8192"]
rustflags = ["-C", "link-arg=-zstack-size=8192", "-C", "target-cpu=mvp"]

[target.aarch64-apple-darwin]
rustflags = ["-C", "link-arg=-undefined", "-C", "link-arg=dynamic_lookup"]
Expand Down
21 changes: 8 additions & 13 deletions .github/workflows/check-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,22 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: set up rust
uses: dtolnay/rust-toolchain@master
id: toolchain
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: wasm32-unknown-unknown
components: rust-src
toolchain: nightly-2024-01-01
rustflags: ""

- uses: Swatinem/rust-cache@v2

- name: check motsu-proc
- name: Check motsu-proc
run: cargo publish -p motsu-proc --dry-run

- name: check motsu
- name: Check motsu
run: cargo publish -p motsu --dry-run

- name: check openzeppelin-crypto
- name: Check openzeppelin-crypto
run: cargo publish -p openzeppelin-crypto --target wasm32-unknown-unknown --dry-run

- name: check openzeppelin-stylus-proc
- name: Check openzeppelin-stylus-proc
run: cargo publish -p openzeppelin-stylus-proc --target wasm32-unknown-unknown --dry-run

- name: check openzeppelin-stylus
- name: Check openzeppelin-stylus
run: cargo publish -p openzeppelin-stylus --target wasm32-unknown-unknown --dry-run
21 changes: 7 additions & 14 deletions .github/workflows/check-wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,13 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: set up rust
uses: dtolnay/rust-toolchain@master
id: toolchain
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: wasm32-unknown-unknown
components: rust-src
toolchain: nightly-2024-01-01
rustflags: ""
Copy link
Member Author

@qalisander qalisander Oct 21, 2024

Choose a reason for hiding this comment

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

Alas we should write rustflags: "" everywhere. Otherwise our optimization rust flags will be replaced by -D warnings. Strange behavior of this gh action tbh


- uses: Swatinem/rust-cache@v2
- name: Install cargo-stylus
run: cargo install [email protected]

- name: install cargo-stylus
run: cargo install [email protected]

- name: run wasm check
run: |
export NIGHTLY_TOOLCHAIN=${{steps.toolchain.outputs.name}}
./scripts/check-wasm.sh
- name: Run wasm check
run: ./scripts/check-wasm.sh
43 changes: 30 additions & 13 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,17 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install stable

- name: Install rust
# We run in nightly to make use of some features only available there.
# Check out `rustfmt.toml` to see which ones.
uses: dtolnay/rust-toolchain@nightly
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly
components: rustfmt
- name: cargo fmt --all --check
rustflags: ""

- name: Check formatting
run: cargo fmt --all --check
clippy:
runs-on: ubuntu-latest
Expand All @@ -55,12 +59,15 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install ${{ matrix.toolchain }}
uses: dtolnay/rust-toolchain@master

- name: Install rust ${{ matrix.toolchain }}
bidzyyys marked this conversation as resolved.
Show resolved Hide resolved
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
components: clippy
- name: cargo clippy
rustflags: ""

- name: Cargo clippy
uses: giraffate/clippy-action@v1
with:
reporter: 'github-pr-check'
Expand All @@ -76,9 +83,14 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install nightly
uses: dtolnay/rust-toolchain@nightly
- name: cargo doc

- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly
rustflags: ""

- name: Cargo doc
run: cargo doc --no-deps --all-features
env:
RUSTDOCFLAGS: --cfg docsrs
Expand All @@ -91,23 +103,28 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install stable
uses: dtolnay/rust-toolchain@stable

- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
- name: cargo install cargo-hack
rustflags: ""

- name: Cargo install cargo-hack
uses: taiki-e/install-action@cargo-hack
# Intentionally no target specifier; see https://github.com/jonhoo/rust-ci-conf/pull/4
# `--feature-powerset` runs for every combination of features. Note that
# target in this context means one of `--lib`, `--bin`, etc, and not the
# target triple.
- name: cargo hack
- name: Cargo hack
run: cargo hack check --feature-powerset --depth 2 --release --target wasm32-unknown-unknown --skip std --workspace --exclude e2e --exclude basic-example-script --exclude benches
typos:
runs-on: ubuntu-latest
name: ubuntu / stable / typos
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v4

- name: Check spelling of files in the workspace
uses: crate-ci/[email protected]
28 changes: 10 additions & 18 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow runs our end-to-end tests suite.
#
# It roughly follows these steps:
# - Install Rust
# - Install rust
# - Install `cargo-stylus`
# - Install `solc`
# - Spin up `nitro-testnode`
Expand All @@ -26,30 +26,22 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: set up rust
uses: dtolnay/rust-toolchain@master
id: toolchain
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: wasm32-unknown-unknown
components: rust-src
toolchain: nightly-2024-01-01
cache-key: "e2e-tests"
rustflags: ""

- uses: Swatinem/rust-cache@v2
with:
key: "e2e-tests"

- name: install cargo-stylus
run: cargo install [email protected]
- name: Install cargo-stylus
run: cargo install [email protected]

- name: install solc
- name: Install solc
run: |
curl -LO https://github.com/ethereum/solidity/releases/download/v0.8.21/solc-static-linux
sudo mv solc-static-linux /usr/bin/solc
sudo chmod a+x /usr/bin/solc

- name: setup nitro node
- name: Setup nitro node
run: ./scripts/nitro-testnode.sh -d -i
- name: run integration tests
run: |
export NIGHTLY_TOOLCHAIN=${{steps.toolchain.outputs.name}}
./scripts/e2e-tests.sh
run: ./scripts/e2e-tests.sh
24 changes: 8 additions & 16 deletions .github/workflows/gas-bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,24 @@ env:
CARGO_TERM_COLOR: always
jobs:
required:
name: gas usage report
name: Gas usage report
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: set up rust
uses: dtolnay/rust-toolchain@master
id: toolchain
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: wasm32-unknown-unknown
components: rust-src
toolchain: nightly-2024-01-01
cache-key: "gas-bench"
rustflags: ""

- uses: Swatinem/rust-cache@v2
with:
key: "gas-bench"

- name: install solc
- name: Install solc
run: |
curl -LO https://github.com/ethereum/solidity/releases/download/v0.8.21/solc-static-linux
sudo mv solc-static-linux /usr/bin/solc
sudo chmod a+x /usr/bin/solc

- name: setup nitro node
- name: Setup nitro node
run: ./scripts/nitro-testnode.sh -d -i
- name: run benches
run: |
export NIGHTLY_TOOLCHAIN=${{steps.toolchain.outputs.name}}
./scripts/bench.sh
run: ./scripts/bench.sh
14 changes: 10 additions & 4 deletions .github/workflows/nostd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,15 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install stable
uses: dtolnay/rust-toolchain@stable
- name: rustup target add ${{ matrix.target }}

- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
rustflags: ""

- name: Add rust targets ${{ matrix.target }}
run: rustup target add ${{ matrix.target }}
- name: cargo check

- name: Cargo check
run: cargo check --release --target ${{ matrix.target }} --no-default-features
48 changes: 33 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,25 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install ${{ matrix.toolchain }}
uses: dtolnay/rust-toolchain@master

- name: Install rust ${{ matrix.toolchain }}
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
- name: cargo generate-lockfile
rustflags: ""

- name: Cargo generate-lockfile
# Enable this ci template to run regardless of whether the lockfile is
# checked in or not.
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile

# https://twitter.com/jonhoo/status/1571290371124260865
- name: cargo test --locked
- name: Run unit tests
run: cargo test --locked --features std --all-targets

# https://github.com/rust-lang/cargo/issues/6669
- name: cargo test --doc
- name: Run doc tests
run: cargo test --locked --features std --doc
os-check:
# Run cargo test on MacOS and Windows.
Expand All @@ -66,12 +71,18 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install stable
uses: dtolnay/rust-toolchain@stable
- name: cargo generate-lockfile

- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
rustflags: ""

- name: Cargo generate-lockfile
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile
- name: cargo test

- name: Run unit tests
run: cargo test --locked --features std --all-targets
coverage:
# Use llvm-cov to build and collect coverage and outputs in a format that
Expand Down Expand Up @@ -101,20 +112,27 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install stable
uses: dtolnay/rust-toolchain@stable

- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
components: llvm-tools-preview
- name: cargo install cargo-llvm-cov
rustflags: ""

- name: Cargo install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: cargo generate-lockfile

- name: Cargo generate-lockfile
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile
- name: cargo llvm-cov
# FIXME: Include e2e tests in coverage.

- name: Cargo llvm-cov
run: cargo llvm-cov --locked --features std --lcov --output-path lcov.info

- name: Record Rust version
run: echo "RUST=$(rustc --version)" >> "$GITHUB_ENV"

- name: Upload to codecov.io
uses: codecov/codecov-action@v4
with:
Expand Down
Loading
Loading