-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from babylonlabs-io/fix/ci-github-actions
Add GH actions workflow (unit tests)
- Loading branch information
Showing
4 changed files
with
170 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: babylonchain/babylon-contract/benchmarking-WIP | ||
on: | ||
push: | ||
branches: [ "disabled" ] | ||
pull_request: | ||
branches: [ "disabled" ] | ||
env: | ||
CARGO_TERM_COLOR: always | ||
jobs: | ||
benchmarking: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: rust:1.78.0 | ||
steps: | ||
- uses: actions/checkout@v4.1.0 | ||
- name: Run babylon contract benchmarks | ||
run: |- | ||
cargo bench --locked -p babylon-contract -- --color never --save-baseline btc_light_client | ||
working-directory: "./contracts/babylon" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
name: babylonchain/babylon-contract/deploy-WIP | ||
on: | ||
push: | ||
branches: [ "disabled" ] | ||
pull_request: | ||
branches: [ "disabled" ] | ||
env: | ||
AWS_ACCESS_KEY_ID: xxxxYKF5 | ||
AWS_REGION: xxxxst-1 | ||
AWS_SECRET_ACCESS_KEY: xxxxmvcn | ||
DEPLOY_KEY_NAME: xxxxc068 | ||
GITHUB_TOKEN: xxxxFyIu | ||
S3_BUCKET_PREFIX: xxxxract | ||
jobs: | ||
build_and_upload_contracts: | ||
defaults: | ||
run: | ||
working-directory: "/__w/babylon-contract/babylon-contract" | ||
runs-on: ubuntu-latest | ||
container: | ||
image: rust:1.78.0 | ||
steps: | ||
- uses: actions/checkout@v4.1.0 | ||
with: | ||
path: "/__w/babylon-contract/babylon-contract" | ||
- name: Make temporary bin | ||
run: mkdir -p /tmp/bin | ||
- name: Install ghr | ||
run: wget https://github.com/tcnksm/ghr/releases/download/v0.14.0/ghr_v0.14.0_linux_amd64.tar.gz -O - | tar -zxvf - -C /tmp/bin --wildcards --strip-components 1 */ghr | ||
- name: Build optimised Wasm binaries | ||
run: "./scripts/build-optimizer-ci.sh" | ||
- uses: actions/upload-artifact@v4.1.0 | ||
with: | ||
path: |- | ||
/__w/babylon-contract/babylon-contract/artifacts/babylon_contract.wasm | ||
/__w/babylon-contract/babylon-contract/artifacts/btc_staking.wasm | ||
/__w/babylon-contract/babylon-contract/artifacts/checksums.txt | ||
- name: Show data | ||
run: |- | ||
ls -l artifacts | ||
cat artifacts/checksums.txt | ||
- name: Publish artifacts on GitHub | ||
run: |- | ||
TAG="${{ github.ref }}" | ||
TITLE="$TAG" | ||
BODY="Attached there are some build artifacts generated at this tag. Those are for development purposes only! Please use crates.io to find the packages of this release." | ||
/tmp/bin/ghr -t "$GITHUB_TOKEN" \ | ||
-u "$CIRCLE_PROJECT_USERNAME" -r "${{ github.repository }}" \ | ||
-c "${{ github.sha }}" \ | ||
-n "$TITLE" -b "$BODY" \ | ||
-replace \ | ||
"$TAG" ./artifacts/ | ||
build_and_upload_schemas: | ||
defaults: | ||
run: | ||
working-directory: "/__w/babylon-contract/babylon-contract" | ||
runs-on: ubuntu-latest | ||
container: | ||
image: rust:1.78.0 | ||
steps: | ||
- uses: actions/checkout@v4.1.0 | ||
with: | ||
path: "/__w/babylon-contract/babylon-contract" | ||
- name: Make temporary bin | ||
run: mkdir -p /tmp/bin | ||
- name: Install ghr | ||
run: wget https://github.com/tcnksm/ghr/releases/download/v0.14.0/ghr_v0.14.0_linux_amd64.tar.gz -O - | tar -zxvf - -C /tmp/bin --wildcards --strip-components 1 */ghr | ||
- name: Build and run schema generator | ||
run: |- | ||
(cd ./contracts/babylon && cargo run --bin schema) | ||
(cd ./contracts/btc-staking && cargo run --bin btcstaking-schema) | ||
- name: Consolidate schemas | ||
run: |- | ||
mkdir -p ./schemas | ||
cp -a ./contracts/*/schema/* ./schemas | ||
- name: Show data | ||
run: ls -l ./schemas | ||
- name: Publish schemas on GitHub | ||
run: |- | ||
TAG="${{ github.ref }}" | ||
TITLE="$TAG" | ||
BODY="Attached there are some schemas and build artifacts generated at this tag. Those are for development purposes only! Please use crates.io to find the packages of this release." | ||
/tmp/bin/ghr -t "$GITHUB_TOKEN" \ | ||
-u "$CIRCLE_PROJECT_USERNAME" -r "${{ github.repository }}" \ | ||
-c "${{ github.sha }}" \ | ||
-n "$TITLE" -b "$BODY" \ | ||
-replace \ | ||
"$TAG" ./schemas/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: babylonchain/babylon-contract/local-tests | ||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
env: | ||
CARGO_TERM_COLOR: always | ||
jobs: | ||
local-build-test: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: rust:1.78.0 | ||
steps: | ||
- uses: actions/checkout@v4.1.0 | ||
- name: Build contracts, check formats, and run unit tests | ||
run: cargo test --lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: babylonchain/babylon-contract/wasm-tests-WIP | ||
on: | ||
push: | ||
branches: [ "disabled" ] | ||
pull_request: | ||
branches: [ "disabled" ] | ||
env: | ||
CARGO_TERM_COLOR: always | ||
AWS_ACCESS_KEY_ID: xxxxYKF5 | ||
AWS_REGION: xxxxst-1 | ||
AWS_SECRET_ACCESS_KEY: xxxxmvcn | ||
S3_BUCKET_PREFIX: xxxxract | ||
jobs: | ||
wasm-build-check-integration: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: rust:1.78.0 | ||
steps: | ||
- uses: actions/checkout@v4.1.0 | ||
- name: Build optimised Wasm binaries | ||
run: "./scripts/build-optimizer-ci.sh" | ||
- name: Install cosmwasm-check | ||
run: cargo install --locked --debug --version ^2.0 cosmwasm-check | ||
- name: Check the Wasm binaries' validity | ||
run: cosmwasm-check /__w/babylon-contract/babylon-contract/artifacts/*.wasm | ||
- name: Integration tests based on CosmWasm | ||
run: cargo test --test integration | ||
- uses: actions/upload-artifact@v4.1.0 | ||
with: | ||
path: |- | ||
./artifacts/babylon_contract.wasm | ||
./artifacts/btc_staking.wasm | ||
push-to-s3: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- wasm-build-check-integration | ||
steps: | ||
- uses: actions/download-artifact@v4.1.0 | ||
with: | ||
path: "/tmp" | ||
- uses: aws-actions/configure-aws-credentials@v4.0.1 | ||
with: | ||
aws-region: "${{ env.AWS_REGION }}" | ||
aws-access-key-id: "${{ secrets.AWS_ACCESS_KEY_ID }}" | ||
aws-secret-access-key: "${{ secrets.AWS_SECRET_ACCESS_KEY }}" | ||
- run: aws s3 cp /tmp/babylon_contract.wasm $S3_BUCKET_PREFIX/${{ github.repository }}-${{ github.sha }}.wasm |