Skip to content

Commit

Permalink
ci: add a job for checking fuel-core versions between sdk-harness and…
Browse files Browse the repository at this point in the history
… test suite (#5930)

## Description
We are currently out of sync in between sdk-harness and test suite, this
is not ideal due to couple of reasons:

1. It is not nice to have our two test suites, testing with different
versions of fuel-core, which means we do not test one version completely
in the sense of our e2e and sdk-harness tests.
2. It can create problems in CI if a contract id needs to be updated,
when the out-of sync versions are incompatible. (for example: one is
using version 0.1.0, one is using 0.2.0)

The added job will fail and inform the dev bumping fuel-core version, to
also bump it in sdk-harness or in general make them in sync.

The reason we need this as a CI job is we cannot enforce it via cargo.
Since adding sdk-harness to the sway repo workspace, it creates our well
known cyclic dependency between sdk and sway. So this should be checked
in CI.
  • Loading branch information
kayagokalp authored Apr 27, 2024
1 parent ae412ad commit ec22cb6
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,27 @@ jobs:
- name: Run the formatter against all sway projects and fail if any of them panic
run: scripts/formatter/forc-fmt-check-panic.sh

check-sdk-harness-test-suite-compatibility:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Install toml-cli
run: cargo install toml-cli

- name: Read and compare versions
env:
PACKAGE_NAMES: "fuel-core-client" # multiple packages can be specified delimeted with `,`.
run: |
.github/workflows/scripts/check-sdk-harness-version.sh
build-mdbook:
runs-on: buildjet-8vcpu-ubuntu-2204
steps:
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/scripts/check-sdk-harness-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
IFS=',' read -ra PACKAGES <<< "$PACKAGE_NAMES"
mismatch=0
for PACKAGE in "${PACKAGES[@]}"; do
VERSION_FIRST=$(toml get ./Cargo.toml "workspace.dependencies.$PACKAGE.version")
VERSION_SECOND=$(toml get ./test/src/sdk-harness/Cargo.toml "dependencies.$PACKAGE.version")
printf "$PACKAGE Version - First: $VERSION_FIRST, Second: $VERSION_SECOND\n"
if [ "$VERSION_FIRST" != "$VERSION_SECOND" ]; then
printf "Version mismatch for $PACKAGE: First: $VERSION_FIRST, Second: $VERSION_SECOND\n"
mismatch=1
fi
done
if [ $mismatch -ne 0 ]; then
printf "Version mismatch between fuel-core-client used in sdk-harness and rest of sway repo.\nThis will cause problems if two versions are incompatible or it might simply cause invalid/outdated test suite.\nIf you are bumping fuel-core versions used in sway repo, please also use same version in sdk-harness.\n"
exit 1
else
echo "All specified package versions match."
fi

0 comments on commit ec22cb6

Please sign in to comment.