-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (53 loc) · 2.47 KB
/
faas_fn_build_invoke.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Tests
on:
push:
branches:
- "*"
paths-ignore:
- "*.adoc"
pull_request:
paths-ignore:
- "*.adoc"
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Install OpenFaaS CLI
run: curl -sSL https://cli.openfaas.com | sudo -E sh
- name: Build Function from scratch and invoke it
run: |
mkdir test
cd test
faas template pull https://github.com/${{ github.repository_owner }}/faas-idris2#${{ github.head_ref || github.ref_name }}
faas new --lang idris2 my-idris2-function --prefix ghcr.io/${{ github.repository_owner }}
faas build -f my-idris2-function.yml
if [ "$(echo "Hello world" | docker run -i ghcr.io/${{ github.repository_owner }}/my-idris2-function:latest build/exec/index)" != "Hello world" ]; then
exit 1
fi
- name: Build provided Function examples and invoke them
env:
DOCKER_REGISTRY_IMG_ORG_PATH: ghcr.io/${{ github.repository_owner }}
run: |
git clone https://github.com/${{ github.repository_owner }}/faas-idris2.git
cd faas-idris2/function-examples
git checkout ${{ github.head_ref || github.ref_name }}
faas template pull https://github.com/${{ github.repository_owner }}/faas-idris2#${{ github.head_ref || github.ref_name }}
faas build
if [ "$(echo "world" | docker run -i ghcr.io/${{ github.repository_owner }}/idris2-hello:latest build/exec/index)" != "Hello, world" ]; then
exit 1
fi
if [ "$(echo "key" | docker run -i ghcr.io/${{ github.repository_owner }}/idris2-pack:latest build/exec/index)" != "Value for key: [1, 2, 3]" ]; then
exit 2
fi
if [ "$(echo "absent-key" | docker run -i ghcr.io/${{ github.repository_owner }}/idris2-pack:latest build/exec/index)" != "Key not found" ]; then
exit 3
fi
if [ "$(echo "world" | docker run -i ghcr.io/${{ github.repository_owner }}/idris2-node-hello:latest build/exec/index)" != "Hello, world" ]; then
exit 4
fi
if [ "$(docker run -i ghcr.io/${{ github.repository_owner }}/idris2-node-pack-yarn:latest build/exec/index)" != "[\"Sato\", \"Satoshi\", \"Sarariman\"]" ]; then
exit 5
fi
if [ "$(echo "world" | docker run -i ghcr.io/${{ github.repository_owner }}/idris2-racket-hello:latest build/exec/index)" != "Hello, world" ]; then
exit 6
fi