ci/cd refactor: on-pr workflow #14
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Placeholder for the PR workflow. | |
name: on-pr | |
on: | |
pull_request: {} | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
pull-requests: write | |
contents: read | |
env: | |
RUST_BACKTRACE: full | |
CONSENSUS_ENCLAVE_CSS: /tmp/consensus-enclave.css | |
INGEST_ENCLAVE_CSS: /tmp/ingest-enclave.css | |
jobs: | |
# lint-actions: | |
# runs-on: mco-dev-small-x64 | |
# steps: | |
# - name: Checkout | |
# uses: mobilecoinofficial/gh-actions/checkout@v0 | |
# - name: Run actionlint with reviewdog | |
# uses: reviewdog/action-actionlint@v1 | |
# with: | |
# level: error | |
# reporter: github-pr-review | |
# lint-helm: | |
# runs-on: mco-dev-small-x64 | |
# container: | |
# image: mobilecoin/gha-k8s-toolbox:v1 | |
# steps: | |
# - name: Checkout | |
# uses: mobilecoinofficial/gh-actions/checkout@v0 | |
# - name: Run helm lint | |
# run: | | |
# chart_base=".internal-ci/helm" | |
# chart_files=$(find "${chart_base}" -name Chart.yaml -type f) | |
# # helm lint on directories where there are chart.yaml files | |
# for c in ${chart_files} | |
# do | |
# chart=$(dirname "${c}") | |
# helm lint --quiet "${chart}" 2>&1 | |
# done | |
# CBB: Need to do refactoring of shell scripts in the repo for this to run cleanly. | |
# lint-shell: | |
# runs-on: mco-dev-small-x64 | |
# steps: | |
# - name: Checkout | |
# uses: mobilecoinofficial/gh-actions/checkout@v0 | |
# - name: Run shellcheck with reviewdog | |
# uses: reviewdog/action-shellcheck@v1 | |
# with: | |
# level: error | |
# reporter: github-pr-review | |
# lint-docker: | |
# runs-on: mco-dev-small-x64 | |
# steps: | |
# - name: Checkout | |
# uses: mobilecoinofficial/gh-actions/checkout@v0 | |
# - name: Install wget | |
# run: | | |
# sudo apt-get update | |
# sudo apt-get install -y wget | |
# - name: Run hadolint with reviewdog | |
# uses: reviewdog/action-hadolint@v1 | |
# with: | |
# level: error | |
# reporter: github-pr-review | |
# exclude: | | |
# *.dockerignore | |
# lint-rust: | |
# runs-on: mco-dev-large-x64 | |
# container: | |
# image: mobilecoin/rust-sgx-base:v0.0.36 | |
# env: | |
# SGX_MODE: SW | |
# steps: | |
# - name: Checkout | |
# uses: mobilecoinofficial/gh-actions/checkout@v0 | |
# - name: Consensus SigStruct | |
# uses: ./.github/actions/download-sigstruct | |
# with: | |
# sigstruct: consensus | |
# network: test | |
# download_path: ${{ env.CONSENSUS_ENCLAVE_CSS }} | |
# - name: Ingest SigStruct | |
# uses: ./.github/actions/download-sigstruct | |
# with: | |
# sigstruct: ingest | |
# network: test | |
# download_path: ${{ env.INGEST_ENCLAVE_CSS }} | |
# - name: Cargo sort | |
# shell: bash | |
# run: | | |
# cargo install cargo-sort --force | |
# cargo sort --workspace --grouped --check | |
# - name: Cargo fmt | |
# shell: bash | |
# run: | | |
# cargo fmt -- --unstable-features --check | |
# - name: Cargo Clippy | |
# shell: bash | |
# run: | | |
# cargo clippy --all --all-features | |
# test-rust: | |
# runs-on: mco-dev-large-x64 | |
# container: | |
# image: mobilecoin/rust-sgx-base:v0.0.36 | |
# env: | |
# SGX_MODE: SW | |
# steps: | |
# - name: Checkout | |
# uses: mobilecoinofficial/gh-actions/checkout@v0 | |
# - name: Consensus SigStruct | |
# uses: ./.github/actions/download-sigstruct | |
# with: | |
# sigstruct: consensus | |
# network: test | |
# download_path: ${{ env.CONSENSUS_ENCLAVE_CSS }} | |
# - name: Ingest SigStruct | |
# uses: ./.github/actions/download-sigstruct | |
# with: | |
# sigstruct: ingest | |
# network: test | |
# download_path: ${{ env.INGEST_ENCLAVE_CSS }} | |
# - name: Cargo Test | |
# shell: bash | |
# env: | |
# CARGO_INCREMENTAL: "0" | |
# RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests" | |
# RUSTDOCFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests" | |
# run: | | |
# cargo test | |
# skip coverage for now, old actions-rs/grcov is deprecated | |
# need to learn how to generate .xml reports for codecov below | |
# - name: grcov | |
# shell: bash | |
# run: | | |
# cargo install grcov | |
# - name: Codecov | |
# uses: codecov/codecov-action@v3.1.4 | |
# with: | |
# files: ${{ steps.coverage.outputs.report }} | |
# verbose: true | |
# fail_ci_if_error: true | |
# env: | |
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
# build-rust-linux: | |
# strategy: | |
# matrix: | |
# runner: | |
# - mco-dev-large-x64 | |
# network: | |
# - main | |
# - test | |
# runs-on: ${{ matrix.runner }} | |
# container: | |
# image: mobilecoin/rust-sgx-base:v0.0.36 | |
# steps: | |
# - name: Checkout | |
# uses: mobilecoinofficial/gh-actions/checkout@v0 | |
# - name: Build Rust | |
# uses: ./.github/actions/build-rust | |
# with: | |
# network: ${{ matrix.network }} | |
build-rust-macos: | |
strategy: | |
fail-fast: false | |
matrix: | |
runner: | |
# - [self-hosted, macOS, X64] | |
- [self-hosted, macOS, ARM64] | |
network: | |
# - main | |
- test | |
runs-on: ${{ matrix.runner }} | |
steps: | |
- name: Checkout | |
uses: mobilecoinofficial/gh-actions/checkout@v0 | |
- name: Bootstrap macOS | |
shell: bash | |
run: | | |
echo "-- remove existing rust installation" | |
rm -rf /Users/runner/.cargo | |
rm -rf /Users/runner/.rustup | |
echo "-- install brew dependencies" | |
brew bundle | |
echo "-- install rustup" | |
brew install rustup | |
echo "-- install rust toolchain" | |
rustup toolchain install "$(cat rust-toolchain)" | |
rustup default "$(cat rust-toolchain)" | |
echo "-- show rustup details" | |
rustup show | |
cargo=$(rustup which cargo) | |
echo "-- add cargo to path" | |
echo "CARGO_HOME=${HOME}/.cargo" >> "${GITHUB_ENV}" | |
echo "RUSTUP_HOME=${HOME}/.rustup" >> "${GITHUB_ENV}" | |
echo "${HOME}/.cargo/bin" >> "${GITHUB_PATH}" | |
echo "$(dirname "${cargo}")" >> "${GITHUB_PATH}" | |
- name: Build Rust | |
uses: ./.github/actions/build-rust | |
with: | |
network: ${{ matrix.network }} | |
# build binaries: | |
# testnet, mainnet | |
# linux amd64 arm64 | |
# macos intel, apple | |
# containers: | |
# linux arm64, amd64 | |
# test: | |
# lint | |
# docker (hadolint) | |
# shellcheck | |
# actionlint | |
# helm lint | |
# rust/cargo fmt | |
# rust/cargo clippy | |
# rust/cargo sort | |
# unit | |
# integration - testnet, mainnet |