-
Notifications
You must be signed in to change notification settings - Fork 1
196 lines (163 loc) · 6.35 KB
/
test-and-deploy.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
name: Build, Test, Deploy
#on: [push, workflow_dispatch]
on:
push:
branches:
- master
workflow_dispatch:
branches:
- master
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
#- name: Install Chrome
# run: |
# sudo DEBIAN_FRONTEND=noninteractive apt-get install -y chromium-browser
# npm i -D puppeteer karma-chrome-launcher
- name: Configure GIT credential helper
env:
TUG_GITLAB_ACCESSTOKEN: ${{ secrets.TUG_GITLAB_ACCESSTOKEN }}
run: |
mkdir -p ~/.config/git/
touch ~/.config/git/credentials
chmod 600 ~/.config/git/credentials
echo "$TUG_GITLAB_ACCESSTOKEN" >> ~/.config/git/credentials
git config --global credential.helper 'store --file ~/.config/git/credentials'
- name: Checkout 🛎️
uses: actions/[email protected]
with:
persist-credentials: false
fetch-depth: 0
- name: Checkout submodules 🌐
run: git submodule update --init
- name: Install 🔧
run: |
yarn install
yarn rollup -c --environment BUILD:kraken
- name: Lint 🚧
run: |
yarn lint
- name: Test 🚨
run: |
yarn test
- name: test output
run: |
ls coverage/*
# - name: SonarQube Scan 🚑
# uses: kitabisa/sonarqube-action@master
# with:
# host: ${{ secrets.SONARQUBE_HOST }}
# login: ${{ secrets.SONARQUBE_TOKEN }}
# - name: Test Full 🔥
# run: |
# yarn test-full
- name: Cleanup GIT credentials
if: ${{ always() }}
run: |
rm ~/.config/git/credentials
build-and-deploy-docker:
needs: build-and-test
runs-on: ubuntu-latest
steps:
- name: Configure GIT credential helper
env:
TUG_GITLAB_ACCESSTOKEN: ${{ secrets.TUG_GITLAB_ACCESSTOKEN }}
run: |
mkdir -p ~/.config/git/
touch ~/.config/git/credentials
chmod 600 ~/.config/git/credentials
echo "$TUG_GITLAB_ACCESSTOKEN" >> ~/.config/git/credentials
git config --global credential.helper 'store --file ~/.config/git/credentials'
- name: Checkout 🛎️
uses: actions/[email protected]
with:
persist-credentials: false
- name: Checkout submodules 🌐
run: git submodule update --init
- name: Fix app-shell URLs 👷
run: |
APPSHELL="./vendor/toolkit/packages/app-shell/src/app-shell.js"
sed -i -e 's:www.tugraz.at/en/about-this-page/legal-notice/:krakenh2020.eu/legal-notice:g' $APPSHELL
sed -i -e 's:www.tugraz.at/ueber-diese-seite/impressum/:krakenh2020.eu/legal-notice:g' $APPSHELL
sed -i -e 's:[email protected]:[email protected]:g' $APPSHELL
- name: Fix git config 👷
run: |
echo "https://github.com/$GITHUB_REPOSITORY.git"
git remote rm origin
git remote add origin https://github.com/$GITHUB_REPOSITORY.git
- name: Install and Build 🔧
run: |
yarn install
yarn rollup -c --environment BUILD:kraken-local
- name: Docker Login
uses: docker/login-action@v1
with:
registry: docker.pkg.github.com
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker Build & Push Docker image
run: |
export DOCKER_TAG=docker.pkg.github.com/krakenh2020/edupilotfrontend/kraken-edu_connector:latest
echo "Building branch: $GITHUB_REF"
echo " at commit: ${{ github.sha }}"
echo " triggered by: ${{ github.event_name}}"
echo " Pushing to: $DOCKER_TAG"
docker build . --tag $DOCKER_TAG --file Dockerfile.nginx
docker push $DOCKER_TAG
- name: Cleanup GIT credentials
if: ${{ always() }}
run: |
rm ~/.config/git/credentials
# build-and-deploy-github:
# needs: build-and-test
# runs-on: ubuntu-latest
# steps:
# - name: Configure GIT credential helper
# env:
# TUG_GITLAB_ACCESSTOKEN: ${{ secrets.TUG_GITLAB_ACCESSTOKEN }}
# run: |
# mkdir -p ~/.config/git/
# touch ~/.config/git/credentials
# chmod 600 ~/.config/git/credentials
# echo "$TUG_GITLAB_ACCESSTOKEN" >> ~/.config/git/credentials
# git config --global credential.helper 'store --file ~/.config/git/credentials'
# - name: Checkout 🛎️
# uses: actions/[email protected]
# with:
# persist-credentials: false
# - name: Checkout submodules 🌐
# run: git submodule update --init
# - name: Fix app-shell URLs 👷
# run: |
# APPSHELL="./vendor/toolkit/packages/app-shell/src/app-shell.js"
# sed -i -e 's:www.tugraz.at/en/about-this-page/legal-notice/:krakenh2020.eu/legal-notice:g' $APPSHELL
# sed -i -e 's:www.tugraz.at/ueber-diese-seite/impressum/:krakenh2020.eu/legal-notice:g' $APPSHELL
# sed -i -e 's:[email protected]:[email protected]:g' $APPSHELL
# - name: Fix git config 👷
# run: |
# echo "https://github.com/$GITHUB_REPOSITORY.git"
# git remote rm origin
# git remote add origin https://github.com/$GITHUB_REPOSITORY.git
# - name: Install and Build 🔧
# run: |
# yarn install
# yarn rollup -c --environment BUILD:kraken
# - name: Deploy FallbackResource 🔀
# run: |
# REDIR='<html><head><meta http-equiv="refresh" content="0; url=https://krakenh2020.github.io/EduPilotFrontend/vc4sm-frontend.html"></head><body></body></html>'
# echo $REDIR > dist/index.html
# echo $REDIR > dist/404.html
# - name: Deploy 🚀
# uses: JamesIves/[email protected]
# with:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# BRANCH: gh-pages # The branch the action should deploy to.
# FOLDER: dist # The folder the action should deploy.
# CLEAN: true # Automatically remove deleted files from the deploy branch
# CLEAN-EXCLUDE: |
# .nojekyll
# - name: Cleanup GIT credentials
# if: ${{ always() }}
# run: |
# rm ~/.config/git/credentials