forked from kpals/abacustestingkpals
-
Notifications
You must be signed in to change notification settings - Fork 0
159 lines (156 loc) · 5.17 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
151
152
153
154
155
156
157
158
159
env:
CONTAINER_ARCHS: linux/amd64,linux/arm64
on:
push:
branches: [main]
tags: ["*"]
pull_request:
branches: [main]
types: [opened, synchronize, reopened]
release:
types: [published]
jobs:
app:
timeout-minutes: 60
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.version.outputs.VERSION }}
CHART_VERSION: ${{ steps.chart-version.outputs.VERSION }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "16.x"
- run: npm ci
- run: npm run test
- run: echo '::set-output name=VERSION::'$(jq -r .version package.json)
id: version
- run: echo '::set-output name=VERSION::'$(jq -r .version package.json)-$(git rev-parse --short HEAD)
id: chart-version
# - name: Install Playwright
# run: npx playwright install --with-deps
# - name: Run Playwright tests
# run: xvfb-run npm run test:playwright
# - name: Upload test results
# if: always()
# uses: actions/upload-artifact@v2
# with:
# name: playwright-test-results
# path: test-results
image:
needs:
- app
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
timeout-minutes: 90
outputs:
IMAGE_TAGS: ${{ steps.meta.outputs.tags }}
steps:
- uses: actions/checkout@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: ghcr.io/opentdf/abacus
tags: |
type=ref,event=branch
type=sha
type=semver,pattern={{version}},value=${{ github.event.release.tag_version }},enabled=${{ !!github.event.release }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: publish
uses: docker/build-push-action@v2
with:
build-args: |-
NODE_VERSION=16
platforms: ${{ env.CONTAINER_ARCHS }}
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'opentdf/frontend' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
chart:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
- run: npm i @opentdf/client
# FIXME replace when working
# chart:
# if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
# runs-on: ubuntu-latest
# needs:
# - image
# permissions:
# packages: write
# contents: read
# timeout-minutes: 10
# steps:
# - uses: actions/checkout@v2
# - uses: yokawasa/action-setup-kube-tools@v0.8.0
# with:
# setup-tools: helm
# helm: "3.8.0"
# - name: Login to GitHub Container Registry
# uses: docker/login-action@v1
# with:
# registry: ghcr.io
# username: ${{ github.repository_owner }}
# password: ${{ secrets.GITHUB_TOKEN }}
# logout: false
# - name: push
# run: |
# sha_ver=sha-$(git rev-parse --short HEAD)
# tag_ver=${{ github.event.release.tag_version }}
# explicit_version=$(printf '%s\n' "${app_ver}-${sha_ver}" | sed -e 's/[\/.]/\\./g')
# chart_ver="${tag_ver:-${explicit_version}}"
# image_tag="${tag_ver:-${sha_ver}}"
# cd charts
# for d in */ ; do
# if [ -f "$d/Chart.yaml" ]; then
# echo "Setting Chart.yaml version to ${chart_ver}..."
# sed -i "s/^version\: .*/version\: ${chart_ver}/" $d/Chart.yaml
# sed -i "s/^appVersion\: .*/appVersion\: ${app_ver}/" $d/Chart.yaml
# sed -i "s/^ tag\: main/ tag\: ${image_tag}/" $d/values.yaml
# echo "Packaging Helm chart $d..."
# helm package $d --app-version="${app_ver}"
# echo "Packaged Helm chart $d with chart version [${chart_ver}] and appVersion to [${app_ver}]"
# echo *.tgz
# helm push *.tgz oci://ghcr.io/${{ github.repository_owner }}/charts
# rm *.tgz
# fi
# done
# env:
# app_ver: ${{ needs.app.outputs.VERSION || '0.0.0' }}
# FIXME replace when working
# dispatch:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/github-script@v6
# with:
# github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
# # TODO:
# # https://octokit.github.io/rest.js/v18#actions-create-workflow-dispatch
# script: |
# await github.rest.repos.createDispatchEvent({
# owner: 'opentdf',
# repo: 'tests',
# event_type: 'xtest',
# })
ci:
needs: image
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- run: exit 1
if: ${{ needs.image.result == 'failure' }}