-
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.
Signed-off-by: Lachlan Heywood <[email protected]>
- Loading branch information
Showing
10 changed files
with
480 additions
and
9 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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,54 @@ | ||
name: crate-versions | ||
|
||
description: | | ||
Get the 3 latest versions of the specified crate from crates.io. | ||
branding: | ||
icon: settings | ||
color: blue | ||
|
||
inputs: | ||
version: | ||
description: Version of wash-cli to install and cache | ||
default: 'latest' | ||
|
||
outputs: | ||
version: | ||
description: Selected wash-cli to install and cache | ||
value: ${{ steps.versions.outputs.latest }} | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
- name: Get Latest wash-cli Version | ||
if: ${{ inputs.version == 'latest' }} | ||
uses: ./.github/actions/crate-versions | ||
id: versions | ||
with: | ||
crate: wash-cli | ||
|
||
- name: Set Version | ||
shell: bash | ||
run: | | ||
# Set WASH_VERSION | ||
echo "WASH_VERSION=${{ inputs.version == 'latest' && steps.versions.outputs.latest || inputs.version }}" >> $GITHUB_ENV | ||
- name: Restore Cache | ||
id: restore | ||
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 | ||
with: | ||
key: ${{ runner.os }}-restore-wash-cli-${{ env.WASH_VERSION }} | ||
path: ~/.cargo/bin/wash | ||
|
||
- name: Install wash-cli | ||
if: ${{ steps.restore.outputs.cache-hit != 'true' }} | ||
uses: taiki-e/install-action@8484225d9734e230a8bf38421a4ffec1cc249372 # v2.46.20 | ||
with: | ||
tool: ${{ format('wash-cli@{0}', env.WASH_VERSION) }} | ||
|
||
- uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 | ||
if: ${{ always() && steps.restore.outputs.cache-hit != 'true' }} | ||
with: | ||
key: ${{ steps.restore.outputs.cache-primary-key }} | ||
path: ~/.cargo/bin/wash |
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
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,35 @@ | ||
name: crate-versions | ||
|
||
description: | | ||
Get the latest versions of the `wash` CLI and `wash` Playwright tests | ||
branding: | ||
icon: settings | ||
color: blue | ||
|
||
inputs: | ||
crate: | ||
description: Name of the crate of which to fetch versions for | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
- name: Fetch crate versions | ||
id: fetch_versions | ||
run: | | ||
CRATE_NAME=${{ inputs.crate }} | ||
# Fetch the crate information from crates.io | ||
RESPONSE=$(curl -s -H "User-Agent: wasmCloud-github-actions/1.0 (slack.wasmcloud.com)" "https://crates.io/api/v1/crates/$CRATE_NAME") | ||
# Extract all versions that are not yanked | ||
ALL_VERSIONS=$(echo $RESPONSE | jq -c -r '.versions | map(select(.yanked | not)) | map(.num) | map(select(test("^[0-9]+\\.[0-9]+\\.[0-9]+$")))') | ||
# Extract the latest 3 major versions (or minor versions if the crate is in the 0.x range) | ||
LAST_3_VERSIONS=$(echo $ALL_VERSIONS | jq -c -r 'unique_by(if . | startswith("0.") then split(".")[1] else split(".")[0] end) | sort_by(split(".") | map(tonumber)) | reverse | .[0:3]') | ||
echo "versions=$LAST_3_VERSIONS" >> $GITHUB_OUTPUT | ||
shell: bash | ||
|
||
outputs: | ||
versions: | ||
description: The latest 3 major versions of the crate. | ||
value: ${{ steps.fetch_versions.outputs.versions }} |
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
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,87 @@ | ||
name: Examples | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- '**' | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
meta: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
changes: ${{ steps.changes.outputs.changed_keys }} | ||
changed-components: ${{ contains(steps.changes.outputs.changed_keys, 'components') }} | ||
changed-providers: ${{ contains(steps.changes.outputs.changed_keys, 'providers') }} | ||
changed-ci: ${{ contains(steps.changes.outputs.changed_keys, 'ci') }} | ||
wash-version: ${{ steps.versions.outputs.version }} | ||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
||
- name: Check for changes | ||
id: changes | ||
uses: tj-actions/changed-files@bab30c2299617f6615ec02a68b9a40d10bd21366 # v45.0.5 | ||
with: | ||
matrix: true | ||
dir_names: true | ||
dir_names_max_depth: 3 | ||
files_yaml: | | ||
ci: | ||
- .github/workflows/examples_.yml | ||
- .github/workflows/examples_component.yml | ||
- .github/workflows/examples_provider.yml | ||
components: | ||
- examples/components/** | ||
providers: | ||
- examples/providers/** | ||
- name: Fetch/Cache Latest wash Version | ||
id: versions | ||
uses: ./.github/actions/cached-wash-install | ||
|
||
components: | ||
name: ${{ format('example:component:{0}', matrix.project.folder) }} | ||
needs: [meta] | ||
if: needs.meta.outputs.changed-ci == 'true' || needs.meta.outputs.changed-components == 'true' | ||
secrets: inherit | ||
uses: ./.github/workflows/examples_component.yml | ||
with: | ||
folder: ${{ matrix.project.folder }} | ||
wasm-bin: ${{ matrix.project.wasm-bin }} | ||
test-command: ${{ matrix.project.test-command }} | ||
force: ${{ needs.meta.outputs.changed-ci == 'true' }} | ||
wash-version: ${{ needs.meta.outputs.wash-version }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
project: | ||
# Sample matrix entry for examples | ||
# - folder: http-hello-world # Folder name of the example within examples/components/* | ||
# wasm-bin: dist/http-hello-world.wasm # Path to the wasm binary after build | ||
# test-command: TEST_RESULT=1 # Some command that will set TEST_RESULT to 0 or 1 | ||
|
||
- folder: http-hello-world | ||
wasm-bin: http_hello_world_s.wasm | ||
test-command: | | ||
RESPONSE=$(curl http://127.0.0.1:8000 || echo '') | ||
[[ "$RESPONSE" == 'Hello from Typescript!' ]] && TEST_RESULT=1 || TEST_RESULT=0 | ||
- folder: http-password-checker | ||
wasm-bin: http_password_checker_s.wasm | ||
test-command: | | ||
RESPONSE=$(curl http://127.0.0.1:8000/api/v1/check -d '{"value": "test"}' | jq -r '.status' || echo '') | ||
[[ "$RESPONSE" == 'success' ]] && TEST_RESULT=1 || TEST_RESULT=0 | ||
examples-check: | ||
needs: [components] | ||
if: ${{ always() }} | ||
uses: ./.github/workflows/workflow_check.yml | ||
with: | ||
pass-condition: ${{ contains(needs.*.result, 'failure') == false }} |
Oops, something went wrong.