Skip to content

Bump docker/build-push-action from 3 to 5 #207

Bump docker/build-push-action from 3 to 5

Bump docker/build-push-action from 3 to 5 #207

Workflow file for this run

name: Tests
on: [push]
jobs:
Enclave-Unit-Tests:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
name: Pull git submodules
- name: Install Intel's SGX SDK
run: |
mkdir -p "$HOME/.sgxsdk"
cd "$HOME/.sgxsdk"
SDK_BIN=sgx_linux_x64_sdk_2.17.101.1.bin
wget https://download.01.org/intel-sgx/sgx-linux/2.17.1/distro/ubuntu20.04-server/"$SDK_BIN"
chmod +x "$SDK_BIN"
echo yes | ./"$SDK_BIN"
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache xargo sysroot
uses: actions/cache@v3
with:
path: ~/.xargo
key: ${{ runner.os }}-xargo-sysroot
- name: Cache build artifacts
uses: actions/cache@v3
with:
path: ~/.cache/sccache
key: ${{ runner.os }}-sccache
- run: |
rustup component add rust-src clippy
cd cosmwasm/enclaves/execute/
rustup component add rust-src clippy
- name: Install xargo
run: |
cargo --version
rustc --version
cargo +stable install xargo --version 0.3.25
xargo --version
- name: Download sccache
run: |
wget https://github.com/mozilla/sccache/releases/download/0.2.13/sccache-0.2.13-x86_64-unknown-linux-musl.tar.gz
tar xf ./sccache-*.tar.gz
mv ./sccache*/sccache "$HOME/sccache"
- name: Test enclave
run: |
source "$HOME/.sgxsdk/sgxsdk/environment"
export SGX_MODE=SW
RUSTC_WRAPPER="$HOME/sccache" make enclave-tests
make clean-enclave
Build-Contracts:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Download sccache
run: |
wget https://github.com/mozilla/sccache/releases/download/0.2.13/sccache-0.2.13-x86_64-unknown-linux-musl.tar.gz
tar xf ./sccache-*.tar.gz
mv ./sccache*/sccache "$HOME/sccache"
- name: Install Requirements
run: |
rustup target add wasm32-unknown-unknown
chmod +x ./scripts/install-wasm-tools.sh
./scripts/install-wasm-tools.sh
- name: Build Contracts
run: |
make build-test-contract
cp x/compute/internal/keeper/testdata/erc20.wasm .
- uses: actions/upload-artifact@v3
with:
name: erc20.wasm
path: erc20.wasm
- uses: actions/upload-artifact@v3
with:
name: contract.wasm
path: cosmwasm/contracts/v010/compute-tests/test-compute-contract/contract.wasm
- uses: actions/upload-artifact@v3
with:
name: v1-contract.wasm
path: cosmwasm/contracts/v1/compute-tests/test-compute-contract/v1-contract.wasm
- uses: actions/upload-artifact@v3
with:
name: ibc.wasm
path: cosmwasm/contracts/v1/compute-tests/ibc-test-contract/ibc.wasm
- uses: actions/upload-artifact@v3
with:
name: contract_with_floats.wasm
path: cosmwasm/contracts/v010/compute-tests/test-compute-contract/contract_with_floats.wasm
- uses: actions/upload-artifact@v3
with:
name: too-high-initial-memory.wasm
path: cosmwasm/contracts/v010/compute-tests/test-compute-contract/too-high-initial-memory.wasm
- uses: actions/upload-artifact@v3
with:
name: static-too-high-initial-memory.wasm
path: cosmwasm/contracts/v010/compute-tests/test-compute-contract/static-too-high-initial-memory.wasm
Go-Tests:
runs-on: ubuntu-20.04
needs: [Build-Contracts, Build-LocalSecret]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/setup-go@v3
with:
go-version: 1.19 # The Go version to download (if necessary) and use.
- name: Install Intel's SGX SDK
run: |
mkdir -p "$HOME/.sgxsdk"
cd "$HOME/.sgxsdk"
SDK_BIN=sgx_linux_x64_sdk_2.17.101.1.bin
wget https://download.01.org/intel-sgx/sgx-linux/2.17.1/distro/ubuntu20.04-server/"$SDK_BIN"
chmod +x "$SDK_BIN"
echo yes | ./"$SDK_BIN"
- name: Download LocalSecret
uses: actions/download-artifact@v3
with:
name: localsecret
path: /tmp
- name: Load images
run: |
docker load --input /tmp/localsecret.tar
docker run -v $PWD:/opt/mount --rm --entrypoint cp ghcr.io/scrtlabs/localsecret:v0.0.0 /usr/bin/secretd /opt/mount/secretd
docker run -v $PWD:/opt/mount --rm --entrypoint cp ghcr.io/scrtlabs/localsecret:v0.0.0 /usr/lib/libgo_cosmwasm.so /opt/mount/libgo_cosmwasm.so
docker run -v $PWD:/opt/mount --rm --entrypoint cp ghcr.io/scrtlabs/localsecret:v0.0.0 /usr/lib/librust_cosmwasm_enclave.signed.so /opt/mount/librust_cosmwasm_enclave.signed.so
- uses: actions/download-artifact@v3
with:
name: contract.wasm
- uses: actions/download-artifact@v3
with:
name: v1-contract.wasm
path: ./x/compute/internal/keeper/testdata/
- uses: actions/download-artifact@v3
with:
name: ibc.wasm
path: ./x/compute/internal/keeper/testdata/
- uses: actions/download-artifact@v3
with:
name: contract_with_floats.wasm
- uses: actions/download-artifact@v3
with:
name: too-high-initial-memory.wasm
- uses: actions/download-artifact@v3
with:
name: static-too-high-initial-memory.wasm
- name: Setup Files
run: |
find "$(pwd)" -name \*.wasm
cp libgo_cosmwasm.so ./go-cosmwasm/api/libgo_cosmwasm.so
cp librust_cosmwasm_enclave.signed.so ./go-cosmwasm/librust_cosmwasm_enclave.signed.so
cp contract.wasm ./x/compute/internal/keeper/testdata/contract.wasm
cp too-high-initial-memory.wasm ./x/compute/internal/keeper/testdata/too-high-initial-memory.wasm
cp contract_with_floats.wasm ./x/compute/internal/keeper/testdata/contract_with_floats.wasm
cp static-too-high-initial-memory.wasm ./x/compute/internal/keeper/testdata/static-too-high-initial-memory.wasm
find "$(pwd)" -name \*.wasm
- name: Test x/registration
run: |
source "$HOME/.sgxsdk/sgxsdk/environment"
go test -v -tags "secretcli" ./x/registration/internal/...
- name: Test x/compute
run: |
source "$HOME/.sgxsdk/sgxsdk/environment"
export SGX_MODE=SW
cp librust_cosmwasm_enclave.signed.so ./x/compute/internal/keeper
mkdir -p ias_keys/develop
mkdir -p /opt/secret/.sgx_secrets/
echo "not_a_key" > ias_keys/develop/spid.txt
echo "not_a_key" > ias_keys/develop/api_key.txt
LOG_LEVEL=ERROR go test -v -tags "test" ./x/compute/client/...
LOG_LEVEL=ERROR go test -p 1 -timeout 90m -v -tags "test" ./x/compute/internal/...
Clippy:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Intel's SGX SDK
run: |
mkdir -p "$HOME/.sgxsdk"
cd "$HOME/.sgxsdk"
SDK_BIN=sgx_linux_x64_sdk_2.17.101.1.bin
wget https://download.01.org/intel-sgx/sgx-linux/2.17.1/distro/ubuntu20.04-server/"$SDK_BIN"
chmod +x "$SDK_BIN"
echo yes | ./"$SDK_BIN"
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache xargo sysroot
uses: actions/cache@v3
with:
path: ~/.xargo
key: ${{ runner.os }}-xargo-sysroot
- name: Cache build artifacts
uses: actions/cache@v3
with:
path: ~/.cache/sccache
key: ${{ runner.os }}-sccache
- run: |
rustup component add rust-src clippy
cd cosmwasm/enclaves/execute/
rustup component add rust-src clippy
cd - && cd check-hw
rustup component add rust-src clippy
- name: Install xargo
run: |
cd cosmwasm/enclaves/execute/
cargo --version
rustc --version
cargo +stable install xargo --version 0.3.25
xargo --version
- name: Download sccache
run: |
wget https://github.com/mozilla/sccache/releases/download/0.2.13/sccache-0.2.13-x86_64-unknown-linux-musl.tar.gz
tar xf ./sccache-*.tar.gz
mv ./sccache*/sccache "$HOME/sccache"
- name: Clippy
run: |
source "$HOME/.sgxsdk/sgxsdk/environment"
mkdir -p ias_keys/production
echo "not_a_key" > ias_keys/production/api_key.txt
SGX_MODE=SW make clippy
SGX_MODE=HW make clippy
MacOS-ARM64-CLI:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/setup-go@v3
with:
go-version: 1.19 # The Go version to download (if necessary) and use.
- name: Install xgo
run: |
go install github.com/crazy-max/[email protected]
xgo || true # check installation
- name: Build MacOS CLI
run: make build_macos_arm64_cli
Build-LocalSecret:
runs-on: ubuntu-20.04
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver-opts: network=host
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Build LocalSecret
uses: docker/build-push-action@v5
with:
file: deployment/dockerfiles/Dockerfile
context: .
load: true
tags: ghcr.io/scrtlabs/localsecret:v0.0.0
secrets: |
API_KEY=00000000000000000000000000000000
SPID=FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
build-args: |
SECRET_NODE_TYPE=BOOTSTRAP
CHAIN_ID=secretdev-1
FEATURES=debug-print
SGX_MODE=SW
target: build-localsecret
cache-from: type=gha
cache-to: type=gha,mode=max
outputs: type=docker,dest=/tmp/localsecret.tar
- name: Upload Image
uses: actions/upload-artifact@v3
with:
name: localsecret
path: /tmp/localsecret.tar
Build-Hermes:
runs-on: ubuntu-20.04
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- uses: actions/checkout@v3
- name: Build Hermes Image
uses: docker/build-push-action@v5
with:
file: deployment/dockerfiles/ibc/hermes.Dockerfile
context: deployment/dockerfiles/ibc
load: true
tags: hermes:v0.0.0
build-args: |
SECRET_NODE_TYPE=BOOTSTRAP
CHAIN_ID=secretdev-1
outputs: type=docker,dest=/tmp/hermes.tar
- name: Upload Image
uses: actions/upload-artifact@v3
with:
name: hermes
path: /tmp/hermes.tar
Integration-Tests:
runs-on: ubuntu-20.04
needs: [Build-LocalSecret, Build-Hermes]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Download Hermes
uses: actions/download-artifact@v3
with:
name: hermes
path: /tmp
- name: Download LocalSecret
uses: actions/download-artifact@v3
with:
name: localsecret
path: /tmp
- name: Load images
run: |
docker load --input /tmp/localsecret.tar
docker load --input /tmp/hermes.tar
- name: Run integration tests
run: |
cd integration-tests
yarn
docker compose -f ../deployment/dockerfiles/ibc/docker-compose.yml up -d
yarn test
make kill-localsecret # next step needs the localsecret ports
- name: Run secret.js tests
run: |
git clone --depth 1 --branch master https://github.com/scrtlabs/secret.js
cd secret.js
# Use the docker images that we built just a few steps above
perl -i -pe 's/localsecret:.+?"/localsecret:v0.0.0"/' ./test/docker-compose.yml
yarn
docker compose -f ./test/docker-compose.yml up -d
yarn test-ci
make kill-localsecret