-
Notifications
You must be signed in to change notification settings - Fork 2
145 lines (124 loc) · 4.88 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
#
# Copyright contributors to the Galasa project
#
# SPDX-License-Identifier: EPL-2.0
#
name: Main build
on:
workflow_dispatch:
push:
branches: [main]
env:
REGISTRY: ghcr.io
NAMESPACE: ${{ github.repository_owner }}
BRANCH: ${{ github.ref_name }}
jobs:
check-required-secrets-configured:
name: Check required secrets configured
uses: galasa-dev/galasa/.github/workflows/check-required-secrets-configured.yaml@main
with:
check_write_github_packages_username: 'true'
check_write_github_packages_token: 'true'
secrets:
WRITE_GITHUB_PACKAGES_USERNAME: ${{ secrets.WRITE_GITHUB_PACKAGES_USERNAME }}
WRITE_GITHUB_PACKAGES_TOKEN: ${{ secrets.WRITE_GITHUB_PACKAGES_TOKEN }}
build-webui:
name: Build the Galasa Web UI
runs-on: ubuntu-latest
needs: check-required-secrets-configured
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'semeru'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 8.9
cache-disabled: true
- name: Generate typescript openapi client using Gradle
run: |
gradle generateTypeScriptClient --info \
--no-daemon --console plain \
-PsourceMaven=https://development.galasa.dev/main/maven-repo/obr 2>&1 | tee build.log
- name: Upload Gradle build log
if: failure()
uses: actions/upload-artifact@v4
with:
name: gradle-build-log
path: build.log
retention-days: 7
- name: Fix openapi client
run: |
mkdir -p temp &&
promiseApiFile="galasa-ui/src/generated/galasaapi/types/PromiseAPI.ts" &&
cat ${promiseApiFile} | sed "s/const result =/const apiResult =/g" > temp/PromiseAPI-temp.ts &&
cat temp/PromiseAPI-temp.ts | sed "s/return result\.toPromise/return apiResult\.toPromise/g" > temp/PromiseAPI.ts &&
cp temp/PromiseAPI.ts ${promiseApiFile} &&
indexFile="galasa-ui/src/generated/galasaapi/index.ts" &&
cat ${indexFile} | sed "s/export { Configuration/export { type Configuration/1" > temp/index-temp.ts &&
cat temp/index-temp.ts | sed "s/export { PromiseMiddleware/export { type PromiseMiddleware/1" > temp/index.ts &&
cp temp/index.ts ${indexFile}
- name: Setup Nodejs
uses: actions/setup-node@v3
with:
node-version: "20.10.0"
- name: Installing webui's dependencies using npm
working-directory: ./galasa-ui
run: |
npm install
- name: Running webui's unit tests using npm
working-directory: ./galasa-ui
run: |
npm test -- --watchAll=false
- name: Building webui using npm
working-directory: ./galasa-ui
run: |
npm run build
- name: Login to Github Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.WRITE_GITHUB_PACKAGES_USERNAME }}
password: ${{ secrets.WRITE_GITHUB_PACKAGES_TOKEN }}
- name: Extract metadata for webui image
id: metadata
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/webui
- name: Build Webui image
id: build
uses: docker/build-push-action@v5
with:
context: .
file: dockerfiles/dockerfile.webui
push: true
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
trigger-workflow:
# Skip this job for forks
if: ${{ github.repository_owner == 'galasa-dev' }}
name: Recycle ecosystem1
needs: build-webui
runs-on: ubuntu-latest
steps:
- name: Trigger Helm workflow using GitHub CLI
env:
GH_TOKEN: ${{ secrets.GALASA_TEAM_GITHUB_TOKEN }}
run: |
gh workflow run build-helm.yaml --repo https://github.com/galasa-dev/automation
report-failure:
# Skip this job for forks
if: ${{ failure() && github.repository_owner == 'galasa-dev' }}
name: Report workflow failure into Slack channel
runs-on: ubuntu-latest
needs: build-webui
steps:
- name: Report workflow failure into Slack channel
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
run : |
docker run --rm -v ${{ github.workspace }}:/var/workspace ghcr.io/galasa-dev/galasabld-ibm:main slackpost workflows --repo "webui" --workflowName "${{ github.workflow }}" --workflowRunNum "${{ github.run_id }}" --ref "${{ env.BRANCH }}" --hook "${{ env.SLACK_WEBHOOK }}"