Skip to content

Commit

Permalink
Merge branch 'release/v2.1.2' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
briancorbin committed Dec 5, 2022
2 parents fefe6f6 + 36a36b3 commit 075b637
Show file tree
Hide file tree
Showing 74 changed files with 2,281 additions and 418 deletions.
6 changes: 0 additions & 6 deletions .dockerignore

This file was deleted.

7 changes: 7 additions & 0 deletions .github/actionlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
self-hosted-runner:
# Labels of self-hosted runner in array of string
labels:
- small
- large
- large-cd
- cargo
31 changes: 31 additions & 0 deletions .github/actions/mobilecoin-cache-cargo-package/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Mobilecoin Cargo Package Cache
description: Standardized rust cargo package cache setup

inputs:
cache_buster:
description: "string to make cache unique"
required: false
path:
description: "path to mount cache"
required: false
default: |
/opt/cargo/git
/opt/cargo/registry/index
/opt/cargo/registry/cache
outputs:
cache-hit:
description: "did we get a cache hit?"
value: ${{ steps.rust_artifact_cache.outputs.cache-hit }}

runs:
using: composite
steps:
- name: Cache rust build binaries
id: rust_artifact_cache
uses: actions/cache@v3
with:
path: ${{ inputs.path }}
# Key is a hash of all the Cargo.toml and Cargo.lock files.
# if packages change, invalidate cache and rebuild
key: ${{ inputs.cache_buster }}-${{ runner.os }}-${{ hashFiles('**/Cargo.toml', '**/Cargo.lock') }}-cargo-cache
29 changes: 29 additions & 0 deletions .github/actions/mobilecoin-cache-rust-binaries/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Mobilecoin Rust Binary Cache
description: Standardized rust binary cache setup

inputs:
cache_buster:
description: "string to make cache unique"
required: false
path:
description: "path to mount cache"
required: false
default: |
rust_build_artifacts
outputs:
cache-hit:
description: "did we get a cache hit?"
value: ${{ steps.rust_artifact_cache.outputs.cache-hit }}

runs:
using: composite
steps:
- name: Cache rust build binaries
id: rust_artifact_cache
uses: actions/cache@v3
with:
path: ${{ inputs.path }}
# Key is a hash of all the .rs, .proto and Cargo.toml files.
# if code changes, invalidate cache and rebuild
key: ${{ inputs.cache_buster }}-${{ runner.os }}-${{ hashFiles('**/*.rs', '**/*.proto', '**/Cargo.toml', '**/*.edl', '.cargo/config') }}-rust-build-artifacts
8 changes: 6 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Soundtrack of this PR: [link to song that really fits the mood of this PR]()

### Motivation

< The motivation for the changes in this PR. "Currently we...", "This is needed because..." >
Expand All @@ -9,6 +7,12 @@ Soundtrack of this PR: [link to song that really fits the mood of this PR]()

< Ticket status, e.g. "fixes #issue number" >

### Test Plan

< How to run the unit test, e2e test etc. >
< Or what are the actual request/response might look like (like grpcurl) >


### Future Work
* < Out of scope non-goals for this PR >
* < These should be links to tickets. If the tickets do not exist, make them. >
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ jobs:
namespace: [test, prod]
include:
- runner-tags: [self-hosted, macOS, X64, cargo]
container: null
container: ""
- runner-tags: [self-hosted, macOS, ARM64, cargo]
container: null
container: ""
- runner-tags: [self-hosted, Linux, large]
container: mobilecoin/rust-sgx-base:latest
- namespace: test
Expand Down Expand Up @@ -97,4 +97,4 @@ jobs:
draft: true
prerelease: true
files: |
release/${{ github.ref_name }}-${{ runner.os }}-${{ runner.arch }}-${{ matrix.network }}.tar.gz
release/${{ github.ref_name }}-${{ runner.os }}-${{ runner.arch }}-${{ matrix.network }}.tar.gz
73 changes: 35 additions & 38 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,53 +6,60 @@ env:
RUST_BACKTRACE: full
CONSENSUS_ENCLAVE_CSS: /var/tmp/consensus-enclave.css
INGEST_ENCLAVE_CSS: /var/tmp/ingest-enclave.css
CSS_BASE_URL: https://enclave-distribution.test.mobilecoin.com

on:
pull_request:
branches:
- develop
- main
push:
branches:
- main
- develop

concurrency:
group: full-service-ci-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: [self-hosted, Linux, large]
container:
image: mobilecoin/rust-sgx-base:latest

image: mobilecoin/rust-sgx-base:v0.0.20
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive

- name: Cache Cargo
if: steps.artifact_cache.outputs.cache-hit != 'true'
id: cargo_cache
uses: actions/cache@v3
- name: Cache cargo packages
uses: ./.github/actions/mobilecoin-cache-cargo-package
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') }}
cache_buster: ${{ secrets.CACHE_BUSTER }}

- name: Consensus SigStruct
if: steps.artifact_cache.outputs.cache-hit != 'true'
run: |
CONSENSUS_SIGSTRUCT_URI=$(curl -s https://enclave-distribution.test.mobilecoin.com/production.json | grep consensus-enclave.css | awk '{print $2}' | tr -d \" | tr -d ,)
(cd /var/tmp && curl -O https://enclave-distribution.test.mobilecoin.com/${CONSENSUS_SIGSTRUCT_URI})
SIGSTRUCT_URI=$(curl -fsSL ${CSS_BASE_URL}/production.json | jq -r .consensus.sigstruct)
curl -fL --retry 3 "${CSS_BASE_URL}/${SIGSTRUCT_URI}" -o "${CONSENSUS_ENCLAVE_CSS}"
- name: Ingest SigStruct
if: steps.artifact_cache.outputs.cache-hit != 'true'
run: |
INGEST_SIGSTRUCT_URI=$(curl -s https://enclave-distribution.test.mobilecoin.com/production.json | grep ingest-enclave.css | awk '{print $2}' | tr -d \" | tr -d ,)
(cd /var/tmp && curl -O https://enclave-distribution.test.mobilecoin.com/${INGEST_SIGSTRUCT_URI})
SIGSTRUCT_URI=$(curl -fsSL ${CSS_BASE_URL}/production.json | jq -r .ingest.sigstruct)
curl -fL --retry 3 "${CSS_BASE_URL}/${SIGSTRUCT_URI}" -o "${INGEST_ENCLAVE_CSS}"
- name: Cargo sort
run: |
cargo install cargo-sort --force
cargo sort --workspace --grouped --check
- name: Cargo fmt
run: |
cargo fmt -- --unstable-features --check
- name: Cargo Clippy
run: |
cargo clippy
cargo clippy --all --all-features
test:
runs-on: [self-hosted, Linux, large]
Expand All @@ -65,30 +72,20 @@ jobs:
with:
submodules: recursive

- name: Cache Cargo
if: steps.artifact_cache.outputs.cache-hit != 'true'
id: cargo_cache
uses: actions/cache@v3
- name: Cache cargo packages
uses: ./.github/actions/mobilecoin-cache-cargo-package
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') }}
cache_buster: ${{ secrets.CACHE_BUSTER }}

- name: Consensus SigStruct
if: steps.artifact_cache.outputs.cache-hit != 'true'
run: |
CONSENSUS_SIGSTRUCT_URI=$(curl -s https://enclave-distribution.test.mobilecoin.com/production.json | grep consensus-enclave.css | awk '{print $2}' | tr -d \" | tr -d ,)
(cd /var/tmp && curl -O https://enclave-distribution.test.mobilecoin.com/${CONSENSUS_SIGSTRUCT_URI})
SIGSTRUCT_URI=$(curl -fsSL ${CSS_BASE_URL}/production.json | jq -r .consensus.sigstruct)
curl -fL --retry 3 "${CSS_BASE_URL}/${SIGSTRUCT_URI}" -o "${CONSENSUS_ENCLAVE_CSS}"
- name: Ingest SigStruct
if: steps.artifact_cache.outputs.cache-hit != 'true'
run: |
INGEST_SIGSTRUCT_URI=$(curl -s https://enclave-distribution.test.mobilecoin.com/production.json | grep ingest-enclave.css | awk '{print $2}' | tr -d \" | tr -d ,)
(cd /var/tmp && curl -O https://enclave-distribution.test.mobilecoin.com/${INGEST_SIGSTRUCT_URI})
SIGSTRUCT_URI=$(curl -fsSL ${CSS_BASE_URL}/production.json | jq -r .ingest.sigstruct)
curl -fL --retry 3 "${CSS_BASE_URL}/${SIGSTRUCT_URI}" -o "${INGEST_ENCLAVE_CSS}"
- uses: actions-rs/toolchain@v1
with:
Expand All @@ -115,4 +112,4 @@ jobs:
verbose: true
fail_ci_if_error: true
env:
CODECOV_TOKEN: 5be757b6-e923-40f2-80ea-5deac1e02b1e
CODECOV_TOKEN: 5be757b6-e923-40f2-80ea-5deac1e02b1e
Loading

0 comments on commit 075b637

Please sign in to comment.