-
Notifications
You must be signed in to change notification settings - Fork 5
146 lines (121 loc) · 4.39 KB
/
ci.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
139
140
141
142
143
144
145
146
name: CI
env:
IMAGE_NAME: activemq-artemis-jolokia-api-server
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: '6 0 * * *'
workflow_dispatch:
inputs:
snapshot:
description: 'Snapshot'
required: false
default: false
type: boolean
# cancels the old active workflow if new workflow is triggered
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: ['javascript']
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
openapi:
name: Check that the openapi file is in sync with the generated files
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Get cache and install dependencies
uses: ./.github/actions/cache-restore
- name: regenerate the api.md
continue-on-error: true
run: yarn build-api-doc && yarn pretty-quick
- name: check there is no manual changes
run: git diff && [ -z "$(git status --porcelain=v1 2>/dev/null)" ] && echo "✓ No manual changes." || echo "✗ api.md manually changed, please refer to the api.md for the procedure to follow for programmatically generated endpoints." && [ -z "$(git status --porcelain=v1 2>/dev/null)" ]
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Get cache and install dependencies
uses: ./.github/actions/cache-restore
- name: Build project
run: yarn run build
- name: Run the test suite
run: yarn test:coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Check for uncommited changes
run: git diff --quiet --exit-code
- name: Set outputs
id: vars
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "date=$(date +%Y%m%d)" >> $GITHUB_OUTPUT
- name: Check outputs
run: |
echo ${{ steps.vars.outputs.sha_short }}
echo ${{ steps.vars.outputs.date }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Build the image
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.IMAGE_NAME }}
tags: dev.latest dev.${{ steps.vars.outputs.date }}.${{ steps.vars.outputs.sha_short }}
# If this is a PR, we only build for AMD64. For PRs we only do a sanity check test to ensure Docker builds work.
# If this is not a PR (e.g. a tag or merge commit), also build for ARM64
platforms: linux/amd64${{github.event_name!='pull_request' && ',linux/arm64' || ''}}
context: .
dockerfiles: |
./Dockerfile
labels: |
quay.expires-after=90d
git-sha=$GITHUB_SHA
- name: Push the dev image to quay.io
# Only login if not a PR, as PRs only trigger a Docker build and not a push
if: ${{ github.event_name != 'pull_request' }}
id: push-to-quay
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: quay.io/${{ secrets.QUAY_NAMESPACE }}
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}