2021-12-11 10:06:56 -08:00
name : Build
on :
workflow_dispatch :
pull_request :
push :
branches :
2022-11-29 06:30:22 -08:00
- main
2021-12-11 10:06:56 -08:00
jobs :
# Run the full Tilt build and wait for it to converge
tilt :
2022-07-29 15:33:40 -07:00
# in the future, we may want to run cheap lints, tests, and builds before firing up the expensive tilt test.
2022-06-21 12:18:16 -07:00
# But for now, we'll kick-off everything at once
2022-07-29 15:33:40 -07:00
# needs: [go-lint-and-tests, node, algorand, ethereum, terra, rust-lint-and-tests]
2021-12-11 10:06:56 -08:00
runs-on : tilt-kube-public
# Cancel previous builds on the same branch/ref. Full runs are expensive
# and capacity is limited, so we want to avoid running multiple builds
# in parallel even if it means skipping CI runs on permanent branches
# (unfortunately, we can't differentiate between temporary and permanent
# refs without duplicating the entire logic).
concurrency :
2022-03-03 12:16:28 -08:00
group : ${{ github.workflow }}-tilt-${{ github.ref }}
2021-12-11 10:06:56 -08:00
cancel-in-progress : true
steps :
2022-08-09 09:14:30 -07:00
- name : Clear repository
run : |
rm -rf $GITHUB_WORKSPACE && mkdir $GITHUB_WORKSPACE
2021-12-11 10:06:56 -08:00
- uses : actions/checkout@v2
- name : Expand for link to Tilt dashboard (only available during build)
run : >
echo "Tilt progress dashboard: https://$DASHBOARD_URL"
- run : |
kubectl config set-context ci --namespace=$DEPLOY_NS
kubectl config use-context ci
2022-04-01 10:43:51 -07:00
- run : tilt ci -- --ci --namespace=$DEPLOY_NS --num=2
2023-05-02 11:01:34 -07:00
timeout-minutes : 20
2021-12-11 10:06:56 -08:00
# Clean up k8s resources
2022-02-11 21:21:39 -08:00
- run : kubectl delete --namespace=$DEPLOY_NS service,statefulset,configmap,pod,job --all
2021-12-11 10:06:56 -08:00
if : always()
# Verify whether the Makefile builds the node (no dependencies other than Go)
node :
runs-on : ubuntu-20.04
steps :
- uses : actions/checkout@v2
- uses : actions/setup-go@v2
with :
2023-06-06 18:49:38 -07:00
go-version : "1.20.5"
2021-12-11 10:06:56 -08:00
- run : make node
2022-05-31 13:47:31 -07:00
algorand :
runs-on : ubuntu-20.04
steps :
- uses : actions/checkout@v3
- uses : actions/setup-python@v3
with :
python-version : "3.10"
- run : pip install -r algorand/requirements.txt
- run : cd algorand && make test
2022-03-30 21:32:27 -07:00
ethereum :
runs-on : ubuntu-20.04
steps :
- uses : actions/checkout@v2
- uses : actions/setup-node@v2
with :
2022-05-31 13:47:31 -07:00
node-version : "16"
2022-08-04 11:34:27 -07:00
- run : cd ethereum && ../scripts/install-foundry
- run : cd ethereum && PATH=$PATH:$HOME/.foundry/bin/ make test
2022-03-30 21:32:27 -07:00
2022-06-25 07:10:36 -07:00
ethereum-upgrade :
runs-on : ubuntu-20.04
steps :
- uses : actions/checkout@v2
- uses : actions/setup-node@v2
with :
node-version : "16"
- run : cd clients/js && make install
2022-07-29 15:33:40 -07:00
- run : cd ethereum && make test-upgrade
2022-06-25 07:10:36 -07:00
2022-09-06 23:26:30 -07:00
solana :
runs-on : ubuntu-20.04
env :
RUSTFLAGS : -Dwarnings
EMITTER_ADDRESS : CiByUvEcx7w2HA4VHcPCBUAFQ73Won9kB36zW9VjirSr
BRIDGE_ADDRESS : Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o
steps :
- uses : actions/checkout@v3
- name : Get rust toolchain version
id : toolchain
run : |
RUST_VERSION="$(awk '/channel =/ { print substr($3, 2, length($3)-2) }' solana/rust-toolchain)"
echo "::set-output name=version::${RUST_VERSION}"
- name : Get solana version
id : solana
run : |
SOLANA_VERSION="$(awk '/solana-program =/ { print substr($3, 3, length($3)-3) }' solana/bridge/program/Cargo.toml)"
echo "::set-output name=version::${SOLANA_VERSION}"
- name : Cache rust toolchain
uses : actions/cache@v3
env :
cache-name : solana-toolchain
with :
path : |
~/.cargo/bin
~/.rustup
key : ${{ runner.os }}-build-${{ env.cache-name }}-${{ steps.toolchain.outputs.version }}
restore-keys : |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name : Install rust toolchain
2022-09-30 03:28:26 -07:00
uses : dtolnay/rust-toolchain@55c7845fad90d0ae8b2e83715cb900e5e861e8cb
2022-09-06 23:26:30 -07:00
with :
2022-10-20 14:00:35 -07:00
toolchain : ${{ steps.toolchain.outputs.version }}
components : "clippy,rustfmt"
2022-09-06 23:26:30 -07:00
2022-12-21 05:24:50 -08:00
- name : Cache rust packages / build cache
2022-09-06 23:26:30 -07:00
uses : actions/cache@v3
env :
cache-name : solana-rust-packages
with :
2022-12-21 05:24:50 -08:00
path : |
~/.cargo/bin
~/.cargo/registry
~/.cargo/git/db
solana/target
2022-09-06 23:26:30 -07:00
key : ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('solana/Cargo.lock') }}
restore-keys : |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name : Run `cargo fmt`
run : cargo fmt --check --all --manifest-path solana/Cargo.toml
- name : Run `cargo check`
run : cargo check --workspace --tests --manifest-path solana/Cargo.toml
2022-10-20 14:00:35 -07:00
--features "nft-bridge/instructions token-bridge/instructions wormhole-bridge-solana/instructions"
2022-09-06 23:26:30 -07:00
- name : Run `cargo clippy`
run : cargo clippy --workspace --tests --manifest-path solana/Cargo.toml
2022-10-20 14:00:35 -07:00
--features "nft-bridge/instructions token-bridge/instructions wormhole-bridge-solana/instructions"
2022-09-06 23:26:30 -07:00
- name : Cache solana tools
id : cache-solana
uses : actions/cache@v3
env :
cache-name : solana-tools
with :
path : |
~/.local/share/solana/install/
~/.cache/solana/
key : ${{ runner.os }}-build-${{ env.cache-name }}-${{ steps.solana.outputs.version }}
- if : ${{ steps.cache-solana.outputs.cache-hit != 'true' }}
name : Install solana tools
env :
SOLANA_VERSION : ${{ steps.solana.outputs.version }}
run : |
sh -c "$(curl -sSfL https://release.solana.com/v${SOLANA_VERSION}/install)"
~/.local/share/solana/install/active_release/bin/sdk/bpf/scripts/install.sh
- name : Run unit tests
env :
RUST_BACKTRACE : "1"
run : |
cd solana
export BPF_OUT_DIR="$(pwd)/target/deploy"
export PATH="${HOME}/.local/share/solana/install/active_release/bin:${PATH}"
mkdir -p "${BPF_OUT_DIR}"
2023-05-15 12:55:03 -07:00
cp external/mpl_token_metadata.so "${BPF_OUT_DIR}"
2022-09-06 23:26:30 -07:00
BPF_PACKAGES=(
bridge/program/Cargo.toml
modules/token_bridge/program/Cargo.toml
modules/nft_bridge/program/Cargo.toml
)
for p in "${BPF_PACKAGES[@]}"; do
cargo build-bpf --manifest-path "${p}"
done
cargo test --workspace --features "nft-bridge/instructions token-bridge/instructions wormhole-bridge-solana/instructions"
2022-10-13 18:21:26 -07:00
aptos :
name : Aptos
runs-on : ubuntu-20.04
defaults :
run :
shell : bash
working-directory : ./aptos
steps :
- name : Checkout repository
uses : actions/checkout@v2
- name : Run tests via docker
run : make test-docker
2022-09-06 23:26:30 -07:00
2023-01-20 05:50:32 -08:00
sui :
name : Sui
runs-on : ubuntu-20.04
steps :
- name : Checkout repository
uses : actions/checkout@v2
- name : Run tests via docker
2023-05-02 09:22:30 -07:00
run : cd sui && make test-docker
2023-01-20 05:50:32 -08:00
2022-04-06 09:25:18 -07:00
terra :
runs-on : ubuntu-20.04
steps :
- uses : actions/checkout@v2
- uses : actions/setup-node@v2
with :
2022-05-31 13:47:31 -07:00
node-version : "16"
2022-04-06 09:25:18 -07:00
- run : cd terra && make test
2022-06-16 09:48:01 -07:00
terra-2 :
2022-12-12 15:43:22 -08:00
runs-on : ubuntu-20.04
steps :
- uses : actions/checkout@v2
- uses : actions/setup-node@v2
with :
node-version : "16"
- run : cd cosmwasm/deployment/terra2 && make test
cosmwasm :
2022-06-16 09:48:01 -07:00
runs-on : ubuntu-20.04
steps :
- uses : actions/checkout@v2
- uses : actions/setup-node@v2
with :
node-version : "16"
- run : cd cosmwasm && make test
2022-06-29 12:12:45 -07:00
cli :
runs-on : ubuntu-20.04
steps :
- uses : actions/checkout@v2
- uses : actions/setup-node@v2
with :
node-version : "16"
- run : cd clients/js && make test
2022-09-02 01:36:24 -07:00
# Verify wormhole chain unit tests
wormchain :
runs-on : ubuntu-20.04
steps :
- uses : actions/checkout@v2
- uses : actions/setup-go@v2
with :
2023-05-02 13:29:38 -07:00
go-version : "1.19.9"
2023-01-18 07:56:32 -08:00
- run : |
cd wormchain
make proto -B
git diff --name-only --exit-code && echo "✅ Generated proto matches committed proto" || (echo "❌ Generated proto differs from committed proto, run \`make proto -B\` and commit the result" >&2 && exit 1)
make test
2022-09-02 01:36:24 -07:00
2023-05-30 13:46:51 -07:00
# Verify go sdk unit/fuzz tests
2022-12-12 11:58:38 -08:00
sdk_vaa :
runs-on : ubuntu-20.04
steps :
- uses : actions/checkout@v2
- uses : actions/setup-go@v2
with :
2023-06-06 18:49:38 -07:00
go-version : "1.20.5"
2023-05-30 13:46:51 -07:00
- run : cd sdk/vaa && go test && go test -v -fuzz FuzzCalculateQuorum -run FuzzCalculateQuorum -fuzztime 15s
2023-06-06 18:49:38 -07:00
2023-01-22 17:04:26 -08:00
# Run Go linters
node-lint :
2021-12-11 10:06:56 -08:00
# The linter is slow enough that we want to run it on the self-hosted runner
runs-on : tilt-kube-public
concurrency :
2022-03-03 12:16:28 -08:00
group : ${{ github.workflow }}-lint-${{ github.ref }}
2021-12-11 10:06:56 -08:00
cancel-in-progress : true
steps :
2022-08-09 09:14:30 -07:00
- name : Clear repository
run : |
rm -rf $GITHUB_WORKSPACE && mkdir $GITHUB_WORKSPACE
2021-12-11 10:06:56 -08:00
- uses : actions/checkout@v2
- uses : actions/setup-go@v2
with :
2023-06-06 18:49:38 -07:00
go-version : "1.20.5"
2022-06-21 12:18:16 -07:00
- name : Install formatter
2023-05-04 07:37:16 -07:00
run : go install golang.org/x/tools/cmd/goimports@v0.8.0
2022-06-21 12:18:16 -07:00
- name : Formatting checks
run : ./scripts/lint.sh -l -g format
- name : Install linters
2023-05-03 15:35:16 -07:00
run : curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.52.2
2022-06-21 12:18:16 -07:00
- name : Run linters
run : make generate && ./scripts/lint.sh -g lint
2022-10-28 17:15:33 -07:00
- name : Ensure generated proto matches
run : |
rm -rf node/pkg/proto
docker build --target go-export -f Dockerfile.proto -o type=local,dest=node .
git diff --name-only --exit-code && echo "✅ Generated proto matches committed proto" || (echo "❌ Generated proto differs from committed proto, run \`rm -rf node/pkg/proto && docker build --target go-export -f Dockerfile.proto -o type=local,dest=node .\` and commit the result" >&2 && exit 1)
2022-03-30 02:11:40 -07:00
2023-01-22 17:04:26 -08:00
# Run Go tests
node-tests :
# The tests are slow enough that we want to run it on the self-hosted runner
runs-on : tilt-kube-public
concurrency :
group : ${{ github.workflow }}-test-${{ github.ref }}
cancel-in-progress : true
steps :
- name : Clear repository
run : |
rm -rf $GITHUB_WORKSPACE && mkdir $GITHUB_WORKSPACE
- uses : actions/checkout@v2
- uses : actions/setup-go@v2
with :
2023-06-06 18:49:38 -07:00
go-version : "1.20.5"
2023-01-22 17:04:26 -08:00
# The go-ethereum and celo-blockchain packages both implement secp256k1 using the exact same header, but that causes duplicate symbols.
- name : Run golang tests
2023-05-23 23:51:51 -07:00
run : cd node && go test -v -timeout 1m -race -ldflags '-extldflags "-Wl,--allow-multiple-definition" ' ./...
2023-01-22 17:04:26 -08:00
2022-06-21 12:18:16 -07:00
# Run Rust lints and tests
2022-03-30 02:11:40 -07:00
rust-lint-and-tests :
runs-on : ubuntu-20.04
2022-09-30 03:28:26 -07:00
env :
RUSTFLAGS : -Dwarnings
2022-03-30 02:11:40 -07:00
strategy :
matrix :
manifest :
2022-09-30 03:28:26 -07:00
- cosmwasm/Cargo.toml
2022-03-30 02:11:40 -07:00
- terra/Cargo.toml
- sdk/rust/Cargo.toml
steps :
- name : Check out source
2022-09-30 03:28:26 -07:00
uses : actions/checkout@v3
2022-03-30 02:11:40 -07:00
2022-09-30 03:28:26 -07:00
- name : Install rust toolchain
uses : dtolnay/rust-toolchain@55c7845fad90d0ae8b2e83715cb900e5e861e8cb
2022-03-30 02:11:40 -07:00
with :
toolchain : stable
2022-09-30 03:28:26 -07:00
components : "clippy,rustfmt"
2022-03-30 02:11:40 -07:00
2022-09-30 03:28:26 -07:00
- name : Create cache key
id : cachekey
env :
MANIFEST : ${{ matrix.manifest }}
run : |
LOCKFILE="$(dirname "${MANIFEST}")/Cargo.lock"
NAME="${MANIFEST%%/*}"
HASH="$(sha256sum "${LOCKFILE}" | awk '{ print $1 }')"
echo "::set-output name=name::${NAME}"
echo "::set-output name=hash::${HASH}"
2022-04-01 00:21:21 -07:00
2022-09-30 03:28:26 -07:00
- name : Cache rust packages
uses : actions/cache@v3
2022-04-01 00:21:21 -07:00
with :
2022-09-30 03:28:26 -07:00
path : ~/.cargo/registry
key : ${{ runner.os }}-build-${{ steps.cachekey.outputs.name }}-${{ steps.cachekey.outputs.hash }}
restore-keys : |
${{ runner.os }}-build-${{ matrix.manifest }}-
- name : Run `rustfmt`
env :
MANIFEST : ${{ matrix.manifest }}
# In its infinite wisdom, `cargo fmt --all` will also format path-based dependencies so
# instead we have to manually format each ".rs" file.
run : find "$(dirname "${MANIFEST}")" -name '*.rs' -exec rustfmt --check {} +
- name : Run `cargo clippy`
run : cargo clippy --workspace --tests --locked --manifest-path ${{ matrix.manifest }}
- name : Run unit tests
run : cargo test --workspace --locked --manifest-path ${{ matrix.manifest }}
2022-07-06 12:05:30 -07:00
docker :
runs-on : ubuntu-latest
steps :
- name : Check out source
uses : actions/checkout@v2
- run : chmod 755 ./scripts/check-docker-pin.sh
- run : ./scripts/check-docker-pin.sh
2022-10-20 14:00:35 -07:00
npm-packages :
runs-on : ubuntu-latest
steps :
- name : Check out source
uses : actions/checkout@v2
- run : chmod 755 ./scripts/check-npm-package-scopes.sh
- run : ./scripts/check-npm-package-scopes.sh