-
Notifications
You must be signed in to change notification settings - Fork 118
74 lines (70 loc) · 2.25 KB
/
serialize_example.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Serialize & Register Docs Examples
on:
workflow_call:
inputs:
packages:
description: "Packages"
required: true
type: string
secrets:
FLYTE_BOT_PAT:
required: true
defaults:
run:
# https://github.com/actions/runner/issues/241#issuecomment-577360161
shell: 'script -q -e -c "bash {0}"'
jobs:
# Use matrix strategy to run serialize for all directories in parallel. This also uploads the examples as artifacts
# for the workflow.
serialize:
name: Serialize Example
runs-on: ubuntu-latest
strategy:
matrix:
directory: "${{ fromJson(inputs.packages) }}"
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
fetch-depth: "0"
- name: "Set example id"
id: example_id
run: echo "EXAMPLE_ID=$(echo ${{ matrix.directory }} | sed 's@/@-@g' | sed 's@_@-@g' )" >> "$GITHUB_OUTPUT"
- name: Build docker image and serialize examples
run: |
./scripts/serialize-example.sh ${{ matrix.directory }} ${{ github.sha }}
tar -xvf ${{ matrix.directory }}/flyte-package.tgz -C ${{ matrix.directory }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: snacks-${{ steps.example_id.outputs.EXAMPLE_ID }}
path: ${{ matrix.directory }}/**/*.pb
# Download all artifacts generated from the previous job. Startup a sandbox cluster then register all of them.
register:
name: Register example to sandbox
runs-on: ubuntu-latest
needs: ["serialize"]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: "0"
- uses: unionai/[email protected]
- name: setup download artifact dir
run: |
mkdir download-artifact
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ./download-artifact/
- name: setup sandbox
run: |
flytectl demo start
flytectl config init
- name: Register examples
uses: unionai/[email protected]
with:
flytesnacks: false
proto: ./download-artifact/**/*
project: flytesnacks
version: "latest"
domain: development