Skip to content

Commit

Permalink
Merge pull request #2772 from iron-fish/staging
Browse files Browse the repository at this point in the history
STAGING -> MASTER
  • Loading branch information
dguenther committed Dec 20, 2022
2 parents 22e9f8c + 01dc8f3 commit 38d2528
Show file tree
Hide file tree
Showing 373 changed files with 21,774 additions and 22,616 deletions.
71 changes: 14 additions & 57 deletions .github/workflows/build-ironfish-rust-nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,58 +14,27 @@ jobs:
fail-fast: false
matrix:
settings:
- host: macos-11
- host: ubuntu-latest
target: x86_64-apple-darwin
architecture: x64
build: |
cd ironfish-rust-nodejs
yarn build
strip -x *.node

- host: windows-latest
target: x86_64-pc-windows-msvc
architecture: x64
build: cd ironfish-rust-nodejs && yarn build

- host: ubuntu-latest
# intentionally macos, needed to cross-compile to lower libc abi
- host: macos-latest
target: x86_64-unknown-linux-gnu
architecture: x64
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust@sha256:c9735923823026d494a3e544818911e187d0d014e8ac01bdf3bbd62efe5ee0d2
build: cd ironfish-rust-nodejs && yarn build && strip *.node

- host: ubuntu-latest
target: x86_64-unknown-linux-musl
architecture: x64
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust@sha256:749e81d2fa2fdcda2732e284069fdd8469702da007eb6088df426cdb813b3ecc
build: cd ironfish-rust-nodejs && yarn build && strip *.node

- host: macos-11
- host: ubuntu-latest
target: aarch64-apple-darwin
build: |
cd ironfish-rust-nodejs
yarn build --target=aarch64-apple-darwin
strip -x *.node

- host: ubuntu-latest
target: aarch64-unknown-linux-gnu
architecture: x64
setup: |
sudo apt-get update
sudo apt-get install g++-aarch64-linux-gnu gcc-aarch64-linux-gnu -y
build: |
cd ironfish-rust-nodejs
yarn build --target=aarch64-unknown-linux-gnu
aarch64-linux-gnu-strip *.node

- host: ubuntu-latest
target: aarch64-unknown-linux-musl
architecture: x64
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust@sha256:749e81d2fa2fdcda2732e284069fdd8469702da007eb6088df426cdb813b3ecc
build: |
rustup target add aarch64-unknown-linux-musl
cd ironfish-rust-nodejs
yarn build --target=aarch64-unknown-linux-musl
aarch64-linux-musl-strip *.node

name: Build ${{ matrix.settings.target }}
runs-on: ${{ matrix.settings.host }}
Expand All @@ -75,43 +44,31 @@ jobs:

- name: Use Node.js
uses: actions/setup-node@v3
if: ${{ !matrix.settings.docker }}
with:
node-version: '16.13.0'
cache: yarn
architecture: ${{ matrix.settings.architecture }}

- name: Install
uses: actions-rs/toolchain@v1
if: ${{ !matrix.settings.docker }}
with:
profile: minimal
target: ${{ matrix.settings.target }}

- name: Setup toolchain
run: ${{ matrix.settings.setup }}
if: ${{ matrix.settings.setup }}
shell: bash
- name: Install ziglang
uses: goto-bus-stop/setup-zig@v2
with:
version: 0.10.0

- name: Install dependencies
run: npm install --no-workspaces
working-directory: ./ironfish-rust-nodejs

- name: Build in Docker
uses: addnab/docker-run-action@v3
if: ${{ matrix.settings.docker }}
with:
image: ${{ matrix.settings.docker }}
options: -v ${{ env.HOME }}/.cargo/git:/root/.cargo/git -v ${{ env.HOME }}/.cargo/registry:/root/.cargo/registry -v ${{ github.workspace }}:/build -w /build
run: ${{ matrix.settings.build }}

- name: Build
run: ${{ matrix.settings.build }}
if: ${{ !matrix.settings.docker }}
shell: bash
run: yarn build --zig ${{ matrix.settings.target == 'x86_64-unknown-linux-gnu' && '--zig-abi-suffix=2.17' || ''}} --target ${{ matrix.settings.target }}
working-directory: ./ironfish-rust-nodejs

- name: Upload artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: bindings-${{ matrix.settings.target }}
path: ironfish-rust-nodejs/*.node
Expand All @@ -124,7 +81,7 @@ jobs:
fail-fast: false
matrix:
settings:
- host: macos-11
- host: macos-latest
target: x86_64-apple-darwin

- host: windows-latest
Expand All @@ -140,7 +97,7 @@ jobs:

- host: ubuntu-latest
target: aarch64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs@sha256:b145122cb5e68d8133e0eef0395af490eab781a648c637e43522e7fa33e63970
docker: ghcr.io/napi-rs/napi-rs/nodejs:aarch64-16

- host: ubuntu-latest
target: aarch64-unknown-linux-musl
Expand All @@ -163,7 +120,7 @@ jobs:
node-version: '16.13.0'

- name: Download artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: bindings-${{ matrix.settings.target }}
path: ./ironfish-rust-nodejs
Expand Down
18 changes: 13 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,16 @@ jobs:
cache: 'yarn'

- name: Install packages
run: yarn --non-interactive --frozen-lockfile --ignore-scripts
run: yarn --non-interactive --ignore-scripts

# Necessary since `--frozen-lockfile` does not work properly in yarn 1.x.
# https://github.com/yarnpkg/yarn/issues/5840
- name: Check for lockfile changes
run: |
if [[ $(git status | grep yarn.lock) ]]; then
echo "yarn.lock has outstanding updates, please check them in."
exit 1
fi
- name: Lint
run: yarn lint
Expand All @@ -41,8 +50,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v3
with:
# Using 16.10 to fix https://github.com/facebook/jest/issues/11956
node-version: '16.10.0'
node-version: '16.13.0'
cache: 'yarn'

- name: Cache Rust
Expand All @@ -54,7 +62,7 @@ jobs:
run: yarn --non-interactive --frozen-lockfile

- name: Run tests
run: yarn test:coverage
run: yarn test:coverage --maxWorkers=2 --workerIdleMemoryLimit=2000MB

- name: Upload coverage
if: github.repository == 'iron-fish/ironfish'
Expand Down Expand Up @@ -83,7 +91,7 @@ jobs:
run: yarn --non-interactive --frozen-lockfile

- name: Run slow tests & coverage
run: yarn test:slow:coverage
run: yarn test:slow:coverage --maxWorkers=2 --workerIdleMemoryLimit=2000MB

- name: Upload coverage
if: github.repository == 'iron-fish/ironfish'
Expand Down
84 changes: 25 additions & 59 deletions .github/workflows/rust_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
- "ironfish-rust-nodejs/**"
- "ironfish-zkp/**"
- "rust-toolchain"
- ".github/workflows/rust_ci.yml"
- ".github/workflows/rust*"
push:
branches:
- master
Expand All @@ -14,13 +14,13 @@ on:
- "ironfish-rust-nodejs/**"
- "ironfish-zkp/**"
- "rust-toolchain"
- ".github/workflows/rust_ci.yml"
- ".github/workflows/rust*"

name: Rust CI

jobs:
ironfish_rust:
name: ironfish-rust
rust_lint:
name: Lint Rust
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -39,39 +39,29 @@ jobs:
command: check
args: --locked

# Build & Run test & Collect Code coverage
- name: Run cargo-tarpaulin on ironfish-rust
uses: actions-rs/[email protected]
with:
version: "0.22.0"
args: --avoid-cfg-tarpaulin --manifest-path ironfish-rust/Cargo.toml --release -- --test-threads 1

# Upload code coverage to Codecov
- name: Upload to codecov.io
uses: codecov/[email protected]
with:
token: ${{secrets.CODECOV_TOKEN}}
flags: ironfish-rust

- name: Check for license headers
# Note: ironfish-zkp is does not need this due to different licensing
- name: Check for license headers for ironfish-rust
run: ./ci/lintHeaders.sh ./ironfish-rust/src *.rs

- name: Check for license headers for ironfish-rust-nodejs
run: ./ci/lintHeaders.sh ./ironfish-rust-nodejs/src *.rs

# fmt
- uses: actions-rs/cargo@v1
name: "`cargo fmt` check on ironfish-rust"
with:
command: fmt
args: --manifest-path ironfish-rust/Cargo.toml --all -- --check
args: --all -- --check

# clippy
- uses: actions-rs/cargo@v1
name: "Clippy check on ironfish-rust"
with:
command: clippy
args: --manifest-path ironfish-rust/Cargo.toml -- -D warnings
args: --all-targets -- -D warnings

ironfish_rust_nodejs:
name: ironfish-rust-nodejs
ironfish_rust:
name: Test ironfish-rust
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -82,34 +72,24 @@ jobs:
- name: Cache Rust
uses: Swatinem/rust-cache@v2
with:
shared-key: nodejs

# Check
- name: Run cargo check on ironfish-rust-nodejs
uses: actions-rs/cargo@v1
with:
command: "check"
args: --manifest-path ironfish-rust-nodejs/Cargo.toml

- name: Check for license headers
run: ./ci/lintHeaders.sh ./ironfish-rust-nodejs/src *.rs
shared-key: base

# fmt
- uses: actions-rs/cargo@v1
name: "`cargo fmt` check on ironfish-rust-nodejs"
# Build & Run test & Collect Code coverage
- name: Run cargo-tarpaulin on ironfish-rust
uses: actions-rs/[email protected]
with:
command: fmt
args: --manifest-path ironfish-rust-nodejs/Cargo.toml --all -- --check
version: "0.22.0"
args: --avoid-cfg-tarpaulin --manifest-path ironfish-rust/Cargo.toml --release -- --test-threads 1

# clippy
- uses: actions-rs/cargo@v1
name: "Clippy check on ironfish-rust-nodejs"
# Upload code coverage to Codecov
- name: Upload to codecov.io
uses: codecov/[email protected]
with:
command: clippy
args: --manifest-path ironfish-rust-nodejs/Cargo.toml -- -D warnings
token: ${{secrets.CODECOV_TOKEN}}
flags: ironfish-rust

ironfish_zkp:
name: ironfish-zkp
name: Test ironfish-zkp
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -135,17 +115,3 @@ jobs:
with:
token: ${{secrets.CODECOV_TOKEN}}
flags: ironfish-zkp

# fmt
- uses: actions-rs/cargo@v1
name: "`cargo fmt` check on ironfish-zkp"
with:
command: fmt
args: --manifest-path ironfish-zkp/Cargo.toml --all -- --check

# clippy
- uses: actions-rs/cargo@v1
name: "Clippy check on ironfish-zkp"
with:
command: clippy
args: --manifest-path ironfish-zkp/Cargo.toml -- -D warnings
32 changes: 32 additions & 0 deletions .github/workflows/rust_ci_cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
on:
push:
branches:
- master
- staging
paths:
- "ironfish-rust/**"
- "ironfish-rust-nodejs/**"
- "ironfish-zkp/**"
- "rust-toolchain"
- ".github/workflows/rust*"

name: Cache Rust build

jobs:
build-rust-cache:
name: Build and cache rust code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1

- name: Cache Rust
uses: Swatinem/rust-cache@v2
with:
shared-key: nodejs

- name: Build NAPI bindings for the cache
uses: actions-rs/cargo@v1
with:
command: build
args: --release
Loading

0 comments on commit 38d2528

Please sign in to comment.