Skip to content

Commit

Permalink
Merge pull request #480 from Concordium/attempt-to-fix-ci
Browse files Browse the repository at this point in the history
Attempt to fix CI.
  • Loading branch information
abizjak authored Nov 22, 2023
2 parents d23e634 + 9c2e64c commit 151924d
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 177 deletions.
82 changes: 24 additions & 58 deletions .github/workflows/build-test-contracts-common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,25 @@ on:
paths:
- 'smart-contracts/contracts-common/**/*.rs'
- 'smart-contracts/contracts-common/**/*.toml'
- '.github/workflows/build-test-contracts-common.yaml'

pull_request:
branches:
- main
paths:
- 'smart-contracts/contracts-common/**/*.rs'
- 'smart-contracts/contracts-common/**/*.toml'
- '.github/workflows/build-test-contracts-common.yaml'

name: Clippy & fmt

env:
RUST_VERSION: "1.65"
RUST_FMT: "nightly-2023-04-01"
WORKING_DIRECTORY: "./smart-contracts/contracts-common"

defaults:
run:
working-directory: "./smart-contracts/contracts-common"

jobs:
rustfmt:
Expand All @@ -29,17 +35,10 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install nightly toolchain with rustfmt available
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.RUST_FMT }}
override: true
components: rustfmt

- name: Run cargo fmt
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
rustup default ${{ env.RUST_FMT }}
rustup component add rustfmt
cargo fmt --all --check
rustdoc:
Expand All @@ -49,16 +48,10 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.RUST_VERSION }}
override: true

- name: Run cargo doc
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
rustup default ${{ env.RUST_VERSION }}
rustup component add rust-docs
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features --color=always
clippy:
Expand All @@ -82,21 +75,12 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install nightly toolchain with clippy available
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.RUST_VERSION }}
target: ${{ matrix.target }}
override: true
components: clippy

- name: Run cargo clippy
uses: actions-rs/cargo@v1
working-directory: ${{ env.WORKING_DIRECTORY }}
with:
command: clippy
args: --manifest-path=concordium-contracts-common/Cargo.toml --target=${{ matrix.target }} --features=${{ matrix.features }} --no-default-features -- -D warnings
run: |
rustup default ${{ env.RUST_VERSION }}
rustup component add clippy
rustup target add ${{ matrix.target }}
cargo clippy --manifest-path=concordium-contracts-common/Cargo.toml --target=${{ matrix.target }} --features=${{ matrix.features }} --no-default-features -- -D warnings
clippy-on-derive:
name: Clippy on concordium-contracts-common-derive
Expand All @@ -115,21 +99,12 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install nightly toolchain with clippy available
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.RUST_VERSION }}
target: ${{ matrix.target }}
override: true
components: clippy

- name: Run cargo clippy
uses: actions-rs/cargo@v1
working-directory: ${{ env.WORKING_DIRECTORY }}
with:
command: clippy
args: --manifest-path=concordium-contracts-common-derive/Cargo.toml --target=${{ matrix.target }} --no-default-features -- -D warnings
run: |
rustup default ${{ env.RUST_VERSION }}
rustup component add clippy
rustup target add ${{ matrix.target }}
cargo clippy --manifest-path=concordium-contracts-common-derive/Cargo.toml --target=${{ matrix.target }} --no-default-features -- -D warnings
test:
name: x86_64 tests
Expand All @@ -138,16 +113,7 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.RUST_VERSION }}
override: true

- name: Run cargo test
uses: actions-rs/cargo@v1
working-directory: ${{ env.WORKING_DIRECTORY }}
with:
command: test
args: --workspace --all-features
run: |
rustup default ${{ env.RUST_VERSION }}
cargo test --workspace --all-features
101 changes: 28 additions & 73 deletions .github/workflows/build-test-smart-contracts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Install WABT
run: sudo apt-get update && sudo apt-get -y install wabt
- name: Check consistency
Expand All @@ -41,17 +41,12 @@ jobs:
- 'wasm-chain-integration'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.RUST_FMT }}
override: true
components: rustfmt
uses: actions/checkout@v4
- name: Format
working-directory: smart-contracts/${{ matrix.build-dir }}
run: |
rustup default ${{ env.RUST_FMT }}
rustup component add rustfmt
cargo fmt -- --color=always --check
"lint_doc":
Expand All @@ -66,19 +61,14 @@ jobs:
- 'wasm-chain-integration'
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.RUST_CLIPPY }}
override: true
components: clippy
- name: Format
working-directory: smart-contracts/${{ matrix.build-dir }}
run: |
rustup default ${{ env.RUST_CLIPPY }}
rustup component add rust-docs
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features
"lint_fmt_example_contracts":
Expand All @@ -98,18 +88,12 @@ jobs:
- 'fib'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.RUST_FMT }}
override: true
target: wasm32-unknown-unknown
components: rustfmt
uses: actions/checkout@v4
- name: Format
working-directory: smart-contracts/rust-contracts/example-contracts/${{ matrix.example-contract }}
run: |
rustup default ${{ env.RUST_FMT }}
rustup component add rustfmt
cargo fmt -- --color=always --check
"lint_clippy_wasm_transform":
Expand All @@ -123,20 +107,15 @@ jobs:
- 'wasm-transform'
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.RUST_CLIPPY }}
override: true
components: clippy
- name: Clippy
working-directory: smart-contracts/${{ matrix.build-dir }}
run: |
git config --global url."https://github.com/".insteadOf "[email protected]:"
rustup default ${{ env.RUST_CLIPPY }}
rustup component add clippy
cargo clippy --color=always --tests --benches -- -Dclippy::all
"lint_clippy_wasm_chain_integration":
Expand All @@ -154,20 +133,15 @@ jobs:
- 'async'
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.RUST_CLIPPY }}
override: true
components: clippy
- name: Clippy
working-directory: smart-contracts/${{ matrix.build-dir }}
run: |
git config --global url."https://github.com/".insteadOf "[email protected]:"
rustup default ${{ env.RUST_CLIPPY }}
rustup component add clippy
cargo clippy --locked --features ${{ matrix.features }} --no-default-features --color=always --tests --benches -- -Dclippy::all
"lint_clippy_example_contracts":
Expand All @@ -187,19 +161,14 @@ jobs:
- 'fib'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.RUST_CLIPPY }}
override: true
target: wasm32-unknown-unknown
components: clippy
uses: actions/checkout@v4
- name: Clippy
working-directory: smart-contracts/rust-contracts/example-contracts/${{ matrix.example-contract }}
run: |
git config --global url."https://github.com/".insteadOf "[email protected]:"
rustup default ${{ env.RUST_CLIPPY }}
rustup component add clippy
rustup target add wasm32-unknown-unknown
cargo clippy --locked --color=always --tests -- -Dclippy::all
"cargo_test":
Expand All @@ -212,18 +181,14 @@ jobs:
- 'wasm-chain-integration'
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.RUST_CLIPPY }}
override: true
- name: Test
working-directory: smart-contracts/${{ matrix.build-dir }}
run: cargo test
run: |
rustup default ${{ env.RUST_CLIPPY }}
cargo test
"cargo_test_example_contracts":
name: ${{ matrix.example-contract }} cargo:test
Expand All @@ -243,35 +208,25 @@ jobs:
#Remaining example contracts have not yet been added to ci
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.RUST_CLIPPY }}
override: true
uses: actions/checkout@v4
- name: Test
working-directory: smart-contracts/rust-contracts/example-contracts/${{ matrix.example-contract }}
run: |
git config --global url."https://github.com/".insteadOf "[email protected]:"
rustup default ${{ env.RUST_CLIPPY }}
cargo test --target x86_64-unknown-linux-gnu
"wasm-core-spec_cargo_test":
name: wasm-core-spec cargo:test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.RUST_CLIPPY }}
override: true
- name: Test
working-directory: smart-contracts/wasm-test
run: |
rustup default ${{ env.RUST_CLIPPY }}
cargo build
./target/debug/wasm-test --dir ../testdata/wasm-spec-test-suite/core/
Loading

0 comments on commit 151924d

Please sign in to comment.