From 14994861680e198900234c5ea0f539dade5b3167 Mon Sep 17 00:00:00 2001 From: Christian Langenbacher Date: Wed, 22 Jan 2025 11:58:02 +0100 Subject: [PATCH] [CI] enable whole ci again --- .github/workflows/ci.yml | 286 +++++++++++++++++++-------------------- 1 file changed, 143 insertions(+), 143 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2bc8fb3..74f5d64 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,112 +25,112 @@ concurrency: cancel-in-progress: true jobs: - # build_primary_binaries: - # name: Primary build ${{ matrix.binary }} for ${{ matrix.rust-target }} on (${{ matrix.os }}) - # runs-on: ${{ matrix.os }} - # strategy: - # matrix: - # os: [ ubuntu-22.04 ] - # rust: [ stable ] - # binary: [ release ] - # env: - # RUST_BACKTRACE: full - # RUSTV: ${{ matrix.rust }} - # TARGET: ${{ matrix.rust-target }} - # RUST_BIN_DIR: target/${{ matrix.rust-target }}/debug - # RELEASE_NAME: debug - # steps: - # - uses: actions/checkout@v4 - # - name: Install protoc - # run: sudo apt-get install protobuf-compiler - # - # - name: Print env - # run: | - # echo "RUST_BIN_DIR = ${{ env.RUST_BIN_DIR }} " - # - # # With rustup's nice new toml format, we just need to run rustup show to install the toolchain - # # https://github.com/actions-rs/toolchain/issues/126#issuecomment-782989659 - # - name: Setup Rust toolchain - # run: rustup show - # - # - uses: Swatinem/rust-cache@v2 - # with: - # key: ${{ matrix.os }}-${{ env.RUST_BIN_DIR }}-${{ matrix.binary }} - # - # - name: Release - # if: ${{ matrix.binary == 'release' }} - # run: cargo build --locked --release - # - # # Upload artifacts - # - name: Upload encointer-collator - # uses: actions/upload-artifact@v4 - # with: - # name: encointer-collator-${{ github.sha }} - # path: target/release/encointer-collator - # - # cargo-toml-fmt: - # runs-on: ubuntu-22.04 - # container: "tamasfe/taplo:0.7.0-alpine" - # steps: - # - uses: actions/checkout@v4 - # - # - name: Run Taplo fmt - # run: taplo fmt --check - # - # - name: Fail-fast; cancel other jobs - # if: failure() - # uses: andymckay/cancel-action@0.2 - # - # create_artifacts: - # needs: [ build_primary_binaries ] - # runs-on: ubuntu-22.04 - # env: - # CHAIN_SPEC: ${{ matrix.chain }}-${{ matrix.config }} - # strategy: - # fail-fast: false - # matrix: - # chain: [ encointer ] - # config: [ rococo, westend, kusama ] - # steps: - # - name: Checkout - # uses: actions/checkout@v4 - # - # - uses: actions/download-artifact@v4 - # with: - # name: encointer-collator-${{ github.sha }} - # - # - name: 'Create binaries for artifacts' - # # The build-spec cmd does not create a deterministic key order in the produced json. Hence, we sort the keys - # # before we use it to deterministically create the state. - # run: | - # chmod +x ./encointer-collator - # ./encointer-collator build-spec --chain ${{ env.CHAIN_SPEC }} --disable-default-bootnode --raw > ${{ env.CHAIN_SPEC }}-unsorted.json - # jq --sort-keys . ${{ env.CHAIN_SPEC }}-unsorted.json > ${{ env.CHAIN_SPEC }}.json - # ./encointer-collator export-genesis-state --chain ${{ env.CHAIN_SPEC }}.json > ${{ env.CHAIN_SPEC }}.json.state - # ./encointer-collator export-genesis-state --chain ${{ env.CHAIN_SPEC }} > ${{ env.CHAIN_SPEC }}.state - # - # - name: Compute file metadata - # id: vars - # run: | - # sha256sum ${{ env.CHAIN_SPEC }}.state >> checksums.txt - # sha256sum ${{ env.CHAIN_SPEC }}.json >> checksums.txt - # sha256sum ${{ env.CHAIN_SPEC }}.json.state >> checksums.txt - # - # - name: Upload ${{ env.CHAIN_SPEC }} Files - # uses: actions/upload-artifact@v4 - # with: - # name: ${{ env.CHAIN_SPEC }}-genesis-spec-${{ github.sha }} - # path: | - # checksums.txt - # ${{ env.CHAIN_SPEC }}.state - # ${{ env.CHAIN_SPEC }}.json - # ${{ env.CHAIN_SPEC }}.json.state + build_primary_binaries: + name: Primary build ${{ matrix.binary }} for ${{ matrix.rust-target }} on (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-22.04 ] + rust: [ stable ] + binary: [ release ] + env: + RUST_BACKTRACE: full + RUSTV: ${{ matrix.rust }} + TARGET: ${{ matrix.rust-target }} + RUST_BIN_DIR: target/${{ matrix.rust-target }}/debug + RELEASE_NAME: debug + steps: + - uses: actions/checkout@v4 + - name: Install protoc + run: sudo apt-get install protobuf-compiler + + - name: Print env + run: | + echo "RUST_BIN_DIR = ${{ env.RUST_BIN_DIR }} " + + # With rustup's nice new toml format, we just need to run rustup show to install the toolchain + # https://github.com/actions-rs/toolchain/issues/126#issuecomment-782989659 + - name: Setup Rust toolchain + run: rustup show + + - uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.os }}-${{ env.RUST_BIN_DIR }}-${{ matrix.binary }} + + - name: Release + if: ${{ matrix.binary == 'release' }} + run: cargo build --locked --release + + # Upload artifacts + - name: Upload encointer-collator + uses: actions/upload-artifact@v4 + with: + name: encointer-collator-${{ github.sha }} + path: target/release/encointer-collator + + cargo-toml-fmt: + runs-on: ubuntu-22.04 + container: "tamasfe/taplo:0.7.0-alpine" + steps: + - uses: actions/checkout@v4 + + - name: Run Taplo fmt + run: taplo fmt --check + + - name: Fail-fast; cancel other jobs + if: failure() + uses: andymckay/cancel-action@0.2 + + create_artifacts: + needs: [ build_primary_binaries ] + runs-on: ubuntu-22.04 + env: + CHAIN_SPEC: ${{ matrix.chain }}-${{ matrix.config }} + strategy: + fail-fast: false + matrix: + chain: [ encointer ] + config: [ rococo, westend, kusama ] + steps: + - name: Checkout + uses: actions/checkout@v4 + + - uses: actions/download-artifact@v4 + with: + name: encointer-collator-${{ github.sha }} + + - name: 'Create binaries for artifacts' + # The build-spec cmd does not create a deterministic key order in the produced json. Hence, we sort the keys + # before we use it to deterministically create the state. + run: | + chmod +x ./encointer-collator + ./encointer-collator build-spec --chain ${{ env.CHAIN_SPEC }} --disable-default-bootnode --raw > ${{ env.CHAIN_SPEC }}-unsorted.json + jq --sort-keys . ${{ env.CHAIN_SPEC }}-unsorted.json > ${{ env.CHAIN_SPEC }}.json + ./encointer-collator export-genesis-state --chain ${{ env.CHAIN_SPEC }}.json > ${{ env.CHAIN_SPEC }}.json.state + ./encointer-collator export-genesis-state --chain ${{ env.CHAIN_SPEC }} > ${{ env.CHAIN_SPEC }}.state + + - name: Compute file metadata + id: vars + run: | + sha256sum ${{ env.CHAIN_SPEC }}.state >> checksums.txt + sha256sum ${{ env.CHAIN_SPEC }}.json >> checksums.txt + sha256sum ${{ env.CHAIN_SPEC }}.json.state >> checksums.txt + + - name: Upload ${{ env.CHAIN_SPEC }} Files + uses: actions/upload-artifact@v4 + with: + name: ${{ env.CHAIN_SPEC }}-genesis-spec-${{ github.sha }} + path: | + checksums.txt + ${{ env.CHAIN_SPEC }}.state + ${{ env.CHAIN_SPEC }}.json + ${{ env.CHAIN_SPEC }}.json.state integration-test: # name: ${{ matrix.test }} name: integration-test runs-on: ubuntu-22.04 - # needs: build_primary_binaries + needs: build_primary_binaries strategy: fail-fast: false matrix: @@ -181,11 +181,11 @@ jobs: - name: Download Encointer Collator uses: actions/download-artifact@v4 with: - # name: encointer-collator-${{ github.sha }} + name: encointer-collator-${{ github.sha }} # for debugging the integration tests, we can just download an image from a previous run - name: encointer-collator-859e7ba3e64e971a91b1174a4d9423bb854be9d9 - github-token: ${{ github.token }} - run-id: 12904591738 + # name: encointer-collator-859e7ba3e64e971a91b1174a4d9423bb854be9d9 + # github-token: ${{ github.token }} + # run-id: 12904591738 - name: fix permissions of artifacts and move to test directory run: | @@ -226,41 +226,41 @@ jobs: --port 9944 \ -# release: -# name: Draft Release -# if: startsWith(github.ref, 'refs/tags/') -# runs-on: ubuntu-latest -# needs: [ create_artifacts, build_primary_binaries ] -# outputs: -# release_url: ${{ steps.create-release.outputs.html_url }} -# asset_upload_url: ${{ steps.create-release.outputs.upload_url }} -# steps: -# - uses: actions/checkout@v4 -# -# - name: Download Encointer Collator -# uses: actions/download-artifact@v4 -# with: -# name: encointer-collator-${{ github.sha }} -# -# - name: Create required package.json -# run: test -f package.json || echo '{}' >package.json -# -# - name: Changelog -# uses: scottbrenner/generate-changelog-action@master -# id: Changelog -# -# - name: Display structure of downloaded files -# run: ls -R -# working-directory: . -# -# - name: Release -# id: create-release -# uses: softprops/action-gh-release@v1 -# env: -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -# with: -# body: | -# ${{ steps.Changelog.outputs.changelog }} -# draft: true -# files: | -# encointer-collator + release: + name: Draft Release + if: startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + needs: [ create_artifacts, build_primary_binaries ] + outputs: + release_url: ${{ steps.create-release.outputs.html_url }} + asset_upload_url: ${{ steps.create-release.outputs.upload_url }} + steps: + - uses: actions/checkout@v4 + + - name: Download Encointer Collator + uses: actions/download-artifact@v4 + with: + name: encointer-collator-${{ github.sha }} + + - name: Create required package.json + run: test -f package.json || echo '{}' >package.json + + - name: Changelog + uses: scottbrenner/generate-changelog-action@master + id: Changelog + + - name: Display structure of downloaded files + run: ls -R + working-directory: . + + - name: Release + id: create-release + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + body: | + ${{ steps.Changelog.outputs.changelog }} + draft: true + files: | + encointer-collator