-
Notifications
You must be signed in to change notification settings - Fork 2
Smoke test #115
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
Smoke test #115
Changes from 5 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
0b3759f
Try smoke test
ernest-nowacki 55d0cf0
Potential fix for code scanning alert no. 17: Cache Poisoning via exe…
ernest-nowacki b6801a6
Update workflow to fix downloading cre cli
ernest-nowacki 791b874
Add better triggering
ernest-nowacki 0e1d8a9
fix on comment issue
ernest-nowacki b086e1d
Smoke test again
ernest-nowacki ae20ed9
Use proper binary name structure
ernest-nowacki 1c726e9
Merge branch 'main' of github.com:smartcontractkit/cre-sdk-typescript…
ernest-nowacki 3d38a41
Rework smoke test action to start small
ernest-nowacki 79ab9d2
Install zsh
ernest-nowacki a6b4586
Specifically state permissions and pin bun install action to commit
ernest-nowacki a12083f
Add full checks now instead of just lint
ernest-nowacki 4d646ba
Add rust toolchain installation
ernest-nowacki 206f42e
Make sure we do check out the submodules too
ernest-nowacki e1a2f09
Try installing CRE CLI and see if it would work on the CI
ernest-nowacki 38b0bba
Change the version we use for ubuntu-latest
ernest-nowacki 7ace272
Simulate the hello world workflow
ernest-nowacki 0d2bce9
Add a step to setup env variables
ernest-nowacki d8cfedd
Add proper key to simulate workflow using headless
ernest-nowacki 6d0e658
Add actual expectations
ernest-nowacki c2dd4fe
Try improving validation step to properly match expected outcome
ernest-nowacki dc04971
Make CRE CLI simulation part of CI checks
ernest-nowacki d84f7f1
Restore full-checks as a name to pass the required checks
ernest-nowacki 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,150 @@ | ||
| name: Smoke Test | ||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| jobs: | ||
| smoke-test: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| # Run for pull requests targeting main branch | ||
| if: github.event_name == 'pull_request' | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | ||
| with: | ||
| submodules: recursive | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Install system dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y make zsh curl libclang-dev git build-essential | ||
|
|
||
| - name: Install asdf and toolchain from .tool-versions | ||
| run: | | ||
| # Install asdf with specific version and verification | ||
| ASDF_VERSION="v0.14.0" | ||
| git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch "$ASDF_VERSION" --depth 1 | ||
|
|
||
| # Make asdf available to subsequent steps without re-sourcing | ||
| echo "$HOME/.asdf/bin" >> $GITHUB_PATH | ||
| echo "$HOME/.asdf/shims" >> $GITHUB_PATH | ||
|
|
||
| # Init asdf | ||
| source ~/.asdf/asdf.sh | ||
|
|
||
| # Add plugins required for the project with verification | ||
| asdf plugin add bun || echo "bun plugin already exists" | ||
| asdf plugin add golang || echo "golang plugin already exists" | ||
| asdf plugin add rust || echo "rust plugin already exists" | ||
| asdf plugin add nodejs || echo "nodejs plugin already exists" | ||
|
|
||
| # Install all versions pinned in .tool-versions | ||
| asdf install | ||
| asdf reshim | ||
|
|
||
| # Add Rust target for WASM (asdf-rust uses rustup under the hood) | ||
| rustup target add wasm32-wasip1 | ||
|
|
||
| - name: Install dependencies | ||
| run: bun install | ||
|
|
||
| - name: Run full checks | ||
| run: bun full-checks | ||
|
|
||
| - name: Download and install cre-cli (ubuntu-latest) | ||
|
||
| env: | ||
| CRE_CLI_TAG: v0.6.1-alpha.0 | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| # Validate tag format to prevent injection | ||
| if [[ ! "$CRE_CLI_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.-]+)?$ ]]; then | ||
| echo "Invalid tag format: $CRE_CLI_TAG"; exit 1 | ||
| fi | ||
|
|
||
| # Map runner arch to release naming | ||
| case "$(uname -m)" in | ||
| x86_64|amd64) ARCH=amd64 ;; | ||
| aarch64|arm64) ARCH=arm64 ;; | ||
| *) echo "Unsupported arch: $(uname -m)"; exit 1 ;; | ||
| esac | ||
|
|
||
| ASSET="cre_linux_${ARCH}.tar.gz" | ||
| BASE_URL="https://github.com/smartcontractkit/cre-cli/releases/download/${CRE_CLI_TAG}" | ||
|
|
||
| echo "Downloading ${ASSET} and checksums.txt from ${CRE_CLI_TAG}..." | ||
| # Use more secure curl options | ||
| curl -fsSL --retry 3 --retry-delay 2 --max-time 300 \ | ||
| --proto '=https' --tlsv1.2 \ | ||
| -o "${ASSET}" "${BASE_URL}/${ASSET}" | ||
| curl -fsSL --retry 3 --retry-delay 2 --max-time 300 \ | ||
| --proto '=https' --tlsv1.2 \ | ||
| -o checksums.txt "${BASE_URL}/checksums.txt" | ||
|
|
||
| echo "Verifying checksum..." | ||
| # checksums.txt contains lines like: "<sha256> <filename>" | ||
| grep " ${ASSET}$" checksums.txt > sha_line.txt | ||
| if [ ! -s sha_line.txt ]; then | ||
| echo "No checksum entry for ${ASSET}"; exit 1 | ||
| fi | ||
| sha256sum -c sha_line.txt | ||
|
|
||
| echo "Extracting..." | ||
| # Extract with restricted permissions | ||
| tar -xzf "${ASSET}" --no-same-owner --no-same-permissions | ||
|
|
||
| # Find the 'cre' binary (tarball is expected to contain it at top-level) | ||
| BIN="./cre" | ||
| if [ ! -f "$BIN" ]; then | ||
| BIN="$(tar -tzf "${ASSET}" | grep -E '/?cre$' | head -n1 || true)" | ||
| [ -z "$BIN" ] && { echo "Could not locate 'cre' in archive"; exit 1; } | ||
| tar -xzf "${ASSET}" "$BIN" --no-same-owner --no-same-permissions | ||
| fi | ||
|
|
||
| # Validate binary before installation | ||
| if [ ! -x "$BIN" ]; then | ||
| chmod +x "$BIN" | ||
| fi | ||
|
|
||
| echo "Installing to /usr/local/bin..." | ||
| sudo mv "${BIN:-./cre}" /usr/local/bin/cre | ||
| sudo chmod 755 /usr/local/bin/cre | ||
|
|
||
| echo "Installed version:" | ||
| cre --version | ||
|
|
||
| - name: Setup CRE SDK examples | ||
| run: | | ||
| cd packages/cre-sdk-examples | ||
| bunx cre-setup | ||
|
|
||
| - name: Simulate Hello World workflow | ||
|
||
| run: | | ||
| cd packages/cre-sdk-examples | ||
| cre workflow simulate ./src/workflows/hello-world --target local-simulation | ||
|
|
||
| - name: Simulate Http Fetch workflow | ||
| run: | | ||
| cd packages/cre-sdk-examples | ||
| cre workflow simulate ./src/workflows/http-fetch --target local-simulation | ||
|
|
||
| - name: Simulate On Chain Read workflow | ||
| run: | | ||
| cd packages/cre-sdk-examples | ||
| cre workflow simulate ./src/workflows/on-chain --target local-simulation | ||
|
|
||
| - name: Simulate On Chain Write workflow | ||
| run: | | ||
| cd packages/cre-sdk-examples | ||
| cre workflow simulate ./src/workflows/on-chain-write --target local-simulation | ||
|
|
||
| - name: Simulate Proof of Reserve workflow | ||
| run: | | ||
| cd packages/cre-sdk-examples | ||
| cre workflow simulate ./src/workflows/proof-of-reserve --target local-simulation --secrets ../../../secrets.yaml | ||
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
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.