-
Notifications
You must be signed in to change notification settings - Fork 2
138 lines (119 loc) · 4.38 KB
/
web-service.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Web Service Release
on:
workflow_dispatch:
inputs:
model_name:
description: Name of the model
type: string
default: xaynia
required: true
model_version:
description: Version of the model
type: string
default: v0201
required: true
platform:
description: Platform to build the image for
type: choice
options:
- arm64
- amd64
default: arm64
required: true
tag:
description: >
A tag for image identification. This override the default.
Default is <branch>-<timestamp>-<commit hash>-<model_name>_<model_version>-<platform>.
Step 'Images name' will print the name of the generated images.
type: string
required: false
run-name: ${{ github.ref_name }} - ${{ inputs.model_name }}_${{ inputs.model_version }} (${{ inputs.platform }})
permissions:
contents: read
env:
DENY_WARNINGS: false
runtime_name: ort
runtime_version: v1.15.1
web_api_archive: web-service-api
jobs:
services-build:
runs-on: hetzner-pm
container:
image: xaynetci/yellow:v15
timeout-minutes: 30
permissions:
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Set up aarch64 environment
if: inputs.platform == 'arm64'
shell: bash
run: |
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
echo "CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
echo "CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++" >> $GITHUB_ENV
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355 # v2.2.0
with:
role-to-assume: ${{ secrets.AWS_OIDC_ROLE }}
aws-region: eu-central-1
- name: Setup the CI.
uses: ./.github/actions/setup-job-docker
- name: Download assets
run: just download-assets \
${{ inputs.model_name }} ${{ inputs.model_version }} \
${{ env.runtime_name }} ${{ env.runtime_version }}
- name: Create web-api artifact
uses: ./.github/actions/release_artifact
with:
platform: ${{ inputs.platform }}
bin_name: "web-api"
archive_name: ${{ env.web_api_archive }}
model_full_name: ${{ inputs.model_name }}_${{ inputs.model_version }}
runtime_full_name: ${{ env.runtime_name }}_${{ env.runtime_version }}
docker-build:
runs-on: ubuntu-22.04
timeout-minutes: 20
needs: services-build
steps:
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@ecf95283f03858871ff00b787d79c419715afc34 # v2.7.0
- name: Set up QEMU
if: inputs.platform == 'arm64'
uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2.2.0
with:
platforms: ${{ inputs.platform }}
- name: Image names
run: |
TAG=${{ github.event.inputs.tag }}
if [ -z "$TAG" ]; then
TAG="$(git rev-parse --abbrev-ref HEAD)"
TAG="$TAG-$(date +"%y%m%d%H%M%S")"
TAG="$TAG-$(git rev-parse --short HEAD)"
TAG="$TAG-${{ inputs.model_name }}_${{ inputs.model_version }}"
TAG="$TAG-${{ inputs.platform }}"
fi
webapi_image_name="xaynetci/xayn_discovery_web_service:$TAG"
echo "webapi_image_name=$webapi_image_name" >> $GITHUB_ENV
cat <<EOT >>${GITHUB_STEP_SUMMARY}
# Image names
WebApi: $webapi_image_name
EOT
- name: Create web API docker image
uses: ./.github/actions/release_image
with:
archive_name: ${{ env.web_api_archive }}
image_name: ${{ env.webapi_image_name }}
platform: ${{ inputs.platform }}
- name: Login to Docker Hub
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
with:
username: "${{ secrets.DOCKERHUB_USERNAME }}"
password: "${{ secrets.DOCKERHUB_TOKEN }}"
- name: Push images
run: |
set -eux
docker push ${{ env.webapi_image_name }}