Skip to content

Commit

Permalink
copied zingolibs workflows as starting point for Zaino
Browse files Browse the repository at this point in the history
  • Loading branch information
idky137 committed Sep 11, 2024
1 parent 2c63a60 commit d6e263c
Show file tree
Hide file tree
Showing 7 changed files with 273 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: cargo
directory: /
schedule:
interval: monthly
allow:
- dependency-type: direct
38 changes: 38 additions & 0 deletions .github/workflows/cargo-checkmate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Cargo checkmate

on: [workflow_call]

jobs:
cache-checkmate:
name: Cache checkmate
runs-on: ubuntu-22.04
if: github.event.pull_request.draft == false
steps:
- uses: taiki-e/cache-cargo-install-action@v1
with:
tool: cargo-checkmate

cargo-checkmate:
name: Cargo checkmate
strategy:
matrix:
phase: [build, check, clippy, doc, format]
needs: cache-checkmate
runs-on: ubuntu-22.04
if: github.event.pull_request.draft == false
env:
RUSTFLAGS: -D warnings
steps:
- uses: taiki-e/cache-cargo-install-action@v1
with:
tool: cargo-checkmate

- name: Checkout repository
uses: actions/checkout@v3

- name: Install protoc
run: sudo apt-get install protobuf-compiler

- name: Run cargo checkmate
run: cargo-checkmate run ${{ matrix.phase }}

53 changes: 53 additions & 0 deletions .github/workflows/ci-nightly.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: CI (Nightly)

on:
schedule:
- cron: '30 3 * * *'
workflow_dispatch:

jobs:
cargo-checkmate:
uses: ./.github/workflows/cargo-checkmate.yaml

reject-trailing-whitespace:
name: Reject trailing whitespace
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Reject trailing whitespace
run: ./utils/trailing-whitespace.sh reject

test:
uses: ./.github/workflows/test.yaml

create-timestamp:
uses: zingolabs/zingo-mobile/.github/workflows/create-timestamp.yaml@dev

create-cache-key:
uses: zingolabs/zingo-mobile/.github/workflows/create-cache-key.yaml@dev

build-android:
strategy:
matrix:
arch: [ x86_64, x86, arm64-v8a, armeabi-v7a ]
fail-fast: false
uses: zingolabs/zingo-mobile/.github/workflows/build.yaml@dev
needs: create-cache-key
with:
cache-key: ${{ needs.create-cache-key.outputs.cache-key }}
arch: ${{ matrix.arch }}

integration-test-android:
strategy:
matrix:
abi: [ x86_64, x86, arm64-v8a, armeabi-v7a ]
fail-fast: false
uses: zingolabs/zingo-mobile/.github/workflows/integration-test.yaml@dev
needs: [ create-timestamp, create-cache-key, build-android ]
with:
timestamp: ${{ needs.create-timestamp.outputs.timestamp }}
cache-key: ${{ needs.create-cache-key.outputs.cache-key }}
abi: ${{ matrix.abi }}

51 changes: 51 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CI

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
push:
branches: [stable, dev]
workflow_dispatch:

jobs:
cargo-checkmate:
uses: ./.github/workflows/cargo-checkmate.yaml

reject-trailing-whitespace:
name: Reject trailing whitespace
runs-on: ubuntu-22.04
if: github.event.pull_request.draft == false
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Reject trailing whitespace
run: ./utils/trailing-whitespace.sh reject

run-doc-tests:
name: Run doc tests
runs-on: ubuntu-22.04
if: github.event.pull_request.draft == false
env:
RUSTFLAGS: -D warnings
steps:
- name: Checkout repository
uses: actions/checkout@v3

- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable

- name: Install protoc
run: sudo apt-get install protobuf-compiler

- name: Cargo cache
uses: Swatinem/rust-cache@v2

- name: Run doc tests
run: cargo test --doc

test:
uses: ./.github/workflows/test.yaml
with:
nextest-flags: "-E 'not test(slow)'"
File renamed without changes.
42 changes: 42 additions & 0 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Coverage (Weekly)

on:
schedule:
- cron: '30 8 * * 0'
workflow_dispatch:

jobs:
coverage:
name: Coverage
runs-on: ubuntu-22.04
env:
RUSTFLAGS: -D warnings
container:
image: zingodevops/ci-build:002
options: --security-opt seccomp=unconfined
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Symlink lightwalletd and zcash binaries
run: ln -s /usr/bin/lightwalletd /usr/bin/zcashd /usr/bin/zcash-cli ./libtonode-tests/regtest/bin/

- name: Symlink zcash parameters
run: ln -s /root/.zcash-params /github/home

- name: Cargo cache
uses: Swatinem/rust-cache@v2

- name: Generate code coverage
uses: actions-rs/cargo@v1
with:
command: tarpaulin
args: --all-features --verbose --workspace --avoid-cfg-tarpaulin --skip-clean --release --timeout 3000 --out xml

- name: Upload to codecov.io
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./cobertura.xml
fail_ci_if_error: true

81 changes: 81 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Test

on:
workflow_call:
inputs:
nextest-flags:
required: false
type: string

env:
NEXTEST-FLAGS: ${{ inputs.nextest-flags }}

jobs:
build-test-artifacts:
name: Build test artifacts
runs-on: ubuntu-22.04
if: github.event.pull_request.draft == false
env:
RUSTFLAGS: -D warnings
steps:
- name: Checkout repository
uses: actions/checkout@v3

- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable

- name: Install nextest
uses: taiki-e/install-action@nextest

- name: Install protoc
run: sudo apt-get install protobuf-compiler

- name: Cargo cache
uses: Swatinem/rust-cache@v2

- name: Build and archive tests
run: cargo nextest archive --verbose --workspace --all-features --archive-file nextest-archive.tar.zst

- name: Upload archive
uses: actions/upload-artifact@v3
with:
name: nextest-archive
path: nextest-archive.tar.zst

run-tests:
name: Run tests
runs-on: ubuntu-22.04
if: github.event.pull_request.draft == false
needs: build-test-artifacts
env:
RUSTFLAGS: -D warnings
container:
image: zingodevops/ci-build:002
options: --security-opt seccomp=unconfined
strategy:
matrix:
partition: [1, 2, 3, 4, 5, 6, 7, 8]
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: create binaries dir
run: mkdir -p ./test_binaries/bins

- name: Symlink lightwalletd and zcash binaries
run: ln -s /usr/bin/lightwalletd /usr/bin/zcashd /usr/bin/zcash-cli ./test_binaries/bins/

- name: Symlink zcash parameters
run: ln -s /root/.zcash-params /github/home

- name: Download archive
uses: actions/download-artifact@v3
with:
name: nextest-archive

- name: Run tests
run: |
cargo nextest run --verbose --profile ci --archive-file nextest-archive.tar.zst \
--workspace-remap ./ --partition count:${{ matrix.partition }}/8 ${{ env.NEXTEST-FLAGS }}

0 comments on commit d6e263c

Please sign in to comment.