-
Notifications
You must be signed in to change notification settings - Fork 127
Add CI for soroban-examples and OZ contracts #2424
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
ce64f82
add CI workflows for OpenZeppelin and soroban-examples
leighmcculloch 6dc9657
reformat concurrency group onto single line in CI workflows
leighmcculloch d99ceae
remove upload jobs from CI workflows
leighmcculloch bd735c9
verify env-meta and meta in CI workflows
leighmcculloch 696c6d1
move complete job to top of CI workflows
leighmcculloch b1cffe8
use make install in CI workflows
leighmcculloch d5ac9cf
scope wasm find to matrix dir in CI workflows
leighmcculloch 3f21e1c
scope wasm find to repo root in CI workflow
leighmcculloch 3971ffe
Merge branch 'main' into more-tests
leighmcculloch 6d9fb97
Merge branch 'main' into more-tests
leighmcculloch 915db83
add spec-verify step to CI workflows
leighmcculloch 79c07fe
replace contract build command with make in CI workflow
leighmcculloch afae923
remove default working-directory from test matrix job
leighmcculloch e137654
remove complete job from CI workflows
leighmcculloch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,101 @@ | ||
| name: Test with OpenZeppelin contracts | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main, release/**] | ||
| pull_request: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref_protected == 'true' && github.sha || github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: {} | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| jobs: | ||
| build-cli: | ||
| runs-on: ubuntu-latest-8-cores | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - uses: stellar/actions/rust-cache@main | ||
| - run: rustup update | ||
| - run: sudo apt update && sudo apt install -y libudev-dev libdbus-1-dev | ||
| - run: make install | ||
| - uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: stellar-cli | ||
| path: ~/.cargo/bin/stellar | ||
|
|
||
| collect-crates: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| dirs: ${{ steps.dirs.outputs.dirs }} | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| repository: OpenZeppelin/stellar-contracts | ||
| - id: dirs | ||
| run: | | ||
| dirs=$(cargo metadata --no-deps --format-version 1 \ | ||
| | jq -r --arg pwd "$(pwd)" \ | ||
| '[.workspace_members[] as $id | .packages[] | select(.id == $id) | select(any(.dependencies[]; .name == "soroban-sdk") and any(.targets[]; any(.crate_types[]; . == "cdylib"))) | .manifest_path | sub("^\($pwd)/"; "") | sub("/Cargo.toml$"; "")] | tojson' \ | ||
| ) | ||
| echo "dirs=$dirs" | tee -a $GITHUB_OUTPUT | ||
|
|
||
| build-crate: | ||
| needs: [build-cli, collect-crates] | ||
| if: ${{ needs.collect-crates.outputs.dirs != '[]' }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| dir: ${{ fromJSON(needs.collect-crates.outputs.dirs) }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| repository: OpenZeppelin/stellar-contracts | ||
| - uses: actions/download-artifact@v4 | ||
| with: | ||
| name: stellar-cli | ||
| path: stellar-cli | ||
| - run: chmod +x stellar-cli/stellar | ||
| - run: echo "${{ github.workspace }}/stellar-cli" >> $GITHUB_PATH | ||
| - run: rustup update | ||
| - run: rustup target add wasm32v1-none | ||
| - name: Build ${{ matrix.dir }} | ||
| run: stellar contract build --manifest-path ${{ matrix.dir }}/Cargo.toml | ||
| - name: Find wasm | ||
| id: find-wasm | ||
| run: | | ||
| wasm=$(find . -name '*.wasm' -path '*/wasm32v1-none/*' | head -1) | ||
| echo "wasm=$wasm" | tee -a $GITHUB_OUTPUT | ||
|
leighmcculloch marked this conversation as resolved.
|
||
| - name: Verify interface | ||
| run: | | ||
| output=$(stellar contract info interface --wasm ${{ steps.find-wasm.outputs.wasm }} --output json) | ||
| echo "$output" | ||
| count=$(echo "$output" | jq 'length') | ||
| if [ "$count" -lt 1 ]; then | ||
| echo "ERROR: interface is empty" | ||
| exit 1 | ||
| fi | ||
|
leighmcculloch marked this conversation as resolved.
|
||
| - name: Verify env-meta | ||
| run: | | ||
| output=$(stellar contract info env-meta --wasm ${{ steps.find-wasm.outputs.wasm }} --output json) | ||
| echo "$output" | ||
| if [ "$(echo "$output" | jq 'length')" -lt 1 ]; then | ||
| echo "ERROR: env-meta is empty" | ||
| exit 1 | ||
| fi | ||
| - name: Verify meta | ||
| run: | | ||
| output=$(stellar contract info meta --wasm ${{ steps.find-wasm.outputs.wasm }} --output json) | ||
| echo "$output" | ||
| if [ "$(echo "$output" | jq 'length')" -lt 1 ]; then | ||
| echo "ERROR: meta is empty" | ||
| exit 1 | ||
| fi | ||
| - name: Verify spec | ||
| run: stellar contract spec-verify --wasm ${{ steps.find-wasm.outputs.wasm }} | ||
This file contains hidden or 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,109 @@ | ||
| name: Test with soroban-examples | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main, release/**] | ||
| pull_request: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref_protected == 'true' && github.sha || github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: {} | ||
|
leighmcculloch marked this conversation as resolved.
|
||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| jobs: | ||
| build-cli: | ||
| runs-on: ubuntu-latest-8-cores | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - uses: stellar/actions/rust-cache@main | ||
| - run: rustup update | ||
| - run: sudo apt update && sudo apt install -y libudev-dev libdbus-1-dev | ||
| - run: make install | ||
| - uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: stellar-cli | ||
| path: ~/.cargo/bin/stellar | ||
|
|
||
| collect-examples: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| dirs: ${{ steps.dirs.outputs.dirs }} | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| repository: stellar/soroban-examples | ||
| ref: main | ||
| - id: dirs | ||
| run: | | ||
| dirs=$( | ||
| for dir in $(find . -type f -name 'Makefile' -mindepth 2 | xargs dirname | sed 's|^\./||'); do | ||
| if (cargo metadata --manifest-path "$dir/Cargo.toml" --no-deps --format-version 1 \ | ||
| | jq -r \ | ||
| '.packages[0] | (any(.dependencies[]; .name == "soroban-sdk") and any(.targets[]; any(.crate_types[]; . == "cdylib")))' \ | ||
| | grep -q '^true$'); then | ||
| echo "$dir" | ||
| fi | ||
| done | jq -Rnc '[inputs | "\(.)"]' | ||
| ) | ||
| echo "dirs=$dirs" | tee -a $GITHUB_OUTPUT | ||
|
|
||
| build-example: | ||
| needs: [build-cli, collect-examples] | ||
| if: ${{ needs.collect-examples.outputs.dirs != '[]' }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| dir: ${{ fromJSON(needs.collect-examples.outputs.dirs) }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| repository: stellar/soroban-examples | ||
| ref: main | ||
| - uses: actions/download-artifact@v4 | ||
| with: | ||
| name: stellar-cli | ||
| path: stellar-cli | ||
| - run: chmod +x stellar-cli/stellar | ||
| - run: echo "${{ github.workspace }}/stellar-cli" >> $GITHUB_PATH | ||
| - run: rustup update | ||
| - run: rustup target add wasm32v1-none | ||
| - name: Build ${{ matrix.dir }} | ||
| run: make -C ${{ matrix.dir }} build | ||
| - name: Find wasm | ||
| id: find-wasm | ||
| run: | | ||
| wasm=$(find ${{ matrix.dir }}/target -name '*.wasm' -path '*/wasm32v1-none/*' | head -1) | ||
| echo "wasm=$wasm" | tee -a $GITHUB_OUTPUT | ||
| - name: Verify interface | ||
| run: | | ||
| output=$(stellar contract info interface --wasm ${{ steps.find-wasm.outputs.wasm }} --output json) | ||
| echo "$output" | ||
| count=$(echo "$output" | jq 'length') | ||
| if [ "$count" -lt 1 ]; then | ||
| echo "ERROR: interface is empty" | ||
| exit 1 | ||
| fi | ||
|
leighmcculloch marked this conversation as resolved.
|
||
| - name: Verify env-meta | ||
| run: | | ||
| output=$(stellar contract info env-meta --wasm ${{ steps.find-wasm.outputs.wasm }} --output json) | ||
| echo "$output" | ||
| if [ "$(echo "$output" | jq 'length')" -lt 1 ]; then | ||
| echo "ERROR: env-meta is empty" | ||
| exit 1 | ||
| fi | ||
| - name: Verify meta | ||
| run: | | ||
| output=$(stellar contract info meta --wasm ${{ steps.find-wasm.outputs.wasm }} --output json) | ||
| echo "$output" | ||
| if [ "$(echo "$output" | jq 'length')" -lt 1 ]; then | ||
| echo "ERROR: meta is empty" | ||
| exit 1 | ||
| fi | ||
| - name: Verify spec | ||
| run: stellar contract spec-verify --wasm ${{ steps.find-wasm.outputs.wasm }} | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.