Skip to content

Commit

Permalink
[ci] use libra-cli bin for faster CI runs (#308)
Browse files Browse the repository at this point in the history
  • Loading branch information
0o-de-lally committed Aug 18, 2024
1 parent 79d4c54 commit 6fb524f
Show file tree
Hide file tree
Showing 13 changed files with 85 additions and 132 deletions.
16 changes: 2 additions & 14 deletions .github/actions/build_env/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,11 @@ runs:
shell: bash
run: rustup component add rustfmt clippy

# - name: enable sccache
# uses: 0o-de-lally/sccache-action@2dd73efb90f3c9113a0cab8d983df6eb2b21fd20

- name: also rust cache
uses: Swatinem/rust-cache@v2.7.0
with:
shared-key: "libra"
cache-on-failure: "true"

- name: export diem-node DIEM_FORGE_NODE_BIN_PATH
shell: bash
run: echo "DIEM_FORGE_NODE_BIN_PATH=${{github.workspace}}/diem-node" >> $GITHUB_ENV

- name: install diem-node (for smoke tests)
shell: bash
run: >
wget -O $DIEM_FORGE_NODE_BIN_PATH https://github.com/0LNetworkCommunity/diem/releases/latest/download/diem-node &&
sudo chmod 755 $DIEM_FORGE_NODE_BIN_PATH &&
echo $DIEM_FORGE_NODE_BIN_PATH &&
ls -l $DIEM_FORGE_NODE_BIN_PATH
# call own action for libra_cli
- uses: 0LNetworkCommunity/libra-framework/.github/actions/get_cli@main
26 changes: 26 additions & 0 deletions .github/actions/get_cli/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: get cli bin
description: use pre-build libra-cli bin for CI
runs:
using: composite
steps:
- name: export diem-node DIEM_FORGE_NODE_BIN_PATH
shell: bash
run: |
echo "LIBRA_BIN=${{github.workspace}}/libra" >> $GITHUB_ENV
echo "DIEM_FORGE_NODE_BIN_PATH=${{github.workspace}}/libra" >> $GITHUB_ENV
# also have the file available in $PATH
echo ${{github.workspace}} >> $GITHUB_PATH
- name: install diem-node (for smoke tests)
shell: bash
run: >
wget -O $LIBRA_BIN https://github.com/0LNetworkCommunity/libra-framework/releases/download/ci-bins/libra &&
sudo chmod 755 $LIBRA_BIN
- name: print version
shell: bash
run: |
echo $LIBRA_BIN
echo $DIEM_FORGE_NODE_BIN_PATH
# for debugging, display the version, and ensure using the same aliases
${{github.workspace}}/libra version
libra version
25 changes: 9 additions & 16 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ name: rust ci

on:
push:
tags:
tags: # only on releases, not RC, since we've tested already
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+"
branches: ["**"] # glob pattern to allow slash /
pull_request:
types:
Expand All @@ -17,7 +16,6 @@ on:
- cron: "30 00 * * *"

env:
DIEM_FORGE_NODE_BIN_PATH: ${{github.workspace}}/diem-node
LIBRA_CI: 1
MODE_0L: "TESTNET"

Expand All @@ -28,17 +26,12 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: setup env
uses: ./.github/actions/build_env

- uses: Swatinem/rust-cache@v2.7.3
with:
shared-key: "libra-framework"
cache-all-crates: true
- uses: ./.github/actions/get_cli

- name: build framework
working-directory: ./framework
run: cargo r release
# uses the libra binary to compile faster, without needing to compile the Move compiler
run: ${{github.workspace}}/libra move framework release

- uses: actions/upload-artifact@v4.3.1
with:
Expand Down Expand Up @@ -265,17 +258,17 @@ jobs:
- uses: actions/checkout@v3

- name: setup env
if: ${{runner.environment == 'self-hosted'}}
# if: ${{runner.environment == 'self-hosted'}}
uses: ./.github/actions/build_env

- uses: actions/download-artifact@v4.1.2
if: ${{runner.environment == 'self-hosted'}}
# if: ${{runner.environment == 'self-hosted'}}
with:
name: framework-build
path: framework/
- name: rescue
# if: always()
if: ${{runner.environment == 'self-hosted'}}
if: always()
# if: ${{runner.environment == 'self-hosted'}}
working-directory: ./tools/rescue
run: RUST_MIN_STACK=104857600 cargo test --no-fail-fast -- --test-threads=1
storage:
Expand All @@ -294,7 +287,7 @@ jobs:
- name: storage
working-directory: ./tools/storage
# TODO: not testing the V6 file parsing
run: cargo test --no-fail-fast e2e_
run: cargo test --no-fail-fast

twin-testsuite:
timeout-minutes: 60
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/cleanliness.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: cleanliness
on:
push:
tags:
tags: # only on releases, not RC, since we've tested already
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+"
branches: ["**"] # glob pattern to allow slash /
pull_request:
types:
Expand Down Expand Up @@ -37,6 +36,10 @@ jobs:
command: fmt
args: --all -- --check

# TODO: clippy can share cache if build for tests is done prior
# - name: build for cache
# run: cargo build --tests --workspace

- name: clippy
uses: actions-rs/cargo@v1
with:
Expand Down
23 changes: 5 additions & 18 deletions .github/workflows/formal.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: formal verification
on:
push:
tags:
tags: # only on releases, not RC, since we've tested already
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+"
branches: ["**"] # glob pattern to allow slash /
pull_request:
types:
Expand All @@ -23,35 +22,23 @@ jobs:
formal:
runs-on: ubuntu-latest
steps:
# # NOTE: for debugging CI this allow shell access to github runner. Will print out tmate.io terminal url
# NOTE: for debugging CI this allow shell access to github runner. Will print out tmate.io terminal url
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
# with:
# detached: true
# timeout-minutes: 15
# timeout-minutes: 3

- uses: actions/checkout@v3

- name: setup env
uses: ./.github/actions/build_env

- uses: Swatinem/rust-cache@v2.7.3
with:
shared-key: "libra-framework"
cache-all-crates: true

- name: install prover dependencies
run: |
bash util/dev_setup.sh -byp
- name: install diem (for move tests)
run: |
wget -O ${{github.workspace}}/diem https://github.com/0LNetworkCommunity/diem/releases/latest/download/diem &&
chmod +x ${{github.workspace}}/diem &&
cp ${{github.workspace}}/diem ~/.cargo/bin
# Move framework tests
# TODO:
# Move prover tests
- name: prover tests
working-directory: ./framework
run: make prove
run: make -f prover.mk prove
16 changes: 4 additions & 12 deletions .github/workflows/move.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ name: move framework tests

on:
push:
tags:
tags: # only on releases, not RC, since we've tested already
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+"
branches: ["**"] # glob pattern to allow slash /
pull_request:
types:
Expand All @@ -27,17 +26,10 @@ jobs:

- uses: actions/checkout@v3

- name: install diem (for move tests)
run: >
wget -O ${{github.workspace}}/diem https://github.com/0LNetworkCommunity/diem/releases/latest/download/diem &&
chmod +x ${{github.workspace}}/diem
- uses: Swatinem/rust-cache@v2.7.3
with:
shared-key: "libra-framework"
cache-all-crates: true
- name: fetch libra cli
uses: ./.github/actions/get_cli

# Move framework tests
- name: move framework
working-directory: ./framework/libra-framework
run: ${{github.workspace}}/diem move test
run: $LIBRA_BIN move test
59 changes: 8 additions & 51 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
name: publish bin
name: publish cli
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+"
branches:
- "ci"
tags: # run this also on release candidates
- "[0-9]+.[0-9]+.[0-9]*"
# make binaries which may be ahead of releases to use in CI jobs
- "ci-bins"
jobs:
publish:
permissions:
write-all
# contents: write
name: publish
runs-on: ubuntu-latest
steps:
Expand All @@ -20,41 +18,14 @@ jobs:
# with:
# detached: true
# timeout-minutes: 15
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false

# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: true
swap-storage: true

- uses: dtolnay/rust-toolchain@1.70.0
with:
components: rustfmt

######## CACHE ########
- name: system packages
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: build-essential ca-certificates clang curl git libpq-dev libssl-dev pkg-config lsof lld libgmp-dev
version: 1.0

- name: checkout
uses: actions/checkout@v3

- name: sccache
uses: 0o-de-lally/sccache-action@local
- name: setup env
uses: ./.github/actions/build_env

# note: building in the same cargo command will lead to "feature unification", which leads to a `diem-node` binary which fails.
- name: libra release build
- name: build libra cli release
# size and performance optimized binary with profile.cli
run: cargo b --release -p libra

Expand All @@ -66,17 +37,3 @@ jobs:
tag: ${{ github.ref }}
overwrite: true
file_glob: true

# TODO
# - name: libra-framework release build
# # size and performance optimized binary with profile.cli
# run: cargo b --release -p libra-framework

# - name: CLI publish
# uses: svenstaro/upload-release-action@v2
# with:
# repo_token: ${{ secrets.GITHUB_TOKEN }}
# file: target/release/libra-framework
# tag: ${{ github.ref }}
# overwrite: true
# file_glob: true
Loading

0 comments on commit 6fb524f

Please sign in to comment.