From 084038a1e130d075c6dd995f5f202c39ea5ed652 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20B=C4=83ncioiu?= Date: Fri, 29 Dec 2023 10:05:04 +0200 Subject: [PATCH] Prepare reproducible build. --- .github/workflows/actions.yml | 28 ------- .../on_pull_request_build_contracts.yml | 15 ++++ .github/workflows/release.yml | 81 ------------------- .gitignore | 3 - .../{elrond.json => multiversx.json} | 0 5 files changed, 15 insertions(+), 112 deletions(-) delete mode 100644 .github/workflows/actions.yml create mode 100644 .github/workflows/on_pull_request_build_contracts.yml delete mode 100644 .github/workflows/release.yml rename energy-integration/governance-v2/{elrond.json => multiversx.json} (100%) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml deleted file mode 100644 index bf8c6ee9c..000000000 --- a/.github/workflows/actions.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: CI - -on: - push: - branches: [ main, feat/* ] - pull_request: - branches: [ main, feat/* ] - -permissions: - actions: write - checks: write - contents: write - id-token: write - issues: write - discussions: write - pull-requests: write - statuses: write - -jobs: - contracts: - name: Contracts - uses: ElrondNetwork/elrond-actions/.github/workflows/contracts.yml@v1 - with: - rust-toolchain: nightly-2022-10-16 - vmtools-version: v1.4.60 - extra-build-args: --ignore-eei-checks - secrets: - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/on_pull_request_build_contracts.yml b/.github/workflows/on_pull_request_build_contracts.yml new file mode 100644 index 000000000..32ddf4c4f --- /dev/null +++ b/.github/workflows/on_pull_request_build_contracts.yml @@ -0,0 +1,15 @@ +name: On pull request, build contracts + +on: + pull_request: + +permissions: + contents: write + +jobs: + build: + uses: multiversx/mx-sc-actions/.github/workflows/reproducible-build.yml@v2.3.4 + with: + image_tag: v4.2.1 + package_whole_project_src: true + skip_preliminary_checks: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 34e0c6e32..000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,81 +0,0 @@ -name: Create release - -on: - workflow_dispatch: - inputs: - tag: - required: true - description: Release tag - title: - required: true - description: Release title - image_tag: - type: choice - required: true - description: Image elrondnetwork/build-contract-rust - options: - - v3.1.0 - -permissions: - contents: write - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - ref: ${{ env.GITHUB_REF_NAME }} - fetch-depth: 0 - repository: ${{ env.GITHUB_REPOSITORY }} - - - name: Download build script - run: | - wget https://raw.githubusercontent.com/ElrondNetwork/elrond-sdk-images-build-contract-rust/${{ github.event.inputs.image_tag }}/build_with_docker.py - - - name: Build contract - run: | - python3 ./build_with_docker.py --no-docker-tty --image=elrondnetwork/build-contract-rust:${{ github.event.inputs.image_tag }} --project=. --output=/home/runner/work/output-from-docker - - - name: Save artifacts - uses: actions/upload-artifact@v2 - with: - name: built-contracts - path: | - /home/runner/work/output-from-docker/**/*.wasm - /home/runner/work/output-from-docker/**/*.abi.json - if-no-files-found: error - - release: - needs: [build] - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v2 - with: - fetch-depth: "0" - - - name: Download all workflow artifacts - uses: actions/download-artifact@v2 - with: - path: assets - - - name: Create release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - echo "Built using Docker image: **elrondnetwork/build-contract-rust:${{ github.event.inputs.image_tag }}**." >> notes.txt - echo "" >> notes.txt - echo "## Codehash (blake2b):" >> notes.txt - echo "" >> notes.txt - - for i in $(find ./assets -type f -name *.wasm); do - filename=$(basename ${i}) - checksum=($(b2sum -l 256 ${i})) - echo " - **${filename}**: \`${checksum}\`" >> notes.txt - done - - gh release create ${{ github.event.inputs.tag }} --target=$GITHUB_SHA --prerelease --title="${{ github.event.inputs.title }}" --generate-notes --notes-file=notes.txt - sleep 10 - gh release upload ${{ github.event.inputs.tag }} $(find ./assets -type f) diff --git a/.gitignore b/.gitignore index c69171b0a..2274e755a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,9 +2,6 @@ # will have compiled files and executables **/target/ **/output/ -# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries -# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html -Cargo.lock # These are backup files generated by rustfmt **/*.rs.bk diff --git a/energy-integration/governance-v2/elrond.json b/energy-integration/governance-v2/multiversx.json similarity index 100% rename from energy-integration/governance-v2/elrond.json rename to energy-integration/governance-v2/multiversx.json