diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 000000000..fc89f45b3 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,24 @@ +# .github/release.yml + +changelog: + exclude: + labels: + - ignore for release + authors: + - octocat + categories: + - title: Breaking Changes 🛠 + labels: + - Semver-Major + - breaking change + - title: Exciting New Features ✨ + labels: + - Semver-Minor + - enhancement + - title: Bug Fixes 🐛 + labels: + - Semver-Patch + - bug + - title: Other Changes + labels: + - "*" \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c8e88321f..422fd52b4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,11 +12,11 @@ on: push: tags: - 'v*-pre.*' - - '*-force-build' + - '*-force-build*' jobs: - macos: - runs-on: [self-hosted, macOS] + macos-x64: + runs-on: [self-hosted, macOS, X64] permissions: contents: write strategy: @@ -49,20 +49,94 @@ jobs: with: path: | build_artifacts - key: ${{ runner.os }}-${{ matrix.network }}-${{ secrets.CACHE_VERSION }}-build-cargo-artifacts-${{ hashFiles('**/*.rs', '**/*.proto', '**/Cargo.toml')}} + key: ${{ runner.os }}-x86-${{ matrix.network }}-${{ secrets.CACHE_VERSION }}-build-cargo-artifacts-${{ hashFiles('**/*.rs', '**/*.proto', '**/Cargo.toml')}} + + - name: Consensus SigStruct + if: steps.artifact_cache.outputs.cache-hit != 'true' + run: | + CONSENSUS_SIGSTRUCT_URI=$(curl -s https://enclave-distribution.${{ matrix.namespace }}.mobilecoin.com/production.json | grep consensus-enclave.css | awk '{print $2}' | tr -d \" | tr -d ,) + (cd /var/tmp && curl -O https://enclave-distribution.${{ matrix.namespace }}.mobilecoin.com/${CONSENSUS_SIGSTRUCT_URI}) - - name: Cache Cargo + - name: Ingest SigStruct if: steps.artifact_cache.outputs.cache-hit != 'true' - id: cargo_cache + run: | + INGEST_SIGSTRUCT_URI=$(curl -s https://enclave-distribution.${{ matrix.namespace }}.mobilecoin.com/production.json | grep ingest-enclave.css | awk '{print $2}' | tr -d \" | tr -d ,) + (cd /var/tmp && curl -O https://enclave-distribution.${{ matrix.namespace }}.mobilecoin.com/${INGEST_SIGSTRUCT_URI}) + + - name: Cargo Build + if: steps.artifact_cache.outputs.cache-hit != 'true' + run: | + cargo build --release + + - name: Copy binaries to cache folder + if: steps.artifact_cache.outputs.cache-hit != 'true' + run: | + mkdir -pv build_artifacts/${{ matrix.network }}/bin + cp /var/tmp/*.css build_artifacts/${{ matrix.network }} + cp target/release/full-service build_artifacts/${{ matrix.network }}/bin/ + cp target/release/transaction-signer build_artifacts/${{ matrix.network }}/bin/ + + - name: Create Artifact + run: | + mkdir -pv artifact + cd artifact && tar -czvf ${{ github.sha }}-${{ runner.os }}-x86-${{ matrix.network }}.tar.gz -C ../build_artifacts/${{ matrix.network }}/ . + + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: + name: full-service_${{ runner.os }}_${{ matrix.network }}_x86 + path: artifact/${{ github.sha }}-${{ runner.os }}-x86-${{ matrix.network }}.tar.gz + + - name: Create Release + if: startsWith(github.ref, 'refs/tags/v') + run: | + mkdir -pv release + cd release && tar -czvf ${{ github.ref_name }}-${{ runner.os }}-x86-${{ matrix.network }}.tar.gz -C ../build_artifacts/${{ matrix.network }}/ . + + - name: Upload Release + if: startsWith(github.ref, 'refs/tags/v') + uses: softprops/action-gh-release@v1 + with: + draft: true + prerelease: true + files: | + release/${{ github.ref_name }}-${{ runner.os }}-x86-${{ matrix.network }}.tar.gz + + macos-arm64: + runs-on: [self-hosted, macOS, ARM64] + permissions: + contents: write + strategy: + matrix: + include: + - namespace: test + network: testnet + - namespace: prod + network: mainnet + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Brew Bundle + run: | + brew update --preinstall + brew bundle --no-upgrade + + - name: Git Submodule + run: | + git submodule update --checkout --init --recursive + + # CACHE_VERSION secret is 'date --iso-8601=minutes' and is used to invalidate cache if needed + - name: Cache Build Binaries + id: artifact_cache uses: actions/cache@v3 with: path: | - /opt/cargo/bin/ - /opt/cargo/registry/index/ - /opt/cargo/registry/cache/ - /opt/cargo/git/db/ - target/ - key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-cargo-${{ hashFiles('**/Cargo.lock') }} + build_artifacts + key: ${{ runner.os }}-arm64-${{ matrix.network }}-${{ secrets.CACHE_VERSION }}-build-cargo-artifacts-${{ hashFiles('**/*.rs', '**/*.proto', '**/Cargo.toml')}} - name: Consensus SigStruct if: steps.artifact_cache.outputs.cache-hit != 'true' @@ -92,24 +166,19 @@ jobs: - name: Create Artifact run: | mkdir -pv artifact - cd artifact && tar -czvf ${{ github.sha }}-${{ runner.os }}-${{ matrix.network }}.tar.gz -C ../build_artifacts/${{ matrix.network }}/ . + cd artifact && tar -czvf ${{ github.sha }}-${{ runner.os }}-arm64-${{ matrix.network }}.tar.gz -C ../build_artifacts/${{ matrix.network }}/ . - name: Upload Artifact uses: actions/upload-artifact@v3 with: - name: full-service_${{ runner.os }}_${{ matrix.network }} - path: artifact/${{ github.sha }}-${{ runner.os }}-${{ matrix.network }}.tar.gz + name: full-service_${{ runner.os }}_${{ matrix.network }}_arm64 + path: artifact/${{ github.sha }}-${{ runner.os }}-arm64-${{ matrix.network }}.tar.gz - name: Create Release if: startsWith(github.ref, 'refs/tags/v') run: | mkdir -pv release - cd release && tar -czvf ${{ github.ref_name }}-${{ runner.os }}-${{ matrix.network }}.tar.gz -C ../build_artifacts/${{ matrix.network }}/ . - - - name: Generate MD5 - if: startsWith(github.ref, 'refs/tags/v') - run: | - cd release && md5sum ${{ github.ref_name }}-${{ runner.os }}-${{ matrix.network }}.tar.gz > ${{ github.ref_name }}-${{ runner.os }}-${{ matrix.network }}.md5 + cd release && tar -czvf ${{ github.ref_name }}-${{ runner.os }}-arm64-${{ matrix.network }}.tar.gz -C ../build_artifacts/${{ matrix.network }}/ . - name: Upload Release if: startsWith(github.ref, 'refs/tags/v') @@ -118,8 +187,7 @@ jobs: draft: true prerelease: true files: | - release/${{ github.ref_name }}-${{ runner.os }}-${{ matrix.network }}.tar.gz - release/${{ github.ref_name }}-${{ runner.os }}-${{ matrix.network }}.md5 + release/${{ github.ref_name }}-${{ runner.os }}-arm64-${{ matrix.network }}.tar.gz linux: runs-on: [self-hosted, Linux, large] @@ -150,19 +218,6 @@ jobs: build_artifacts key: ${{ runner.os }}-${{ matrix.network }}-${{ secrets.CACHE_VERSION }}-build-cargo-artifacts-${{ hashFiles('**/*.rs', '**/*.proto', '**/Cargo.toml')}} - - name: Cache Cargo - if: steps.artifact_cache.outputs.cache-hit != 'true' - id: cargo_cache - uses: actions/cache@v3 - with: - path: | - /opt/cargo/bin/ - /opt/cargo/registry/index/ - /opt/cargo/registry/cache/ - /opt/cargo/git/db/ - target/ - key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Consensus SigStruct if: steps.artifact_cache.outputs.cache-hit != 'true' run: | @@ -205,11 +260,6 @@ jobs: mkdir -pv release cd release && tar -czvf ${{ github.ref_name }}-${{ runner.os }}-${{ matrix.network }}.tar.gz -C ../build_artifacts/${{ matrix.network }}/ . - - name: Generate MD5 - if: startsWith(github.ref, 'refs/tags/v') - run: | - cd release && md5sum ${{ github.ref_name }}-${{ runner.os }}-${{ matrix.network }}.tar.gz > ${{ github.ref_name }}-${{ runner.os }}-${{ matrix.network }}.md5 - - name: Upload Release if: startsWith(github.ref, 'refs/tags/v') uses: softprops/action-gh-release@v1 @@ -218,4 +268,3 @@ jobs: prerelease: true files: | release/${{ github.ref_name }}-${{ runner.os }}-${{ matrix.network }}.tar.gz - release/${{ github.ref_name }}-${{ runner.os }}-${{ matrix.network }}.md5 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9c320059b..db7733872 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,7 @@ on: tags: - 'v*' - '!v*-pre*' - - '*-force-release' + - '*-force-release*' jobs: release: @@ -14,21 +14,6 @@ jobs: # Needs write permission for publishing release permissions: contents: write - strategy: - matrix: - include: - - namespace: test - network: testnet - os: Linux - - namespace: prod - network: mainnet - os: Linux - - namespace: prod - network: testnet - os: macOS - - namespace: prod - network: mainnet - os: macOS steps: - name: Get Current Pre-Release @@ -46,25 +31,41 @@ jobs: with: tag: ${{ steps.current_release.outputs.tag_name }} files: | - ${{ steps.current_release.outputs.tag_name }}-${{ matrix.os }}-${{ matrix.network }}.tar.gz - target: /var/tmp/${{ steps.current_release.outputs.tag_name }}-${{ matrix.os }}-${{ matrix.network }}.tar.gz + ${{ steps.current_release.outputs.tag_name }}-Linux-testnet.tar.gz + ${{ steps.current_release.outputs.tag_name }}-Linux-mainnet.tar.gz + ${{ steps.current_release.outputs.tag_name }}-macOS-x86-testnet.tar.gz + ${{ steps.current_release.outputs.tag_name }}-macOS-x86-mainnet.tar.gz + ${{ steps.current_release.outputs.tag_name }}-macOS-arm64-testnet.tar.gz + ${{ steps.current_release.outputs.tag_name }}-macOS-arm64-mainnet.tar.gz + target: /var/tmp/ - name: Extract Release run: | - rm -rfv build_artifacts/${{ matrix.network }} - mkdir -pv build_artifacts/${{ matrix.network }} - tar xzvf /var/tmp/${{ steps.current_release.outputs.tag_name }}-${{ matrix.os }}-${{ matrix.network }}.tar.gz -C build_artifacts/${{ matrix.network }} + rm -rfv build_artifacts + mkdir -pv build_artifacts/Linux-testnet + mkdir -pv build_artifacts/Linux-mainnet + mkdir -pv build_artifacts/macOS-x86-testnet + mkdir -pv build_artifacts/macOS-x86-mainnet + mkdir -pv build_artifacts/macOS-arm64-testnet + mkdir -pv build_artifacts/macOS-arm64-mainnet + tar xzvf /var/tmp/${{ steps.current_release.outputs.tag_name }}-Linux-testnet.tar.gz -C build_artifacts/Linux-testnet + tar xzvf /var/tmp/${{ steps.current_release.outputs.tag_name }}-Linux-mainnet.tar.gz -C build_artifacts/Linux-mainnet + tar xzvf /var/tmp/${{ steps.current_release.outputs.tag_name }}-macOS-x86-testnet.tar.gz -C build_artifacts/macOS-x86-testnet + tar xzvf /var/tmp/${{ steps.current_release.outputs.tag_name }}-macOS-x86-mainnet.tar.gz -C build_artifacts/macOS-x86-mainnet + tar xzvf /var/tmp/${{ steps.current_release.outputs.tag_name }}-macOS-arm64-testnet.tar.gz -C build_artifacts/macOS-arm64-testnet + tar xzvf /var/tmp/${{ steps.current_release.outputs.tag_name }}-macOS-arm64-mainnet.tar.gz -C build_artifacts/macOS-arm64-mainnet - name: Create Release if: startsWith(github.ref, 'refs/tags/v') run: | mkdir -pv release - cd release && tar -czvf ${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.network }}.tar.gz -C ../build_artifacts/${{ matrix.network }}/ . - - - name: Generate MD5 - if: startsWith(github.ref, 'refs/tags/v') - run: | - cd release && md5sum ${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.network }}.tar.gz > ${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.network }}.md5 + cd release + tar -czvf ${{ github.ref_name }}-Linux-testnet.tar.gz -C ../build_artifacts/Linux-testnet/ . + tar -czvf ${{ github.ref_name }}-Linux-mainnet.tar.gz -C ../build_artifacts/Linux-mainnet/ . + tar -czvf ${{ github.ref_name }}-macOS-x86-testnet.tar.gz -C ../build_artifacts/macOS-x86-testnet/ . + tar -czvf ${{ github.ref_name }}-macOS-x86-mainnet.tar.gz -C ../build_artifacts/macOS-x86-mainnet/ . + tar -czvf ${{ github.ref_name }}-macOS-arm64-testnet.tar.gz -C ../build_artifacts/macOS-arm64-testnet/ . + tar -czvf ${{ github.ref_name }}-macOS-arm64-mainnet.tar.gz -C ../build_artifacts/macOS-arm64-mainnet/ . - name: Upload Release if: startsWith(github.ref, 'refs/tags/v') @@ -73,5 +74,4 @@ jobs: draft: true prerelease: ${{ steps.prerelease.outputs.value }} files: | - release/${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.network }}.tar.gz - release/${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.network }}.md5 + release/* \ No newline at end of file