-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/add-owner-operator-macros
- Loading branch information
Showing
38 changed files
with
942 additions
and
578 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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[alias] | ||
wasm = "build --release --lib --target wasm32-unknown-unknown --locked --workspace" | ||
unit-test = "test --lib" | ||
|
||
[build] | ||
rustdocflags = ["-D", "warnings"] |
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,66 @@ | ||
# Workflow to fetch the latest commit hash on the main branch and upload artifacts to CF storage. | ||
name: Build and upload from main | ||
on: | ||
workflow_dispatch: | ||
|
||
concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
|
||
jobs: | ||
stellar-contract-names: | ||
name: Get all Stellar contracts | ||
runs-on: blacksmith-2vcpu-ubuntu-2204 | ||
outputs: | ||
releases: ${{ steps.prepare-release.outputs.releases }} | ||
commit_hash: ${{ steps.get-commit-hash.outputs.hash }} | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install dependencies | ||
run: sudo apt-get install -y jq | ||
|
||
- name: Get latest commit hash | ||
id: get-commit-hash | ||
run: echo "hash=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" | ||
|
||
- name: Prepare JSON output for release | ||
id: prepare-release | ||
run: | | ||
RELEASES_JSON=$(find contracts -maxdepth 1 -mindepth 1 -type d | sed 's|contracts/||' | jq -R . | jq -s --arg commit "${{ steps.get-commit-hash.outputs.hash }}" 'map({ | ||
package_name: ., | ||
version: $commit, | ||
package_git_tag: "\(.)_\($commit)" | ||
})') | ||
echo "releases=$(echo "$RELEASES_JSON" | jq -c)" >> "$GITHUB_OUTPUT" | ||
build: | ||
needs: stellar-contract-names | ||
uses: ./.github/workflows/reusable-build.yaml | ||
with: | ||
commit-hash: ${{ needs.stellar-contract-names.outputs.commit_hash }} | ||
|
||
upload: | ||
needs: [stellar-contract-names, build] | ||
strategy: | ||
matrix: | ||
releases: ${{ fromJson(needs.stellar-contract-names.outputs.releases) }} | ||
|
||
uses: ./.github/workflows/reusable-upload.yaml | ||
permissions: | ||
id-token: write | ||
contents: read | ||
with: | ||
package-name: ${{ matrix.releases.package_name }} | ||
package-version: ${{ matrix.releases.version }} | ||
package-git-tag: ${{ matrix.releases.package_git_tag }} | ||
artifact-name: ${{ needs.build.outputs.artifact-name }} | ||
artifact-path: ${{ needs.build.outputs.artifact-path }} | ||
cf-bucket-name: ${{ vars.CF_BUCKET_NAME }} | ||
cf-config-bucket-root-key: ${{ vars.CF_BUCKET_ROOT_KEY }} | ||
github-release: false | ||
secrets: | ||
github-token: ${{ secrets.PAT_TOKEN }} | ||
cf-endpoint-url: ${{ secrets.CF_ENDPOINT_URL }} | ||
cf-bucket-access-key-id: ${{ secrets.CF_BUCKET_ACCESS_KEY_ID }} | ||
cf-bucket-secret-access-key: ${{ secrets.CF_BUCKET_SECRET_ACCESS_KEY }} |
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
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,67 @@ | ||
name: "Build Contracts" | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
commit-hash: | ||
description: "The commit hash to build from" | ||
type: string | ||
required: true | ||
outputs: | ||
artifact-name: | ||
description: "Name of the uploaded artifact containing all builds" | ||
value: ${{ jobs.build.outputs.artifact-name }} | ||
artifact-path: | ||
description: "Path of the uploaded artifact containing all builds" | ||
value: ${{ jobs.build.outputs.artifact-path }} | ||
|
||
jobs: | ||
build: | ||
runs-on: blacksmith-8vcpu-ubuntu-2204 | ||
outputs: | ||
artifact-name: ${{ steps.set-artifact-name.outputs.name }} | ||
artifact-path: ${{ steps.set-artifact-name.outputs.path }} | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Checkout specific commit | ||
run: git checkout ${{ inputs.commit-hash }} | ||
|
||
- name: Install Rust toolchain | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
toolchain: 1.81.0 | ||
targets: wasm32-unknown-unknown | ||
|
||
- name: Set artifact name | ||
id: set-artifact-name | ||
run: | | ||
echo "name=wasm-builds-${{ inputs.commit-hash }}" >> $GITHUB_OUTPUT | ||
echo "path=target/wasm32-unknown-unknown/release" >> $GITHUB_OUTPUT | ||
- name: Build all contracts | ||
run: | | ||
# Install Stellar CLI compatible with the soroban-sdk version in Cargo.toml | ||
cargo install --locked stellar-cli --version ^22 --features opt | ||
# Build all contracts | ||
stellar contract build | ||
./optimize.sh | ||
# Process in the release directory | ||
cd target/wasm32-unknown-unknown/release | ||
# Remove unoptimized files and rename optimized ones | ||
# This ensures we only keep the optimized versions | ||
find . -type f -name "*.wasm" ! -name "*.optimized.wasm" -maxdepth 1 -delete | ||
find . -name "*.optimized.wasm" -maxdepth 1 -exec sh -c 'mv "$0" "${0%.optimized.wasm}.wasm"' {} \; | ||
find . -type f ! -name "*.wasm" -delete | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ steps.set-artifact-name.outputs.name }} | ||
path: target/wasm32-unknown-unknown/release | ||
retention-days: 1 |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.