From 83927b78cb9d25b164498f4531f19c7524614738 Mon Sep 17 00:00:00 2001 From: Anatolios Laskaris Date: Mon, 28 Nov 2022 20:45:31 +0200 Subject: [PATCH] ci: Prepare for E2E (#35) --- .cargo/config.toml | 2 + .github/workflows/e2e.yml | 19 +++++++++ .github/workflows/marine-rs-sdk-test.yml | 45 --------------------- .github/workflows/tests.yml | 51 ++++++++++++++++++++++++ Cargo.toml | 2 +- rust-toolchain.toml | 1 + 6 files changed, 74 insertions(+), 46 deletions(-) create mode 100644 .cargo/config.toml create mode 100644 .github/workflows/e2e.yml delete mode 100644 .github/workflows/marine-rs-sdk-test.yml create mode 100644 .github/workflows/tests.yml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..325ec1c --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[registries] +fluence = { index = "git://crates.fluence.dev/index" } diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml new file mode 100644 index 0000000..e1f23bf --- /dev/null +++ b/.github/workflows/e2e.yml @@ -0,0 +1,19 @@ +name: "e2e" + +on: + pull_request: + paths-ignore: + - "**.md" + push: + branches: + - "master" + +concurrency: + group: "${{ github.workflow }}-${{ github.ref }}" + cancel-in-progress: true + +jobs: + marine-rs-sdk-test: + uses: ./.github/workflows/tests.yml + with: + ref: ${{ github.ref }} diff --git a/.github/workflows/marine-rs-sdk-test.yml b/.github/workflows/marine-rs-sdk-test.yml deleted file mode 100644 index f8fd4f4..0000000 --- a/.github/workflows/marine-rs-sdk-test.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: "marine-rs-sdk-test" - -on: - pull_request: - push: - branches: - - "master" - -concurrency: - group: "${{ github.workflow }}-${{ github.ref }}" - cancel-in-progress: true - -env: - RUST_TEST_THREADS: 1 - CARGO_HOME: "${{ github.workspace }}/cargo" - -jobs: - marine-rs-sdk-test: - name: "Run tests" - runs-on: builder - - steps: - - uses: actions/checkout@v3 - - - name: Setup rust toolchain - uses: actions-rust-lang/setup-rust-toolchain@v1 - - - name: Run cargo fmt - run: cargo fmt --all -- --check - - - name: Run cargo build - run: cargo build - - - name: Run cargo check - run: cargo check -v --all-features - - - name: Run cargo test in marine-test-macro-impl - run: cargo test - working-directory: crates/marine-test-macro-impl - - - name: Run cargo test - run: cargo test --release --all-features --no-fail-fast - - - name: Run cargo clippy - run: cargo clippy -Z unstable-options --all diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..e78ca51 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,51 @@ +name: Run tests with workflow_call + +on: + workflow_call: + inputs: + cargo-dependencies: + description: "Cargo dependencies map" + type: string + ref: + description: "git ref to checkout to" + type: string + default: "matster" + +env: + RUST_TEST_THREADS: 1 + +jobs: + marine-rs-sdk-test: + name: "Run tests" + runs-on: builder + + steps: + - name: Checkout to marine-rs-sdk-test + uses: actions/checkout@v3 + with: + repository: "fluencelabs/marine-rs-sdk-test" + ref: ${{ inputs.ref }} + + - name: Setup rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + + - name: Set dependencies + if: inputs.cargo-dependencies != '' + uses: fluencelabs/github-actions/cargo-set-dependency@main + with: + dependencies: ${{ inputs.cargo-dependencies }} + + - name: Run cargo build + run: cargo build + + - name: Run cargo check + run: cargo check -v --all-features + + - name: Run cargo test + run: cargo test --release --all-features --no-fail-fast + + - name: Run cargo clippy + run: cargo clippy -Z unstable-options --all + + - name: Run rustfmt + uses: actions-rust-lang/rustfmt@v1 diff --git a/Cargo.toml b/Cargo.toml index 4eeef60..866015f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,4 +34,4 @@ members = [ "crates/marine-test-macro", "crates/marine-test-macro-impl", "crates/marine-build-rs-generator", - ] +] diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 1b3380c..5cccbe7 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,4 @@ [toolchain] channel = "nightly-2022-08-30" targets = [ "x86_64-unknown-linux-gnu", "x86_64-apple-darwin", "wasm32-wasi" ] +components = ["clippy", "rustfmt"]