-
Notifications
You must be signed in to change notification settings - Fork 2
121 lines (104 loc) · 3.3 KB
/
build-chatterbox.yaml
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
---
name: Build Chatterbox
on:
push:
branches:
- main
tags:
- v*
pull_request:
branches:
- main
workflow_dispatch: # Allow this workflow to be triggered manually
workflow_call:
inputs:
tag:
description: "A tag to use for the image"
required: false
type: string
env:
IMAGE_NAME_BUILDER: chatterbox-builder
IMAGE_NAME_CHATTERBOX: chatterbox
IMAGE_NAME_CHATTERBOX_TEST: chatterbox-test
jobs:
build-and-run-tests:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set image tag
id: tag
run: |
if [ -z "${{ inputs.tag }}" ]; then
echo ::set-output name=tag::"latest"
else
echo ::set-output name=tag::"${{ inputs.tag }}"
fi
- name: Build chatterbox-test binary
run: |
docker run \
-e BASE_DIR=/project \
-e NINJA_JOBS=6 \
-e CONTRIB_PATH=/contrib \
-v $GITHUB_WORKSPACE:/project \
ghcr.io/${{ github.actor }}/${{ env.IMAGE_NAME_BUILDER }}:${{ steps.tag.outputs.tag }} build-test
- name: Copy scenarios
run: |
sudo cp -R test/scenarios build/cboxtest
- name: Build chatterbox-test-image
uses: docker/build-push-action@v3
with:
file: 'scripts/Dockerfile.chatterbox-test'
context: build/cboxtest
tags: ${{ env.IMAGE_NAME_CHATTERBOX_TEST }}:${{ steps.tag.outputs.tag }}
labels: ${{ env.IMAGE_NAME_CHATTERBOX_TEST }}
- name: Run tests
run: |
docker run ${{ env.IMAGE_NAME_CHATTERBOX_TEST }}:${{ steps.tag.outputs.tag }}
build-and-push-chatterbox:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set image tag
id: tag
run: |
if [ -z "${{ inputs.tag }}" ]; then
echo ::set-output name=tag::"latest"
else
echo ::set-output name=tag::"${{ inputs.tag }}"
fi
- name: Build chatterbox binary
run: |
docker run \
-e BASE_DIR=/project \
-e NINJA_JOBS=6 \
-e CONTRIB_PATH=/contrib \
-v $GITHUB_WORKSPACE:/project \
ghcr.io/${{ github.actor }}/${{ env.IMAGE_NAME_BUILDER }}:${{ steps.tag.outputs.tag }} build
- name: Build and push chatterbox-image
uses: docker/build-push-action@v3
with:
file: 'scripts/Dockerfile.chatterbox'
context: build/cbox
push: true
tags: ghcr.io/${{ github.actor }}/${{ env.IMAGE_NAME_CHATTERBOX }}:${{ steps.tag.outputs.tag }}
labels: ${{ env.IMAGE_NAME_CHATTERBOX }}