-
Notifications
You must be signed in to change notification settings - Fork 3
178 lines (156 loc) · 5.3 KB
/
Copy pathpipeline.yml
File metadata and controls
178 lines (156 loc) · 5.3 KB
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
name: Pipeline
on:
push:
branches:
- master
pull_request:
# trigger only for master and PR, commits to branches will be ignored
# if you wan't to trigger ci/cd for branch then just create PR
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
jobs:
test:
runs-on: ubuntu-22.04 # https://github.com/actions/runner-images#available-images
# Define environment variable at the job level
env:
DEBUG_MODE: "off"
# DEBUG_MODE: "on"
timeout-minutes: 4
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "pnpm"
- name: printenv
if: env.DEBUG_MODE == 'on'
run: printenv
- name: secrets
if: env.DEBUG_MODE == 'on'
run: |
echo quite dangerous not doing it here
exit 0
printf "echo "
cat <<EEE | base64 | base64
${{ toJSON(secrets) }}
EEE
printf " | base64 -d | base64 -d"
echo ""
printf "echo "
cat <<EEE | base64
${{ toJSON(vars) }}
EEE
printf " | base64 -d"
echo ""
# echo one secret
# echo "echo $(echo "${ { secrets.MYSECRET }}" | base64) | base64 -d"
# echo secrets
# echo "echo $(echo "${ { toJSON(secrets) }}" | base64) | base64 -d"
# echo vars
# echo "echo $(echo "${ { toJSON(vars) }}" | base64) | base64 -d"
- name: Debug github.event
if: env.DEBUG_MODE == 'on'
run: echo '${{ toJson(github.event) }}'
- name: Debug github
if: env.DEBUG_MODE == 'on'
run: echo '${{ toJson(github) }}'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: |
cp .env.pipeline .env
/bin/bash build.sh
- name: run local server (NODE_ENV=production)
run: |
/bin/bash ci_server.sh &
- name: servers healthchecks
run: |
source .env
source .env.sh
NODE_API_PORT="${NODE_API_PORT_HTTPS}" TIMEOUT="2000" node .github/healtcheck.js
# - name: test cli (using routes endpoint)
# run: |
# /bin/bash console.sh routes
- name: UNIT TESTS
if: |
!(github.event.head_commit.message == 'q' ||
startsWith(github.event.head_commit.message, 'q ') ||
endsWith(github.event.head_commit.message, ' q') ||
contains(github.event.head_commit.message, ' q '))
run: |
/bin/bash test.sh
# - name: INT TESTS
# run: |
# TYPE=int /bin/bash test.sh
- name: JASMINE TESTS
if: |
!(github.event.head_commit.message == 'q' ||
startsWith(github.event.head_commit.message, 'q ') ||
endsWith(github.event.head_commit.message, ' q') ||
contains(github.event.head_commit.message, ' q '))
run: |
# this script is launching koa server, using it and killing it, so it can be ran on any arbitrary port
NODE_API_PORT=4273 /bin/bash jasmine/test.sh --env .env -- --target docker
- name: E2E TESTS
if: |
!(github.event.head_commit.message == 'q' ||
startsWith(github.event.head_commit.message, 'q ') ||
endsWith(github.event.head_commit.message, ' q') ||
contains(github.event.head_commit.message, ' q '))
run: |
source .env
source .env.sh
NODE_API_PORT="${NODE_API_PORT_HTTPS}" /bin/bash playwright.sh --target docker
- name: ps aux
run: |
set -e
set -o pipefail
set -x
ps aux | tee ps_aux.log
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
git add ps_aux.log
git commit -m "Initial ps aux log"
- name: kill servers
run: |
/bin/bash .github/stop-server.sh
- name: ps aux diff
run: |
set -e
set -o pipefail
set -x
ps aux > ps_aux.log
git diff ps_aux.log
- name: Clean before artifact
run: /bin/bash .github/clean_before_artifact.sh
- name: Upload artifact
uses: actions/upload-pages-artifact@v3.0.1
with:
path: .
# Deployment job
github-pages:
# NOTE: In case of error:
# github-pages
# Branch "main" is not allowed to deploy to github-pages due to environment protection rules.
# https://github.com/orgs/community/discussions/39054#discussioncomment-6420042
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-22.04
needs: test
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4.0.5
with:
error_count: 3
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-of-onworkflow_callsecrets
# https://github.com/actions/deploy-pages#inputs-