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

ci: changes to contract builds #605

Merged
merged 17 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ updates:
open-pull-requests-limit: 10
labels:
- "ci: skip-changelog"
- "ci: skip-build"
ignore:
- dependency-name: "cosmwasm-std"
update-types:
Expand All @@ -18,3 +19,4 @@ updates:
open-pull-requests-limit: 10
labels:
- "ci: skip-changelog"
- "ci: skip-build"
53 changes: 53 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build Contracts & Schemas

on:
pull_request:
branches: [main, development]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
name: Contracts
if: >
!contains(github.event.pull_request.labels.*.name, 'ci: skip-build')
steps:
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: 1.75.0
- run: rustup override set 1.75.0
- run: rustup target add wasm32-unknown-unknown
- uses: actions/checkout@v4
- name: Build
run: |
chmod +x "${GITHUB_WORKSPACE}/scripts/build_all.sh"
make build
sudo make version-map
crnbarr93 marked this conversation as resolved.
Show resolved Hide resolved
- name: Check contract sizes
run: |
chmod +x "${GITHUB_WORKSPACE}/.github/file-size.sh"
"${GITHUB_WORKSPACE}/.github/file-size.sh"
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: contracts
path: ./artifacts/
if-no-files-found: error

build-schemas:
runs-on: ubuntu-latest
name: Schemas
if: >
!contains(github.event.pull_request.labels.*.name, 'ci: skip-build')
steps:
- uses: actions/checkout@v4
- name: Build Schema
run: |
chmod +x "${GITHUB_WORKSPACE}/scripts/build_schema.sh"
make schemas
crnbarr93 marked this conversation as resolved.
Show resolved Hide resolved
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: schema
path: ./schemas/
if-no-files-found: error
4 changes: 1 addition & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,10 @@ jobs:
RUST_LOG: info
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: 1.76.0
components: rustfmt, clippy
profile: minimal
override: true
- name: Download Contracts
uses: actions/download-artifact@v4
with:
Expand Down
22 changes: 15 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ jobs:
- uses: actions/checkout@v4

- name: Optimize contracts
run: docker run --rm -v "$(pwd)":/code --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry cosmwasm/workspace-optimizer:0.16.1
run: make build

- name: Create version map
run: make version-map

- name: Generate schemas
run: |
./build_schema.sh
make schemas
tar -czf schemas.tar.gz schemas/

- name: Create artifacts archive
Expand All @@ -37,18 +40,23 @@ jobs:
```sh
git clone https://github.com/andromedaprotocol/andromeda-core.git
cd andromeda-core
docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/workspace-optimizer:0.16.1
make build
```

## Building the Contracts from Source (arm-64)
To build the contracts from source, you can use the following commands:
```sh
git clone https://github.com/andromedaprotocol/andromeda-core.git
cd andromeda-core
make build-arm
```

## Generating Schemas
To generate the schemas, you can use the following command:
```sh
git clone https://github.com/andromedaprotocol/andromeda-core.git
cd andromeda-core
./build_schema.sh
make schemas
```
draft: false
prerelease: false
Expand Down
92 changes: 10 additions & 82 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: 1.75.0
components: rustfmt, clippy
profile: minimal
override: true
- run: cargo fetch --verbose
- run: cargo clippy --all --all-targets -- -D warnings
- run: cargo fmt -- --check
- run: cargo fetch --quiet
- name: Run linting checks
run: |
cargo clippy --quiet --all --all-targets -- -D warnings &
cargo fmt -- --check &
wait

contract-tests:
name: Contract Tests
Expand All @@ -34,85 +35,12 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
test-type: ["integration-test", "unit-test"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: 1.75.0
profile: minimal
- run: cargo fetch --verbose
- run: cargo build
- run: cargo test --verbose --all --lib
env:
RUST_BACKTRACE: 1
- run: cargo test -p tests-integration --verbose
env:
RUST_BACKTRACE: 1

build:
runs-on: ubuntu-latest
name: Actions - build contracts and upload artifacts
needs: [contract-tests]
steps:
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.75.0
- run: rustup override set 1.75.0
- run: rustup target add wasm32-unknown-unknown
- uses: actions/checkout@v4
- name: Install Binaryen
run: |
chmod +x "${GITHUB_WORKSPACE}/scripts/install_binaryen.sh"
"${GITHUB_WORKSPACE}/scripts/install_binaryen.sh"
- name: Build
run: |
chmod +x "${GITHUB_WORKSPACE}/scripts/build.sh"
"${GITHUB_WORKSPACE}/scripts/build.sh" all
- name: Check contract sizes
run: |
chmod +x "${GITHUB_WORKSPACE}/.github/file-size.sh"
"${GITHUB_WORKSPACE}/.github/file-size.sh"
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: contracts
path: ./artifacts/
if-no-files-found: error

# ibc-tests:
# runs-on: ubuntu-latest
# name: Post Build - IBC Tests
# needs: build
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 1
# - name: Download Contracts
# uses: actions/download-artifact@v2
# with:
# name: contracts
# path: "./ibc-tests/contracts"
# - name: Run IBC Tests
# run: |
# cd ./ibc-tests
# npm i
# npm test

build-schemas:
runs-on: ubuntu-latest
name: Actions - build schemas
needs: contract-tests
steps:
- uses: actions/checkout@v4
- name: Build Schema
run: |
chmod +x "${GITHUB_WORKSPACE}/scripts/build_schema.sh"
"${GITHUB_WORKSPACE}/scripts/build_schema.sh"
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: schema
path: ./schemas/
if-no-files-found: error
- run: make ${{ matrix.test-type }}
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ attach-contract-versions:
# Runs unit tests
unit-test:
@echo "Running unit tests..."
@cargo unit-test --workspace
@cargo unit-test --workspace --quiet
@echo "Unit tests complete! \033[0;32m\xE2\x9C\x94\033[0m"

# Runs integration tests
integration-test:
@echo "Running integration tests..."
@cargo test -p tests-integration --verbose
@cargo test -p tests-integration --quiet
@echo "Integration tests complete! \033[0;32m\xE2\x9C\x94\033[0m"

# Runs all tests
Expand All @@ -65,7 +65,7 @@ test: unit-test integration-test
# Optional env vars:
# DEPLOYMENT_KERNEL_ADDRESS - For updating kernel address
# SLACK_WEBHOOK_URL - For Slack notifications
deploy: build make-version-map
deploy: build version-map
@echo "Deploying OS..."
@test -n "$$DEPLOYMENT_CHAIN" || (echo "Error: DEPLOYMENT_CHAIN is required" && exit 1)
@test -n "$$TEST_MNEMONIC" || (echo "Error: TEST_MNEMONIC is required" && exit 1)
Expand Down
7 changes: 0 additions & 7 deletions packages/std/src/ado_contract/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@ impl<'a> ADOContract<'a> {
self.app_contract
.save(deps.storage, &deps.api.addr_validate(&address)?)?;
self.validate_andr_addresses(&deps.as_ref(), addresses.unwrap_or_default())?;
#[cfg(feature = "modules")]
{
let modules = self.load_modules(deps.storage)?;
for module in modules {
self.validate_module_address(&deps.as_ref(), &module)?;
}
}
Ok(Response::new()
.add_attribute("action", "update_app_contract")
.add_attribute("address", address))
Expand Down