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

Commit

Permalink
Added blobstore example, Animal Image Downloader (#158)
Browse files Browse the repository at this point in the history
* added animal image downloader actor

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

* cleaned up example

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

* added links for capability providers

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

* Update actor/animal-image-downloader/README.md

Co-authored-by: Connor Smith <[email protected]>

Signed-off-by: Brooks Townsend <[email protected]>
Co-authored-by: Connor Smith <[email protected]>
  • Loading branch information
brooksmtownsend and connorsmith256 authored Sep 19, 2022
1 parent 477b8e9 commit 63f3e28
Show file tree
Hide file tree
Showing 11 changed files with 3,187 additions and 1 deletion.
102 changes: 102 additions & 0 deletions .github/workflows/animal-image-downloader.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: ANIMAL IMAGE DOWNLOADER

on:
push:
branches: [main]
paths:
- "actor/animal-image-downloader/**"
tags:
- "animal-image-downloader-v*"
pull_request:
branches: [main]
paths:
- "actor/animal-image-downloader/**"

env:
CARGO_TERM_COLOR: always
working-directory: ./actor/animal-image-downloader
WASH_ISSUER_KEY: ${{ secrets.WASMCLOUD_ACCOUNT_OFFICIAL }}
WASH_SUBJECT_KEY: ${{ secrets.WASMCLOUD_ANIMAL_IMAGE_DOWNLOADER }}

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/animal_image_downloader_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 }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
pre-otp/

.vscode
*logs.txt
*logs.txt

host_config.json
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The following actors run as WebAssembly on wasmCloud hosts.

| Example | Description | OCI Reference <br/> (refer to example for latest version) |
|---|---|---|
| [animal-image-downloader](https://github.com/wasmcloud/examples/tree/main/actor/animal-image-downloader) | An actor that receives messages and makes HTTP requests, downloading a picture of an animal to a blobstore | `wasmcloud.azurecr.io/animal-image-downloader` |
| [echo](https://github.com/wasmcloud/examples/tree/main/actor/echo) | An actor that listens on an HTTP port and returns a JSON payload describing the incoming request | `wasmcloud.azurecr.io/echo` |
| [echo-messaging](https://github.com/wasmcloud/examples/tree/main/actor/echo-messaging) | An actor that listens on a message broker topic and replies | `wasmcloud.azurecr.io/echo-messaging` |
| [hello](https://github.com/wasmcloud/examples/tree/main/actor/hello) | Canonical "hello world" actor that listens on an HTTP port and replies with a greeting | `wasmcloud.azurecr.io/hello` |
Expand Down
2 changes: 2 additions & 0 deletions actor/animal-image-downloader/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build]
target = "wasm32-unknown-unknown"
41 changes: 41 additions & 0 deletions actor/animal-image-downloader/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# This file lists build byproducts,
# IDE-specific files (unless shared by your team)


## Build
/build
/dist/
/target
**target

## File system
.DS_Store
desktop.ini

## Editor
*.swp
*.swo
Session.vim
.cproject
.idea
*.iml
.vscode
.project
.favorites.json
.settings/

## Temporary files
*~
\#*
\#*\#
.#*

## Python
__pycache__/
*.py[cod]
*$py.class

## Node
**node_modules
**package-lock.json

Loading

0 comments on commit 63f3e28

Please sign in to comment.