Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

Commit

Permalink
Remaining CI/CD for examples (#74)
Browse files Browse the repository at this point in the history
* initial commit, manual action testing

Signed-off-by: Brooks Townsend <[email protected]>

cargo update echo

Signed-off-by: Brooks Townsend <[email protected]>

add wasm32-unknown-unknown target for building actors

Signed-off-by: Brooks Townsend <[email protected]>

add signing keys to actor action

Signed-off-by: Brooks Townsend <[email protected]>

bump echo, remove debug parts from test

Signed-off-by: Brooks Townsend <[email protected]>

* create actions for remaining actor,provider,interface

Signed-off-by: Brooks Townsend <[email protected]>
  • Loading branch information
brooksmtownsend authored Sep 14, 2021
1 parent 53c3290 commit 3fa091c
Show file tree
Hide file tree
Showing 13 changed files with 885 additions and 8 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/TEMPLATE_actor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ on:
env:
CARGO_TERM_COLOR: always
working-directory: ./actor/example
WASH_ISSUER_KEY: ${{ secrets.WASMCLOUD_ACCOUNT_OFFICIAL }}
WASH_SUBJECT_KEY: ${{ secrets.WASMCLOUD_EXAMPLE }}

jobs:
rust_check:
Expand All @@ -30,6 +32,8 @@ jobs:
uses: wasmcloud/common-actions/rust-check@main
with:
working-directory: ${{ env.working-directory }}
# The `--doc` is required for wasm, as cargo cannot execute wasm tests by default
test-options: '--verbose --doc'

build_artifact:
needs: rust_check
Expand All @@ -39,6 +43,9 @@ jobs:
- uses: actions/checkout@v2
- uses: wasmcloud/common-actions/install-wash@main

- name: Add wasm32-unknown-unknown
run: rustup target add wasm32-unknown-unknown

- name: Build wasmcloud actor
run: make
working-directory: ${{ env.working-directory }}
Expand Down
102 changes: 102 additions & 0 deletions .github/workflows/echo-messaging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: ECHO_MESSAGING

on:
push:
branches: [ main ]
paths:
- "actor/echo-messaging/**"
tags:
- 'echo-messaging-v*'
pull_request:
branches: [ main ]
paths:
- "actor/echo-messaging/**"

env:
CARGO_TERM_COLOR: always
working-directory: ./actor/echo-messaging
WASH_ISSUER_KEY: ${{ secrets.WASMCLOUD_ACCOUNT_OFFICIAL }}
WASH_SUBJECT_KEY: ${{ secrets.WASMCLOUD_ECHO_MESSAGING }}

jobs:
rust_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# If your integration tests require nats or redis, run them here
- name: Add wasm32-unknown-unknown
run: rustup target add wasm32-unknown-unknown
- id: rust-check-action
uses: wasmcloud/common-actions/rust-check@main
with:
working-directory: ${{ env.working-directory }}
# The `--doc` is required for wasm, as cargo cannot execute wasm tests by default
test-options: '--verbose --doc'

build_artifact:
needs: rust_check
if: startswith(github.ref, 'refs/tags/') # Only run on tag push
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: wasmcloud/common-actions/install-wash@main

- name: Add wasm32-unknown-unknown
run: rustup target add wasm32-unknown-unknown

- name: Build wasmcloud actor
run: make
working-directory: ${{ env.working-directory }}

- name: Upload signed actor to GH Actions
uses: actions/upload-artifact@v2
with:
name: wasmcloud-actor
path: ${{ env.working-directory }}/build/*.wasm

github_release:
if: startswith(github.ref, 'refs/tags/') # Only run on tag push
needs: build_artifact
runs-on: ubuntu-latest
steps:
- name: Download signed actor
uses: actions/download-artifact@v2
with:
name: wasmcloud-actor
path: ${{ env.working-directory }}/build

- name: Release
uses: softprops/action-gh-release@v1
with:
files: ${{ env.working-directory }}/build/*.wasm
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: true
draft: false

artifact_release:
needs: build_artifact
if: startswith(github.ref, 'refs/tags/') # Only run on tag push
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download signed actor
uses: actions/download-artifact@v2
with:
name: wasmcloud-actor
path: ${{ env.working-directory }}/build

- name: Determine artifact metadata
run: |
echo "oci-repository=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[].name')" >> $GITHUB_ENV
echo "oci-version=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[].version')" >> $GITHUB_ENV
working-directory: ${{ env.working-directory }}

- name: Push actor to AzureCR
uses: wasmcloud/common-actions/oci-artifact-release@main
with:
artifact-path: ${{ env.working-directory }}/build/${{ env.oci-repository }}_s.wasm
oci-url: ${{ secrets.AZURECR_PUSH_URL }}
oci-repository: ${{ env.oci-repository }}
oci-version: ${{ env.oci-version }}
oci-username: ${{ secrets.AZURECR_PUSH_USER }}
oci-password: ${{ secrets.AZURECR_PUSH_PASSWORD }}
12 changes: 8 additions & 4 deletions .github/workflows/echo.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# Replace all occurrences of "EXAMPLE" with the example name (e.g. ECHO)
# Replace workflow triggers with provider with the example name, should be the same as the folder path
name: ECHO

on:
Expand All @@ -17,6 +15,8 @@ on:
env:
CARGO_TERM_COLOR: always
working-directory: ./actor/echo
WASH_ISSUER_KEY: ${{ secrets.WASMCLOUD_ACCOUNT_OFFICIAL }}
WASH_SUBJECT_KEY: ${{ secrets.WASMCLOUD_ECHO }}

jobs:
rust_check:
Expand All @@ -30,15 +30,19 @@ jobs:
uses: wasmcloud/common-actions/rust-check@main
with:
working-directory: ${{ env.working-directory }}
test-options: '--verbose --doc'

build_artifact:
needs: rust_check
if: startswith(github.ref, 'refs/tags/') # Only run on tag push
needs: rust_check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: wasmcloud/common-actions/install-wash@main

- name: Add wasm32-unknown-unknown
run: rustup target add wasm32-unknown-unknown

- name: Build wasmcloud actor
run: make
working-directory: ${{ env.working-directory }}
Expand Down Expand Up @@ -69,8 +73,8 @@ jobs:
draft: false

artifact_release:
needs: build_artifact
if: startswith(github.ref, 'refs/tags/') # Only run on tag push
needs: build_artifact
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
102 changes: 102 additions & 0 deletions .github/workflows/example-logging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: EXAMPLE_LOGGING

on:
push:
branches: [ main ]
paths:
- "actor/logging/**"
tags:
- 'logging-v*'
pull_request:
branches: [ main ]
paths:
- "actor/logging/**"

env:
CARGO_TERM_COLOR: always
working-directory: ./actor/logging
WASH_ISSUER_KEY: ${{ secrets.WASMCLOUD_ACCOUNT_OFFICIAL }}
WASH_SUBJECT_KEY: ${{ secrets.WASMCLOUD_EXAMPLE_LOGGING }}

jobs:
rust_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# If your integration tests require nats or redis, run them here
- name: Add wasm32-unknown-unknown
run: rustup target add wasm32-unknown-unknown
- id: rust-check-action
uses: wasmcloud/common-actions/rust-check@main
with:
working-directory: ${{ env.working-directory }}
# The `--doc` is required for wasm, as cargo cannot execute wasm tests by default
test-options: '--verbose --doc'

build_artifact:
needs: rust_check
if: startswith(github.ref, 'refs/tags/') # Only run on tag push
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: wasmcloud/common-actions/install-wash@main

- name: Add wasm32-unknown-unknown
run: rustup target add wasm32-unknown-unknown

- name: Build wasmcloud actor
run: make
working-directory: ${{ env.working-directory }}

- name: Upload signed actor to GH Actions
uses: actions/upload-artifact@v2
with:
name: wasmcloud-actor
path: ${{ env.working-directory }}/build/*.wasm

github_release:
if: startswith(github.ref, 'refs/tags/') # Only run on tag push
needs: build_artifact
runs-on: ubuntu-latest
steps:
- name: Download signed actor
uses: actions/download-artifact@v2
with:
name: wasmcloud-actor
path: ${{ env.working-directory }}/build

- name: Release
uses: softprops/action-gh-release@v1
with:
files: ${{ env.working-directory }}/build/*.wasm
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: true
draft: false

artifact_release:
needs: build_artifact
if: startswith(github.ref, 'refs/tags/') # Only run on tag push
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download signed actor
uses: actions/download-artifact@v2
with:
name: wasmcloud-actor
path: ${{ env.working-directory }}/build

- name: Determine artifact metadata
run: |
echo "oci-repository=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[].name')" >> $GITHUB_ENV
echo "oci-version=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[].version')" >> $GITHUB_ENV
working-directory: ${{ env.working-directory }}

- name: Push actor to AzureCR
uses: wasmcloud/common-actions/oci-artifact-release@main
with:
artifact-path: ${{ env.working-directory }}/build/${{ env.oci-repository }}_s.wasm
oci-url: ${{ secrets.AZURECR_PUSH_URL }}
oci-repository: ${{ env.oci-repository }}
oci-version: ${{ env.oci-version }}
oci-username: ${{ secrets.AZURECR_PUSH_USER }}
oci-password: ${{ secrets.AZURECR_PUSH_PASSWORD }}
97 changes: 97 additions & 0 deletions .github/workflows/factorial.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: FACTORIAL

on:
push:
branches: [ main ]
paths:
- "provider/factorial/**"
tags:
- 'factorial-v*'
pull_request:
branches: [ main ]
paths:
- "provider/factorial/**"

env:
CARGO_TERM_COLOR: always
working-directory: ./provider/factorial
WASH_ISSUER_KEY: ${{ secrets.WASMCLOUD_ACCOUNT_OFFICIAL }}
WASH_SUBJECT_KEY: ${{ secrets.WASMCLOUD_FACTORIAL }}

jobs:
rust_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# If your integration tests require nats or redis, run them here
- id: rust-check-action
uses: wasmcloud/common-actions/rust-check@main
with:
working-directory: ${{ env.working-directory }}

build_artifact:
needs: rust_check
if: startswith(github.ref, 'refs/tags/') # Only run on tag push
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: wasmcloud/common-actions/install-wash@main
- uses: wasmcloud/common-actions/install-cross@main

- name: Build full provider archive
run: make par-full
working-directory: ${{ env.working-directory }}

- name: Upload provider archive to GH Actions
uses: actions/upload-artifact@v2
with:
name: provider-archive
path: ${{ env.working-directory }}/build/*.par.gz

github_release:
if: startswith(github.ref, 'refs/tags/') # Only run on tag push
needs: build_artifact
runs-on: ubuntu-latest
steps:
- name: Download provider archive
uses: actions/download-artifact@v2
with:
name: provider-archive
path: ${{ env.working-directory }}/build

- name: Release
uses: softprops/action-gh-release@v1
with:
files: ${{ env.working-directory }}/build/*.par.gz
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: true
draft: false

artifact_release:
needs: build_artifact
if: startswith(github.ref, 'refs/tags/') # Only run on tag push
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download provider archive
uses: actions/download-artifact@v2
with:
name: provider-archive
path: ${{ env.working-directory }}/build

- name: Determine artifact metadata
run: |
echo "oci-repository=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[].name' | sed 's/wasmcloud-example-provider-//')" >> $GITHUB_ENV
echo "oci-version=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[].version')" >> $GITHUB_ENV
working-directory: ${{ env.working-directory }}

- name: Push provider archive to AzureCR
uses: wasmcloud/common-actions/oci-artifact-release@main
with:
artifact-path: ${{ env.working-directory }}/build/${{ env.oci-repository }}.par.gz
oci-url: ${{ secrets.AZURECR_PUSH_URL }}
oci-repository: ${{ env.oci-repository }}
oci-version: ${{ env.oci-version }}
oci-username: ${{ secrets.AZURECR_PUSH_USER }}
oci-password: ${{ secrets.AZURECR_PUSH_PASSWORD }}

Loading

0 comments on commit 3fa091c

Please sign in to comment.