Skip to content

Commit

Permalink
chore: Update E2E [fixes FLU-297 and FLU-252 and FLU-298 and FLU-267] (
Browse files Browse the repository at this point in the history
…#1538)

* Update

* Fix

* Cleanup

* Fix lint

* Naming

* Naming 2

* Cleanup
  • Loading branch information
nahsi authored Mar 29, 2023
1 parent 481dbd4 commit 7cec3d1
Show file tree
Hide file tree
Showing 5 changed files with 155 additions and 124 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: "Build rust-peer binary"

on:
workflow_call:
inputs:
ref:
description: "git ref to checkout to"
type: string
default: "master"
cargo-dependencies:
description: "Cargo dependencies map"
type: string
default: "null"
outputs:
rust-peer-sha:
description: "rust-peer sha256 hash"
value: ${{ jobs.build.outputs.sha256 }}

jobs:
build:
name: "Build rust-peer"
runs-on: builder
timeout-minutes: 60

env:
RUSTFLAGS: "-D warnings --cfg tokio_unstable"

outputs:
sha256: "${{ steps.sha.outputs.sha256 }}"

steps:
- name: Checkout rust-peer
uses: actions/checkout@v3
with:
repository: fluencelabs/rust-peer
ref: ${{ inputs.ref }}

- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Get PR labels
id: labels
uses: joerick/[email protected]

- name: Set profile
id: profile
run: |
if [[ -n "$GITHUB_PR_LABEL_PROFILING" ]]; then
echo "profile=profiling" >> $GITHUB_OUTPUT
echo "flags=--profile=profiling --features particle-node/dhat-heap" >> $GITHUB_OUTPUT
else
echo "profile=release" >> $GITHUB_OUTPUT
echo "flags=--profile=release" >> $GITHUB_OUTPUT
fi
- name: Set dependencies
if: inputs.cargo-dependencies != 'null'
uses: fluencelabs/github-actions/cargo-set-dependency@main
with:
dependencies: ${{ inputs.cargo-dependencies }}

- name: Generate snapshot version
id: version
uses: fluencelabs/github-actions/generate-snapshot-id@main

- name: Set version
id: snapshot
uses: fluencelabs/github-actions/cargo-publish-snapshot@main
with:
id: ${{ steps.version.outputs.id }}
publish: false

- name: Run cargo build
run: cargo build ${{ steps.profile.outputs.flags }} -p particle-node

- name: Calculate SHA256
id: sha
working-directory: ./target/${{ steps.profile.outputs.profile }}
run: |
# Calculate sha256
du -hs particle-node
sha256sum particle-node
sha=($(sha256sum particle-node))
echo "sha256=${sha}" >> $GITHUB_OUTPUT
- name: Upload rust-peer binary
uses: actions/upload-artifact@v3
with:
name: rust-peer
path: target/${{ steps.profile.outputs.profile }}/particle-node
55 changes: 41 additions & 14 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,45 @@ name: "e2e"
on:
pull_request:
paths-ignore:
- "!**.md"
- "**.md"
- ".github/**"
- "!.github/workflows/e2e.yml"
- "!.github/workflows/snapshot.yml"
- "!.github/workflows/container.yml"
types:
- "labeled"
- "synchronize"
- "opened"
- "reopened"
push:
branches:
- "master"
paths-ignore:
- "**.md"
- ".github/**"
- "!.github/workflows/e2e.yml"
- "!.github/workflows/snapshot.yml"
- "!.github/workflows/container.yml"

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

jobs:
rust-peer:
uses: ./.github/workflows/snapshot.yml
if: >
github.event_name == 'push' ||
(
contains(github.event.pull_request.labels.*.name, 'e2e') &&
!github.event.pull_request.head.repo.fork
)
uses: ./.github/workflows/build.yml
with:
image-name: "docker.fluence.dev/rust-peer"
ref: ${{ github.ref }}

rust-peer-flavours:
name: "rust-peer"

needs: rust-peer

strategy:
matrix:
flavour:
Expand All @@ -36,37 +54,46 @@ jobs:
flavour: "${{ matrix.flavour }}"
rust-peer-sha: "${{ needs.rust-peer.outputs.rust-peer-sha }}"

rust-peer-snapshot:
name: "rust-peer"
needs: rust-peer
uses: ./.github/workflows/container.yml
with:
image-name: "docker.fluence.dev/rust-peer"
flavour: "minimal"
rust-peer-sha: "${{ needs.rust-peer.outputs.rust-peer-sha }}"

js-client:
needs:
- rust-peer
- rust-peer-snapshot
uses: fluencelabs/js-client/.github/workflows/tests.yml@master
with:
rust-peer-image: "${{ needs.rust-peer.outputs.rust-peer-image }}"
rust-peer-image: "${{ needs.rust-peer-snapshot.outputs.rust-peer-image }}"

aqua-playground:
needs:
- rust-peer
- rust-peer-snapshot
uses: fluencelabs/aqua-playground/.github/workflows/tests.yml@master
with:
rust-peer-image: "${{ needs.rust-peer.outputs.rust-peer-image }}"
rust-peer-image: "${{ needs.rust-peer-snapshot.outputs.rust-peer-image }}"

registry:
needs:
- rust-peer
- rust-peer-snapshot
uses: fluencelabs/registry/.github/workflows/tests.yml@main
with:
rust-peer-image: "${{ needs.rust-peer.outputs.rust-peer-image }}"
rust-peer-image: "${{ needs.rust-peer-snapshot.outputs.rust-peer-image }}"

fluence-cli:
needs:
- rust-peer
- rust-peer-snapshot
uses: fluencelabs/fluence-cli/.github/workflows/tests.yml@main
with:
rust-peer-image: "${{ needs.rust-peer.outputs.rust-peer-image }}"
rust-peer-image: "${{ needs.rust-peer-snapshot.outputs.rust-peer-image }}"

status:
name: "e2e status"
runs-on: ubuntu-latest
if: always()
needs:
- fluence-cli
- registry
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run tests
name: "test"

on:
pull_request:
Expand Down
79 changes: 8 additions & 71 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: Publish snapshot
# Compatibility workflow
name: "Publish snapshot"

on:
workflow_call:
inputs:
ref:
description: "GitHub ref to checkout to"
description: "git ref to checkout to"
type: string
default: "master"
image-name:
Expand All @@ -14,6 +15,7 @@ on:
cargo-dependencies:
description: "Cargo dependencies map"
type: string
default: "null"
outputs:
rust-peer-image:
description: "rust-peer snapshot image"
Expand All @@ -24,76 +26,11 @@ on:

jobs:
build:
uses: ./.github/workflows/build.yml
with:
ref: ${{ inputs.ref }}
name: "Build"
runs-on: builder
timeout-minutes: 60

outputs:
sha256: "${{ steps.sha.outputs.sha256 }}"

steps:
- name: Checkout rust-peer
uses: actions/checkout@v3
with:
repository: fluencelabs/rust-peer
ref: ${{ inputs.ref }}

- name: Get PR labels
id: labels
uses: joerick/[email protected]

- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Set profile
id: profile
run: |
if [[ -n "$GITHUB_PR_LABEL_PROFILING" ]]; then
echo "profile=profiling" >> $GITHUB_OUTPUT
echo "flags=--profile=profiling --features particle-node/dhat-heap" >> $GITHUB_OUTPUT
else
echo "profile=release" >> $GITHUB_OUTPUT
echo "flags=--profile=release" >> $GITHUB_OUTPUT
fi
- name: Set dependencies
if: inputs.cargo-dependencies != ''
uses: fluencelabs/github-actions/cargo-set-dependency@main
with:
dependencies: ${{ inputs.cargo-dependencies }}

- name: Generate snapshot version
id: version
uses: fluencelabs/github-actions/generate-snapshot-id@main

- name: Set version
id: snapshot
uses: fluencelabs/github-actions/cargo-publish-snapshot@main
with:
id: ${{ steps.version.outputs.id }}
publish: false

- name: Run cargo build
env:
RUSTFLAGS: "--cfg tokio_unstable"
run: cargo build ${{ steps.profile.outputs.flags }} -p particle-node

- name: Calculate SHA256
id: sha
working-directory: ./target/${{ steps.profile.outputs.profile }}
run: |
# Calculate sha256
du -hs particle-node
sha256sum particle-node
sha=($(sha256sum particle-node))
echo "sha256=${sha}" >> $GITHUB_OUTPUT
- name: Upload rust-peer binary
uses: actions/upload-artifact@v3
with:
name: rust-peer
path: target/${{ steps.profile.outputs.profile }}/particle-node


container:
needs: build
uses: ./.github/workflows/container.yml
Expand Down
53 changes: 15 additions & 38 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,23 @@
name: Run tests
name: "Run tests with workflow_call"

on:
workflow_call:
inputs:
ref:
description: "GitHub ref to checkout to"
description: "git ref to checkout to"
type: string
default: "master"
cargo-dependencies:
description: "Cargo dependencies map"
type: string
default: "null"

jobs:
lint:
name: cargo lints
runs-on: builder
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
repository: fluencelabs/rust-peer
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 fmt
run: cargo fmt --all -- --check

- name: Run cargo clippy
env:
RUSTFLAGS: "--cfg tokio_unstable"
run: cargo clippy -Z unstable-options --all
env:
RUSTFLAGS: "-D warnings --cfg tokio_unstable"

jobs:
tests:
name: cargo nextest
name: "cargo nextest"
runs-on: builder
timeout-minutes: 60

Expand All @@ -55,20 +32,14 @@ jobs:
uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Set dependencies
if: inputs.cargo-dependencies != ''
if: inputs.cargo-dependencies != 'null'
uses: fluencelabs/github-actions/cargo-set-dependency@main
with:
dependencies: ${{ inputs.cargo-dependencies }}

- name: Install cargo-nextest
uses: baptiste0928/[email protected]
with:
crate: cargo-nextest
version: 0.9.22
- uses: taiki-e/install-action@nextest

- name: Run cargo nextest
env:
RUSTFLAGS: "--cfg tokio_unstable"
run: cargo nextest run --release --all-features --profile ci

- name: Upload test report
Expand All @@ -78,3 +49,9 @@ jobs:
name: cargo nextest report
path: target/nextest/ci/junit.xml
reporter: java-junit

- name: Run cargo fmt
run: cargo fmt --all -- --check

- name: Run cargo clippy
run: cargo clippy -Z unstable-options --all

0 comments on commit 7cec3d1

Please sign in to comment.