This repository has been archived by the owner on Jun 6, 2024. It is now read-only.
Update testing variables #10
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
name: Fn Project Tests | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: Install Docker | |
uses: docker-practice/actions-setup-docker@master | |
- name: Install Fn Project CLI | |
run: | | |
curl -LSs https://raw.githubusercontent.com/fnproject/cli/master/install | sh | |
- name: Start Fn Server | |
run: fn start & | |
- name: Create Fn App | |
run: fn create app goapp | |
- name: Deploy Fn App | |
run: fn --verbose deploy --app goapp --local | |
- name: Install jq | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y jq | |
- name: Test Fn Function | |
id: test-function | |
run: | | |
result=$(echo -n '{"avatarJSON":"","size":512}' | fn invoke goapp render --content-type application/json) | |
echo "IMAGE=$(echo $result | jq -r '.image')" >> $GITHUB_ENV | |
- name: Store Base64 Image | |
run: | | |
echo "$IMAGE" > image.txt | |
- name: Convert to PNG | |
run: | | |
base64 --decode image.txt > image.png | |
- name: Upload Image Artifact | |
if: github.ref == 'refs/heads/main' | |
uses: actions/upload-artifact@master | |
with: | |
name: function-image | |
path: image.png | |
- name: Stop Fn Server | |
run: fn stop | |
if: always() |