Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: ci/test improvements #1238

Merged
merged 65 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
982ec60
wip
cylewitruk Jan 16, 2025
df893b0
Merge branch 'main' into feat/ci-improvements
cylewitruk Jan 17, 2025
6580fc8
working on emily
cylewitruk Jan 17, 2025
8e8be85
bump rust to 1.81 so cargo-lambda works
cylewitruk Jan 17, 2025
1c31c16
fix clippy warning
cylewitruk Jan 17, 2025
7987c65
wip
cylewitruk Jan 17, 2025
6bbe319
wip
cylewitruk Jan 17, 2025
920c64b
gha
cylewitruk Jan 17, 2025
5627eb3
naming and move checkout
cylewitruk Jan 17, 2025
35882bb
tweaks
cylewitruk Jan 17, 2025
8c9a955
nextest archives
cylewitruk Jan 17, 2025
08987f1
pnpm problems
cylewitruk Jan 17, 2025
b77c1b5
fixes
cylewitruk Jan 17, 2025
de18ae6
don't use archives
cylewitruk Jan 17, 2025
2119a4b
updates
cylewitruk Jan 17, 2025
5df9032
don't stop integration env
cylewitruk Jan 17, 2025
62a6003
ci updates
cylewitruk Jan 17, 2025
bb77325
cargo locking for some reason
cylewitruk Jan 17, 2025
d966615
try manually removing the package cache file
cylewitruk Jan 17, 2025
73e7667
try different target dirs
cylewitruk Jan 17, 2025
c38a739
new try
cylewitruk Jan 17, 2025
179251b
tweaks
cylewitruk Jan 17, 2025
a1097ef
try docker bake
cylewitruk Jan 17, 2025
328b5eb
bake retry
cylewitruk Jan 17, 2025
e851d8d
hmm
cylewitruk Jan 17, 2025
857160a
hmm
cylewitruk Jan 17, 2025
3d3ed77
docker stuff
cylewitruk Jan 17, 2025
9644e05
try shell
cylewitruk Jan 17, 2025
bd0f91e
try shell
cylewitruk Jan 17, 2025
bd0dc0a
re-add buildx?
cylewitruk Jan 17, 2025
ec95d03
try getting rid of aws-setup
cylewitruk Jan 17, 2025
7cb98c3
use all targets
cylewitruk Jan 17, 2025
78f7f67
consolidate crate features
cylewitruk Jan 17, 2025
71269bf
get rid of all targets?
cylewitruk Jan 17, 2025
0398ecc
logging
cylewitruk Jan 17, 2025
04c7402
update ci env
cylewitruk Jan 17, 2025
24a0c68
makefile
cylewitruk Jan 18, 2025
3d157ef
try using archives again
cylewitruk Jan 18, 2025
1892a70
bump upload/download artifact version
cylewitruk Jan 18, 2025
bfc89af
use binary nextest
cylewitruk Jan 18, 2025
b92d722
tweaks
cylewitruk Jan 18, 2025
ee42f1f
try wait-other-jobs
cylewitruk Jan 18, 2025
090682c
whoops
cylewitruk Jan 18, 2025
80e5d52
whoops
cylewitruk Jan 18, 2025
b909b7e
generated code checks
cylewitruk Jan 18, 2025
8e71967
whoops
cylewitruk Jan 18, 2025
f2991cf
remove aws-setup ci container
cylewitruk Jan 18, 2025
7e9933f
test partitioning
cylewitruk Jan 18, 2025
bbde95e
Merge branch 'main' into feat/ci-improvements
cylewitruk Jan 21, 2025
7d93766
remove commented code in workflow
cylewitruk Jan 21, 2025
cad7124
add default read permissions for on-push workflow
cylewitruk Jan 21, 2025
53ae218
undo lru default features change
cylewitruk Jan 21, 2025
bdbac6a
undo test ignore
cylewitruk Jan 21, 2025
08dc1b8
move and ignore fee estimate test
cylewitruk Jan 21, 2025
83516cc
does taiki-e work for nextest without cargo?
cylewitruk Jan 21, 2025
b4856c8
use taike-e for nextest installs
cylewitruk Jan 21, 2025
8a8c0dc
add commit hashes for all actions
cylewitruk Jan 21, 2025
6500f48
remove nextest retries
cylewitruk Jan 21, 2025
816e2b3
add -t 0 to integration-env-down docker command
cylewitruk Jan 23, 2025
f8327b8
docker tweaks in makefile
cylewitruk Jan 23, 2025
cb4947b
makefile tweaks
cylewitruk Jan 23, 2025
3637f08
comment
cylewitruk Jan 23, 2025
c966944
remove submodule thingy
cylewitruk Jan 23, 2025
152a803
Merge branch 'main' into feat/ci-improvements
cylewitruk Jan 23, 2025
a14c3d8
remove integration-tests attr
cylewitruk Jan 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .generated-sources/blocklist-openapi-gen/package.json

This file was deleted.

13 changes: 0 additions & 13 deletions .generated-sources/emily/openapi/package.json

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/buf-ci.yaml

This file was deleted.

49 changes: 0 additions & 49 deletions .github/workflows/contract-tests.yaml

This file was deleted.

239 changes: 239 additions & 0 deletions .github/workflows/on-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
name: On Push
on: [push]

permissions: read-all
matteojug marked this conversation as resolved.
Show resolved Hide resolved

concurrency:
# limit concurrency of entire workflow runs for a specific branch
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
NODE_VERSION: 22.1.0
BUF_VERSION: 1.42.0
PYTHON_VERSION: 3.13
NEXTEST_VERSION: 0.9.88
CARGO_INCREMENTAL: 0
CARGO_PROFILE_DEV_STRIP: "debuginfo"

jobs:

# Runs various lints and checks for the project, including Rustfmt, Clippy,
# Protobuf lints, and pnpm lints.
lint:
name: Run Lints
runs-on: ubuntu-24.04
steps:
- uses: rui314/setup-mold@f80524ca6eeaa76759b57fb78ddce5d87a20c720 #v1
with:
make-default: true
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 #v4.0
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af #v4.1.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"
- uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b #v3.0.0
with:
version: "25.3"
- uses: bufbuild/buf-action@3fb70352251376e958c4c2c92c3818de82a71c2b #v1.0.2
with:
version: ${{ env.BUF_VERSION }}
setup_only: true
- uses: actions-rust-lang/setup-rust-toolchain@11df97af8e8102fd60b60a77dfbf58d40cd843b8 #v1.10.1
with:
components: clippy, rustfmt
cache-key: "rust-tests"
- name: Install Package Dependencies
run: make install
- name: Lint (Rustfmt)
run: cargo fmt --all -- --check
- name: Lint (Clippy)
run: cargo clippy -- -D warnings
- name: Lint (pnpm)
run: pnpm --recursive run lint
- name: Lint (Protobuf)
run: |
buf format --diff --exit-code
buf lint
working-directory: ./protobufs
- name: Typecheck (pnpm)
run: pnpm --recursive typecheck

# Builds the Rust test artifacts for the project, packages them as Nextest
# archives and uploads them as artifacts. This job is used as a dependency for
# the `unit-tests` and `integration-tests` jobs.
build-tests:
name: Build Test Artifacts
runs-on: ubuntu-24.04
steps:
- uses: rui314/setup-mold@f80524ca6eeaa76759b57fb78ddce5d87a20c720 #v1
with:
make-default: true
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
- uses: actions-rust-lang/setup-rust-toolchain@11df97af8e8102fd60b60a77dfbf58d40cd843b8 #v1.10.1
with:
cache-key: "rust-tests"
- uses: taiki-e/install-action@da41fb311fbbcecf899732e575aaeaa2fe65c934 #v2.47.21
with:
tool: nextest@${{ env.NEXTEST_VERSION }}
- name: Build Tests
run: make test-build
- name: Create Nextest Archives
run: make nextest-archive
djordon marked this conversation as resolved.
Show resolved Hide resolved
- name: Upload Nextest Archives
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 #v4.6.0
with:
name: nextest-archives
path: ./target/nextest/*.tar.zst

# Runs the unit tests for the project (Rust + pnpm). It depends on the
# `build-tests` job to build the Nextest test archives and upload them as
# artifacts. Note that since we are using nextest archives, we do not need
# Rust to be installed in this job.
unit-tests:
name: Run Unit Tests
runs-on: ubuntu-24.04
needs: build-tests
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 #v4.0
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af #v4.1.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"
- uses: taiki-e/install-action@da41fb311fbbcecf899732e575aaeaa2fe65c934 #v2.47.21
with:
tool: nextest@${{ env.NEXTEST_VERSION }}
- name: Install Package Dependencies
run: make install
- name: Download Nextest Archives
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 #v4.1.8
with:
name: nextest-archives
path: .
- name: Run Unit Tests (Node)
run: pnpm --recursive test
- name: Run Unit Tests (Rust)
run: cargo-nextest nextest --color always run --no-fail-fast --archive-file nextest-archive.tar.zst

# Runs the Rust integration tests for the project. It depends on the
# `build-tests` job to build the nextest test archives and upload them as
# artifacts, however we do not define an explicit dependency with `needs`.
# This is because in this job, we also need to get the integration environment
# running, which generally takes around a minute. So, we start this job
# immediately and once the environment is running we use the `wait-other-jobs`
# action to wait until the `build-tests` job is complete and the artifacts are
# available. This lets us start the environment while the tests are building,
# and then run the tests as soon as the artifacts are available.
integration-tests:
name: Run Integration Tests
runs-on: ubuntu-24.04
strategy:
matrix:
partition: [1, 2]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
- uses: actions-rust-lang/setup-rust-toolchain@11df97af8e8102fd60b60a77dfbf58d40cd843b8 #v1.10.1
with:
cache-key: "rust-tests"
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 #v4.0
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af #v4.1.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"
- uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b #v3.0.0
with:
version: "25.3"
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b #v5.3.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- run: pip install boto3
- uses: taiki-e/install-action@da41fb311fbbcecf899732e575aaeaa2fe65c934 #v2.47.21
with:
tool: nextest@${{ env.NEXTEST_VERSION }}
- name: Install Package Dependencies
run: make install
- name: Start Integration Test Environment
run: make integration-env-up-ci
- name: Wait for Test Artifacts
uses: kachick/wait-other-jobs@0584f1460011b97726c04abf4bbec5bfb5cdb654 #v3.6.0
timeout-minutes: 5
with:
retry-method: 'equal_intervals'
wait-seconds-before-first-polling: 1
min-interval-seconds: 5
wait-list: |
[
{
"workflowFile": "on-push.yaml",
"jobName": "Build Test Artifacts",
"optional": false,
"startupGracePeriod": {
"minutes": 5
}
}
]
- name: Download Nextest Archives
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 #v4.1.8
with:
name: nextest-archives
path: .
- name: Run Integration Tests (Rust)
run: cargo-nextest nextest --color always run --no-fail-fast --test-threads 1 --partition hash:${{ matrix.partition }}/2 --archive-file nextest-archive-serial.tar.zst

# Runs checks on the generated code in the project for contracts, the
# blocklist client and the emily clients. This job is used to ensure that the
# generated code is up-to-date with the latest changes in the project. It does
# this by re-generating the code and then checking if the git status is clean
# (the generated code should exactly match the committed code). If the git
# status is dirty for any of the components, it fails the job and prints an
# error message.
check-generated-code:
name: Run Generated Code Checks
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
- uses: actions-rust-lang/setup-rust-toolchain@11df97af8e8102fd60b60a77dfbf58d40cd843b8 #v1.10.1
with:
cache-key: "rust-tests"
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 #v4.0
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af #v4.1.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"
- name: Install Package Dependencies
run: pnpm --recursive install
- name: Generate Contract Docs and Types
run: make contracts
- name: Ensure Git is Clean (Contracts)
id: git-status-contracts
run: git diff --no-ext-diff --exit-code
continue-on-error: true
- name: Git is Dirty (Contracts)
if: steps.git-status-contracts.outcome == 'failure'
run: |
echo "::error title=Contracts are dirty:: Make sure you ran 'make contracts' before pushing."
exit 1
matteojug marked this conversation as resolved.
Show resolved Hide resolved
- name: Generate Blocklist Client
run: make blocklist-client-codegen
- name: Ensure Git is Clean (Blocklist Client)
id: git-status-blocklist-client
run: git diff --no-ext-diff --exit-code
continue-on-error: true
- name: Git is Dirty (Blocklist Client)
if: steps.git-status-blocklist-client.outcome == 'failure'
run: |
echo "::error title=Blocklist client is dirty:: Make sure you ran 'make blocklist-client-codegen' before pushing."
exit 1
- name: Generate Emily Clients
run: make emily-client-codegen
- name: Ensure Git is Clean (Emily Clients)
id: git-status-emily-clients
run: git diff --no-ext-diff --exit-code
continue-on-error: true
- name: Git is Dirty (Emily Clients)
if: steps.git-status-emily-clients.outcome == 'failure'
run: |
echo "::error title=Emily clients are dirty:: Make sure you ran 'make emily-client-codegen' before pushing."
exit 1
Loading