-
Notifications
You must be signed in to change notification settings - Fork 0
140 lines (131 loc) · 3.78 KB
/
build.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
name: Build
on:
pull_request:
merge_group:
push:
branches:
- develop
tags:
- '*'
jobs:
build:
name: 'Build and Test on Node ${{ matrix.node_version }} and ${{ matrix.os }}'
runs-on: '${{ matrix.os }}'
strategy:
matrix:
node_version:
- 18
- 20
- 22
os:
- ubuntu-latest
- macOS-latest
- windows-latest
steps:
- uses: actions/checkout@v4
- name: 'Use Node.js ${{ matrix.node_version }}'
uses: actions/setup-node@v4
with:
node-version: '${{ matrix.node_version }}'
- name: npm build and test
run: |
npm run clean
npm run build
npm run test
end2end:
# TODO: Docker End2End
name: 'End2End Test on Node ${{ matrix.node_version }} and ${{ matrix.os }}'
runs-on: '${{ matrix.os }}'
strategy:
fail-fast: true
matrix:
node_version:
- 18
- 20
- 21
os:
- ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Use Node.js ${{ matrix.node_version }}'
uses: actions/setup-node@v4
with:
node-version: '${{ matrix.node_version }}'
- name: Install Java
uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
- name: npm build and test
run: |
npm run clean
npm run build
- name: Tune GitHub-hosted runner network
uses: smorimoto/tune-github-hosted-runner-network@v1
- name: Start Keycloak server
run: npm run end2end:start-server &
- name: Wait for Keycloak server
run: .bin/wait-for-server.sh
- name: Run End2End Tests
uses: nick-fields/retry@v3
with:
max_attempts: 3
retry_on: error
timeout_minutes: 10
command: |
env
npm run end2end:test
env:
ANKER_USERNAME: ${{ vars.ANKER_E2E_USER }}
ANKER_PASSWORD: ${{ secrets.ANKER_E2E_PASS }}
ANKER_COUNTRY: ${{ vars.ANKER_E2E_COUNTRY }}
GH_BRANCH: ${{ github.head_ref || github.ref_name }}
build-results:
name: Build results
if: ${{ always() }}
runs-on: ubuntu-latest
needs:
- build
- end2end
steps:
- run: exit 1
# see https://stackoverflow.com/a/67532120/4907315
if: >-
${{
contains(needs.*.result, 'failure')
|| contains(needs.*.result, 'cancelled')
|| contains(needs.*.result, 'skipped')
}}
package:
name: Package Application
runs-on: ubuntu-latest
needs:
- build
- end2end
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
# renovate: datasource=docker depName=node
node-version: '20'
- name: 'Build Package'
run: |
npm run clean
npm run build
- name: Write version vars
run: |
BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"`
BRANCH=${GITHUB_REF_NAME#v}
APP_VERSION=$(cat package.json | grep version| head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g')
echo Version: $APP_VERSION
echo "VERSION=$APP_VERSION" >> $GITHUB_ENV
echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV
echo "BUILD_DATE=$BUILD_DATE" >> $GITHUB_ENV
- name: Push To NPM Registry
id: push-to-npm-tagged
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" >> ~/.npmrc
npm publish
if: github.ref_type == 'tag' || github.tag != ''