Skip to content

Commit

Permalink
Merge branch 'main' into docs
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenj committed Jan 30, 2023
2 parents 1c9ce46 + 3585b78 commit a2192ed
Show file tree
Hide file tree
Showing 4 changed files with 217 additions and 149 deletions.
2 changes: 2 additions & 0 deletions .config/nextest.toml
Expand Up @@ -5,5 +5,7 @@ failure-output = "immediate-final"
fail-fast = false
# Show all tests in the CI output.
status-level = "all"
# Test statuses at the end of the run.
final-status-level = "slow"
# Retries the test n times, tests that succeed on a subsequent attempt will be marked as flaky
retries = 10
32 changes: 21 additions & 11 deletions .github/workflows/build.yml
Expand Up @@ -22,10 +22,14 @@ on:
- 'book/**'

env:
RUST_LATEST_STABLE_VERSION: 1.65
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings
RUST_BACKTRACE: 1
CARGO_INCREMENTAL: 0
CARGO_FLAGS: --verbose --locked
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 15


jobs:
cancel:
Expand All @@ -40,25 +44,29 @@ jobs:
build_on_linux:
name: Build Catalyst Core on Linux
runs-on: ubuntu-latest
env:
CARGO_FLAGS: --verbose --locked
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}

- uses: Swatinem/rust-cache@v2
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{env.RUST_LATEST_STABLE_VERSION}}

- name: Cache rust
uses: Swatinem/rust-cache@v2
with:
shared-key: "build_cache"
save-if: ${{ github.ref == 'refs/heads/main' }}

- name: Install deps
run:
sudo apt install -y protobuf-compiler libssl-dev libpq-dev libsqlite3-dev pkg-config

- name: Build on Linux
uses: actions-rs/toolchain@v1
with:
toolchain: "1.65"
- run: cargo build
run: cargo build ${{env.CARGO_FLAGS}}

build_on_windows:
name: Build Catalyst Core on Windows
Expand Down Expand Up @@ -89,7 +97,8 @@ jobs:
reg add HKLM\SYSTEM\CurrentControlSet\Control\FileSystem /v LongPathsEnabled /t REG_DWORD /d 1 /f
git config --system core.longpaths true
- uses: Swatinem/rust-cache@v2
- name: Cache rust
uses: Swatinem/rust-cache@v2
with:
workspaces: "C:\\${{ github.event.repository.name }}"

Expand All @@ -108,10 +117,11 @@ jobs:
run: |
"PQ_LIB_DIR=${env:PROGRAMFILES}\PostgreSQL\14\lib" >> $env:GITHUB_ENV
- uses: actions-rs/toolchain@v1
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: "1.65"
toolchain: ${{env.RUST_LATEST_STABLE_VERSION}}

- name: Build on Windows
working-directory: "C:\\${{ github.event.repository.name }}"
run: cargo build --workspace
run: cargo build --workspace ${{env.CARGO_FLAGS}}
73 changes: 53 additions & 20 deletions .github/workflows/ci-tests-n-coverage.yml
Expand Up @@ -6,10 +6,14 @@ on:
- cron: '5 0 * * *'

env:
RUST_LATEST_STABLE_VERSION: 1.65
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings
RUST_BACKTRACE: 1
CARGO_INCREMENTAL: 0
CARGO_FLAGS: --verbose --locked
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 15


concurrency:
group: ${{ github.sha }}
Expand All @@ -20,25 +24,37 @@ jobs:
name: Unit Tests
runs-on: ubuntu-latest
needs: [integration-tests]
env:
CARGO_FLAGS: --verbose --locked
services:
postgres:
image: postgres:14
env:
POSTGRES_PASSWORD: 123456
options:
>-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout code
uses: actions/checkout@v3

- uses: Swatinem/rust-cache@v2
with:
shared-key: "cov"
save-if: "true"

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: "1.65" # it says it can read the rust-toolchain file, but it fails if we omit this
toolchain: ${{env.RUST_LATEST_STABLE_VERSION}} # it says it can read the rust-toolchain file, but it fails if we omit this
components: llvm-tools-preview

- name: Install cargo-nextest
run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
- name: Cache rust
uses: Swatinem/rust-cache@v2
with:
shared-key: "build_cache"
save-if: "false"

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

- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
Expand All @@ -48,6 +64,8 @@ jobs:
sudo apt install -y protobuf-compiler libssl-dev libpq-dev libsqlite3-dev pkg-config

- name: Run unit tests
env:
TEST_DB: postgres
run: |
cargo llvm-cov nextest --no-report --manifest-path ./src/catalyst-toolbox/catalyst-toolbox/Cargo.toml --profile ci
cargo llvm-cov nextest --no-report --manifest-path ./src/catalyst-toolbox/snapshot-lib/Cargo.toml --profile ci
Expand Down Expand Up @@ -82,6 +100,7 @@ jobs:
cargo llvm-cov nextest --no-report --manifest-path ./src/jormungandr/jormungandr/Cargo.toml --profile ci
cargo llvm-cov report --lcov --output-path ./lcov.info
- name: Upload code coverage to coveralls.io
uses: coverallsapp/github-action@master
with:
Expand All @@ -91,25 +110,37 @@ jobs:
integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
env:
CARGO_FLAGS: --verbose --locked
services:
postgres:
image: postgres:14
env:
POSTGRES_PASSWORD: postgres
options:
>-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout code
uses: actions/checkout@v3

- uses: Swatinem/rust-cache@v2
with:
shared-key: "cov"
save-if: "true"

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: "1.65" # it says it can read the rust-toolchain file, but it fails if we omit this
toolchain: ${{env.RUST_LATEST_STABLE_VERSION}} # it says it can read the rust-toolchain file, but it fails if we omit this
components: llvm-tools-preview

- name: Install cargo-nextest
run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
- name: Cache rust
uses: Swatinem/rust-cache@v2
with:
shared-key: "build_cache"
save-if: "false"

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

- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
Expand All @@ -119,6 +150,8 @@ jobs:
sudo apt install -y protobuf-compiler libssl-dev libpq-dev libsqlite3-dev pkg-config

- name: Run integration tests
env:
TEST_DATABASE_URL: postgres://postgres:postgres@localhost
run: |
source <(cargo llvm-cov show-env --export-prefix)
cargo build -p jcli -p jormungandr -p explorer -p vit-servicing-station-cli -p vit-servicing-station-server
Expand Down

0 comments on commit a2192ed

Please sign in to comment.