Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update actions to include ARM64 build (M1 Mac) #351

Merged
merged 13 commits into from
Jun 6, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -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:
- "*"
128 changes: 117 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -49,7 +49,7 @@ 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: Cache Cargo
if: steps.artifact_cache.outputs.cache-hit != 'true'
Expand All @@ -62,7 +62,7 @@ jobs:
/opt/cargo/registry/cache/
/opt/cargo/git/db/
target/
key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-cargo-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-x86-${{ secrets.CACHE_VERSION }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Consensus SigStruct
if: steps.artifact_cache.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -92,24 +92,24 @@ 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 }}-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 }}
path: artifact/${{ github.sha }}-${{ runner.os }}-${{ matrix.network }}.tar.gz
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 }}-${{ matrix.network }}.tar.gz -C ../build_artifacts/${{ matrix.network }}/ .
cd release && tar -czvf ${{ github.ref_name }}-${{ runner.os }}-x86-${{ 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 && md5sum ${{ github.ref_name }}-${{ runner.os }}-x86-${{ matrix.network }}.tar.gz > ${{ github.ref_name }}-${{ runner.os }}-x86-${{ matrix.network }}.md5

- name: Upload Release
if: startsWith(github.ref, 'refs/tags/v')
Expand All @@ -118,8 +118,114 @@ 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 }}-x86-${{ matrix.network }}.tar.gz
release/${{ github.ref_name }}-${{ runner.os }}-x86-${{ matrix.network }}.md5

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: |
build_artifacts
key: ${{ runner.os }}-arm64-${{ 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 }}-arm64-${{ secrets.CACHE_VERSION }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- 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: Ingest SigStruct
if: steps.artifact_cache.outputs.cache-hit != 'true'
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 }}-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 }}-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 }}-arm64-${{ 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 }}-arm64-${{ matrix.network }}.tar.gz > ${{ github.ref_name }}-${{ runner.os }}-arm64-${{ matrix.network }}.md5

- 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 }}-arm64-${{ matrix.network }}.tar.gz
release/${{ github.ref_name }}-${{ runner.os }}-arm64-${{ matrix.network }}.md5

linux:
runs-on: [self-hosted, Linux, large]
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
tags:
- 'v*'
- '!v*-pre*'
- '*-force-release'
- '*-force-release*'

jobs:
release:
Expand All @@ -25,10 +25,16 @@ jobs:
os: Linux
- namespace: prod
network: testnet
os: macOS
os: macOS-x86
- namespace: prod
network: mainnet
os: macOS
os: macOS-x86
- namespace: prod
network: testnet
os: macOS-arm64
- namespace: prod
network: mainnet
os: macOS-arm64

steps:
- name: Get Current Pre-Release
Expand Down