diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a95920384ee..23b3d33f687 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: diff --git a/.github/workflows/scripts/check-sdk-harness-version.sh b/.github/workflows/scripts/check-sdk-harness-version.sh new file mode 100755 index 00000000000..99646f5a953 --- /dev/null +++ b/.github/workflows/scripts/check-sdk-harness-version.sh @@ -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