-
Notifications
You must be signed in to change notification settings - Fork 3
151 lines (126 loc) · 4.66 KB
/
build.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
name: Build and Test Locust
on:
pull_request:
push:
branches: [master, develop]
tags: ['*']
workflow_dispatch:
env:
REGISTRY: ghcr.io
BASE_IMG_REPO: project8/kassiopeia_builder
BASE_IMG_TAG: v4.0.1-dev
FINAL_BASE_IMG_REPO: project8/luna_base
FINAL_BASE_IMG_TAG: v1.3.4
locust_mc_BUILD_WITH_KASSIOPEIA: ON
locust_mc_ENABLE_EXECUTABLES: ON
NARG: 2
# locust_mc_ENABLE_TESTING: ON
# locust_mc_BUILD_TYPE: Debug
# locust_mc_TAG: test
jobs:
docker-build-and-publish:
name: Build and push the docker images
strategy:
matrix:
build: [Dev, Prod]
fail-fast: [false]
include:
- build: Dev
tag-suffix: '-dev'
build-type: Debug
build-tests: true
- build: Prod
tag-suffix: ''
build-type: Release
build-tests: true
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
with:
submodules: recursive
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}
flavor: |
latest=auto
suffix=${{ matrix.tag-suffix }},onlatest=true
tags: |
type=semver,pattern={{raw}}
type=ref,event=branch
type=ref,event=pr
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
- name: Get previous tag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
id: tag_name
with:
fallback: beta
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: setup_buildx
uses: docker/setup-buildx-action@v2
with:
buildkitd-flags: --debug
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build to Test
id: build-to-test
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile
push: false
load: true
build-args: |
img_repo=${{ env.REGISTRY }}/${{ env.BASE_IMG_REPO }}
img_tag=${{ env.BASE_IMG_TAG }}
final_img_repo=${{ env.REGISTRY }}/${{ env.FINAL_BASE_IMG_REPO }}
final_img_tag=${{ env.FINAL_BASE_IMG_TAG }}${{ matrix.tag-suffix }}
locust_tag=${{ steps.tag_name.outputs.tag }}
build_type=${{ matrix.build-type }}
build_tests_exe=${{ matrix.build-tests }}
build_with_kassiopeia=${locust_mc_BUILD_WITH_KASSIOPEIA}
narg=${{ env.NARG }}
tags: test${{ matrix.tag-suffix }}
platforms: linux/amd64
- name: Run Tests
# Alternate lines from pls testing:
if: ${{ matrix.build-tests == true }}
run: echo '#!/bin/bash' > job.sh && echo source /usr/local/p8/locust/${{ steps.tag_name.outputs.tag }}/setup.sh >> job.sh && echo /usr/local/p8/locust/${{ steps.tag_name.outputs.tag }}/bin/RunTests >> job.sh && chmod +x job.sh && docker run -v /home/runner/work/locust_mc/locust_mc:/tmp ${{ steps.build-to-test.outputs.imageid }} /tmp/job.sh
# End alternate lines from pls testing.
- name: Build to Push
id: build-to-push
if: true
#if: ${{ github.event_name == 'push' && ( contains(github.ref, 'refs/tags/') || github.ref == 'refs/heads/develop' ) }}
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile
push: true
load: false
build-args: |
build_img_repo=${{ env.REGISTRY }}/${{ env.BASE_IMG_REPO }}
build_img_tag=${{ env.BASE_IMG_TAG }}
final_img_repo=${{ env.REGISTRY }}/${{ env.FINAL_BASE_IMG_REPO }}
final_img_tag=${{ env.FINAL_BASE_IMG_TAG }}${{ matrix.tag-suffix }}
locust_tag=${{ steps.tag_name.outputs.tag }}
build_type=${{ matrix.build-type }}
build_tests_exe=${{ matrix.build-tests }}
build_with_kassiopeia=${locust_mc_BUILD_WITH_KASSIOPEIA}
narg=${{ env.NARG }}
tags: ${{ steps.docker_meta.outputs.tags }}
platforms: linux/amd64
- name: Release
uses: softprops/action-gh-release@v1
if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }}
# For debugging
- name: Setup tmate session
if: ${{ ! success() }}
uses: mxschmitt/action-tmate@v3