From ad42d32add0a02565cceb3f381792acebd5144cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kaya=20G=C3=B6kalp?= Date: Fri, 1 Dec 2023 20:26:24 +0300 Subject: [PATCH] chore: remove ci jobs for indexing new versions and publishing latest compatible channels (#512) Co-authored-by: Sophie Dankel <47993817+sdankel@users.noreply.github.com> --- .github/workflows/index-versions.yml | 155 ------------- .../test-toolchain-compatibility.yml | 218 ------------------ 2 files changed, 373 deletions(-) delete mode 100644 .github/workflows/index-versions.yml delete mode 100644 .github/workflows/test-toolchain-compatibility.yml diff --git a/.github/workflows/index-versions.yml b/.github/workflows/index-versions.yml deleted file mode 100644 index c6c091a8e..000000000 --- a/.github/workflows/index-versions.yml +++ /dev/null @@ -1,155 +0,0 @@ -name: Check Versions - -on: - workflow_dispatch: - schedule: - # Run at minute 0 every 6 hours - - cron: '0 */6 * * *' -env: - LATEST_CHANNEL_DIR: ./channel-fuel-latest.toml.d/ - -jobs: - # compare-versions: This job runs the compare-version script which collects - # latest versions released after the versions found in channel-fuel-latest.toml, - # filters out incompatible versions and uses the leftover as inputs to - # test-toolchain-compatibility job to run integration tests. - compare-versions: - name: Check versions - runs-on: ubuntu-latest - outputs: - should-run: ${{ steps.set-version-matrix.outputs.should-run }} - version-matrix: ${{ steps.set-version-matrix.outputs.version-matrix }} - steps: - - name: checkout master - uses: actions/checkout@v3 - - - name: Install toolchain - uses: dtolnay/rust-toolchain@stable - - - uses: Swatinem/rust-cache@v2 - - - name: Checkout fuelup gh-pages - uses: actions/checkout@v3 - with: - repository: fuellabs/fuelup - path: gh-pages - ref: gh-pages - - - uses: Swatinem/rust-cache@v1 - - - name: Install compare-versions script - run: cargo install --debug --path ./ci/compare-versions - - - name: Compare versions and set variables for tests if needed - id: set-version-matrix - run: | - compare-versions compatibility >> out - VERSIONS='' - # If file is empty, we have no new versions and we are done. - if [ -s out ]; then - - # Read the output of compare-versions line-by-line - # for the versions newer than what is published within - # channel-fuel-latest.toml - while read line - do - if [ -d gh-pages/incompatible-versions ] && [ -e gh-pages/incompatible-versions/$line ]; then - # If an incompatible set is already published onto gh-pages, we do not add it to the matrix input for testing. - echo "incompatible versions: $line" - else - echo "::set-output name=should-run::true" - if [ -n "$VERSIONS" ]; then - VERSIONS+=',' - fi - - # Next 4 lines is simply splitting the lines received from compare-versions into a JSON object. - # example line: - # forc-0.17.0@fuel-core-0.9.4 - # result: - # {"forc-version":"0.17.0","fuel-core-version":"0.9.4"} - # - # We append this string to VERSIONS. - - FORC_VERSION="$(echo $line | cut -d '@' -f1 | cut -d '-' -f2-)" - FUEL_CORE_VERSION="$(echo $line | cut -d '@' -f2- | cut -d '-' -f3-)" - JSON_FMT='{"forc-version":"%s","fuel-core-version":"%s"}' - VERSIONS+=$(printf "$JSON_FMT" "$FORC_VERSION" "$FUEL_CORE_VERSION") - fi - done < "./out" - - echo "Testing with versions: $VERSIONS" - - echo "::set-output name=version-matrix::{\"job\":[$VERSIONS]}" - else - echo -e "\nNo new and untested versions; exiting" - fi - - # test-compatibility: This job invokes test-toolchain-compatibility with - # version-matrix, a JSON string input, to trigger jobs to test compatibility - # between forc and fuel-core. - # - # This is only run if should-run is set to true. - test-compatibility: - name: Test compatibility - needs: compare-versions - if: ${{ needs.compare-versions.outputs.should-run == 'true' }} - uses: ./.github/workflows/test-toolchain-compatibility.yml - with: - version-matrix: ${{ needs.compare-versions.outputs.version-matrix }} - - check-other-components-latest: - name: Check other components for their latest versions - needs: compare-versions - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Install toolchain - uses: dtolnay/rust-toolchain@stable - - - uses: Swatinem/rust-cache@v2 - - - name: Install compare-versions script - run: cargo install --debug --path ./ci/compare-versions - - - name: Install build-channel script - run: cargo install --debug --path ./ci/build-channel - - - name: Check for latest versions of other components and execute build-channel - id: compare-rest - run: | - CHANNEL_TOML="channel-fuel-latest.toml" - compare-versions rest - if [[ -f "${CHANNEL_TOML}" ]]; then - echo "republish=true" >> $GITHUB_OUTPUT - - mkdir -p ${{ env.LATEST_CHANNEL_DIR }} - - cp $CHANNEL_TOML ${{ env.LATEST_CHANNEL_DIR }} - - mkdir archive - PUBLISHED_DATE=$(date +'%Y-%m-%d') - cp $CHANNEL_TOML archive/channel-fuel-latest-${PUBLISHED_DATE}.toml - fi - - - name: Deploy latest channel - if: ${{ steps.compare-rest.outputs.republish == 'true' }} - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ${{ env.LATEST_CHANNEL_DIR }} - keep_files: true - destination_dir: ./ - user_name: 'github-actions[bot]' - user_email: 'github-actions[bot]@users.noreply.github.com' - - - name: Deploy latest channel (archive) - if: ${{ steps.compare-rest.outputs.republish == 'true' }} - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./archive - keep_files: true - destination_dir: ./channels/latest - user_name: 'github-actions[bot]' - user_email: 'github-actions[bot]@users.noreply.github.com' diff --git a/.github/workflows/test-toolchain-compatibility.yml b/.github/workflows/test-toolchain-compatibility.yml deleted file mode 100644 index 5cf47e123..000000000 --- a/.github/workflows/test-toolchain-compatibility.yml +++ /dev/null @@ -1,218 +0,0 @@ -name: Test toolchain compatibility (Latest) - -on: - workflow_dispatch: - inputs: - version-matrix: - required: true - type: string - workflow_call: - inputs: - version-matrix: - required: true - type: string - -env: - RUST_VERSION: 1.71.0 - NIGHTLY_RUST_VERSION: nightly-2023-02-08 - INCOMPATIBLE_DIR: ./incompatible-versions - LATEST_CHANNEL_DIR: ./channel-fuel-latest.toml.d/ - -jobs: - test-toolchain-compatibility: - name: Test forc-${{ matrix.job.forc-version }} against fuel-core-${{ matrix.job.fuel-core-version }} - runs-on: buildjet-8vcpu-ubuntu-2204 - # Init parallelized jobs running tests for toolchain version sets in a matrix. - # `fail-fast` is set to false so that we run the tests to completion even if a single version set fails. - # We use the fromJSON expression to have an easier time setting up a matrix with dynamic inputs. - # See: - # https://docs.github.com/en/actions/learn-github-actions/expressions#fromjson - strategy: - fail-fast: false - matrix: ${{ fromJSON(inputs.version-matrix) }} - services: - fuel-core: - image: ghcr.io/fuellabs/fuel-core:v${{ matrix.job.fuel-core-version }} - ports: - - 4000:4000 - - steps: - - name: Checkout Sway repo @ v${{ matrix.job.forc-version }} - uses: actions/checkout@v3 - with: - repository: fuellabs/sway - path: sway - ref: v${{ matrix.job.forc-version }} - - - name: Install toolchain - uses: dtolnay/rust-toolchain@master - with: - toolchain: ${{ env.RUST_VERSION }} - - - uses: buildjet/cache@v3 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - - name: Install Forc - run: cd sway && cargo install --locked --debug --path ./forc - - - name: Build sway-lib-core and sway-lib-std - run: cd sway && forc build --path sway-lib-core && forc build --path sway-lib-std - - # In the next steps we run the integration tests found in the Sway CI: - # https://github.com/FuelLabs/sway/blob/3bd8eaf4a0f11a3009c9421100cc06c2e897b6c2/.github/workflows/ci.yml#L229-L270 - - name: Cargo Run E2E Tests - id: e2e-tests - run: cd sway && cargo run --locked --release --bin test -- --locked - - - name: Cargo Run E2E Tests (EVM) - id: e2e-evm-tests - run: cd sway && cargo run --locked --release --bin test -- --target evm --locked - - - name: Build All Tests - run: cd sway && cargo run --locked -p forc -- build --locked --path ./test/src/sdk-harness - - - name: Cargo Test sway-lib-std - id: std-lib-tests - run: cd sway && cargo test --manifest-path ./test/src/sdk-harness/Cargo.toml -- --nocapture - - # We use upload artifacts in the remaining steps to collect test results to be used in the subsequent index-versions job. - # - # See: - # https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts - # - # On failure, we upload files with the `incompatible` prefix. - # - # We have to explicitly check for: - # 1) e2e-tests.conclusion == 'failure' - # 2) e2e-evm-tests.conclusion == 'failure' - # 3) std-lib-tests.conclusion == 'failure' - # So that we create failure artifacts only if tests fail and not anywhere before so that we can retry this workflow - # if it fails for other reasons other than tests. - - name: Create failure artifact - if: ${{ failure() && (steps.e2e-tests.conclusion == 'failure' || - steps.e2e-evm-tests.conclusion == 'failure' || - steps.std-lib-tests.conclusion == 'failure' )}} - run: touch incompatible-forc-${{ matrix.job.forc-version }}@fuel-core-${{ matrix.job.fuel-core-version }} - - - name: Upload failure artifact - if: ${{ failure() && (steps.e2e-tests.conclusion == 'failure' || - steps.e2e-evm-tests.conclusion == 'failure' || - steps.std-lib-tests.conclusion == 'failure' )}} - id: upload-failure-artifact - uses: actions/upload-artifact@v3 - with: - name: incompatible-forc-${{ matrix.job.forc-version }}@fuel-core-${{ matrix.job.fuel-core-version }} - path: incompatible-forc-${{ matrix.job.forc-version }}@fuel-core-${{ matrix.job.fuel-core-version }} - - # On success, we upload files with the `compatible` prefix. - # - # Success artifacts are created if everything above passed. This marks the 2 versions as compatible. - - name: Create success artifact - if: ${{ success() }} - run: touch compatible-forc-${{ matrix.job.forc-version }}@fuel-core-${{ matrix.job.fuel-core-version }} - - - name: Upload success artifact - if: ${{ success() }} - id: upload-success-artifact - uses: actions/upload-artifact@v3 - with: - name: compatible-forc-${{ matrix.job.forc-version }}@fuel-core-${{ matrix.job.fuel-core-version }} - path: compatible-forc-${{ matrix.job.forc-version }}@fuel-core-${{ matrix.job.fuel-core-version }} - - # index-versions: This job will process the artifacts above if testing is not skipped and upload - # incompatible versions and/or publish a new channel-fuel-latest.toml to gh-pages. - index-versions: - name: Index versions compatibilities - needs: test-toolchain-compatibility - if: ${{ always() && needs.test-toolchain-compatibility.result != 'skipped' }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - uses: actions/download-artifact@v3 - with: - path: versions - - # Here, we decide which versions to mark as compatible or incompatible. - # Compatible: the uploaded artifact starting with the name 'compatible' and is at the top when sorted. - # We only care about the latest version set that passed tests here. - # - # Incompatible: all the uploaded artifacts that has 'incompatible' in file names, followed by their versions. - # Here we care about all versions tagged as incompatible, and they're uploaded inside the incompatible-versions - # directory within the `gh-pages` branch. - - name: Prepare compatible and incompatible versions - id: prep-versions - working-directory: versions - run: | - COMPATIBLE_VERSIONS=$(ls -1 | grep "^compatible*" | sort -rV | head -n 1) - echo "LATEST_COMPATIBLE_FORC=$(echo $COMPATIBLE_VERSIONS | cut -d '@' -f1 | cut -d '-' -f3-)" >> $GITHUB_ENV - echo "LATEST_COMPATIBLE_FUEL_CORE=$(echo $COMPATIBLE_VERSIONS | cut -d '@' -f2 | cut -d '-' -f3)" >> $GITHUB_ENV - - INCOMPATIBLE_VERSIONS=$(ls | grep 'incompatible' | cut -d '-' -f2-) - mkdir -p ${{ env.INCOMPATIBLE_DIR }} - for version in $INCOMPATIBLE_VERSIONS; do - echo published_by=https://github.com/FuelLabs/fuelup/actions/runs/$GITHUB_RUN_ID >> ${{ env.INCOMPATIBLE_DIR }}/$version - done - - - name: Install toolchain - uses: dtolnay/rust-toolchain@stable - - - name: Install build-channel script - run: cargo install --debug --path ./ci/build-channel - - # Generate the channel TOML file here and run build-channel script which appends download links and hashes for forc and fuel-core to the channel TOML. - # - # Here we want 2 copies of the same latest TOMLs: 1 with the date and 1 without. - # The TOML with the date is used to pin versions within fuel-toolchain.toml. - - name: Prepare channel with compatible versions - if: ${{ env.LATEST_COMPATIBLE_FORC && env.LATEST_COMPATIBLE_FUEL_CORE }} - run: | - mkdir -p ${{ env.LATEST_CHANNEL_DIR }} - CHANNEL_TOML="channel-fuel-latest.toml" - - PUBLISHED_DATE=$(date +'%Y-%m-%d') - build-channel $CHANNEL_TOML $PUBLISHED_DATE --github-run-id $GITHUB_RUN_ID forc=${{ env.LATEST_COMPATIBLE_FORC }} fuel-core=${{ env.LATEST_COMPATIBLE_FUEL_CORE }} - - cp $CHANNEL_TOML ${{ env.LATEST_CHANNEL_DIR }} - - mkdir archive - cp $CHANNEL_TOML archive/channel-fuel-latest-${PUBLISHED_DATE}.toml - - - name: Deploy latest channel - if: ${{ env.LATEST_COMPATIBLE_FORC && env.LATEST_COMPATIBLE_FUEL_CORE }} - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ${{ env.LATEST_CHANNEL_DIR }} - keep_files: true - destination_dir: ./ - user_name: 'github-actions[bot]' - user_email: 'github-actions[bot]@users.noreply.github.com' - - - name: Deploy latest channel (archive) - if: ${{ env.LATEST_COMPATIBLE_FORC && env.LATEST_COMPATIBLE_FUEL_CORE }} - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./archive - keep_files: true - destination_dir: ./channels/latest - user_name: 'github-actions[bot]' - user_email: 'github-actions[bot]@users.noreply.github.com' - - - name: Deploy incompatible versions - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: versions/incompatible-versions - keep_files: true - destination_dir: ${{ env.INCOMPATIBLE_DIR }} - user_name: 'github-actions[bot]' - user_email: 'github-actions[bot]@users.noreply.github.com'