-
Notifications
You must be signed in to change notification settings - Fork 3
166 lines (131 loc) · 4.2 KB
/
main.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
name: CI/CD
on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
- name: Setup Ruby enviornment
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: Setup Node.js enviornemnt
uses: actions/setup-node@v2
with:
node-version: '16'
- name: Install yarn
run: |
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update && sudo apt install yarn
yarn --version
- name: Install all dependencies
run: |
cd website && bundle install --jobs=10 && cd ..
gem install jekyll --user-install
yarn
- name: Build assets (such as imgs, css, js, etc.) with gulp (pre-build of website)
run: gulp prebuild
- name: Build link redirect pages
run: node create_site_redirect_links.js
- name: Build site with Jekyll
run: cd website && bundle exec jekyll build && cd ..
- name: More gulp tasks for minification and optimization (post-build of website)
run: gulp postbuild
- name: Prepare
run: |
mkdir public
cp -r website/_site/* public
cd public
cd ..
- name: Save as an artifact
uses: actions/upload-artifact@v2
with:
name: public-website
path: ./public
# security-testing:
# runs-on: ubuntu-latest
# needs: [build]
# steps:
# - name: Download artifact
# uses: actions/download-artifact@v4.1.7
# with:
# name: public-website
# path: ./public
# - name: Setup Node.js enviornemnt
# uses: actions/setup-node@v1.4.4
# - name: Install http-server
# run: sudo npm install --global http-server
# - name: Run http-server
# run: http-server ./public &
# - name: OWASP ZAP Baseline Scan
# uses: zaproxy/action-baseline@v0.4.0
# with:
# target: http://localhost:8080
# cmd_options: -I
lighthouse-check:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v2.3.4
- name: Download artifact
uses: actions/download-artifact@v4.1.7
with:
name: public-website
path: ./public
- name: Setup Node.js enviornemnt
uses: actions/setup-node@v1.4.4
- name: Install http-server
run: sudo npm install --global http-server
- name: Run http-server
run: http-server ./public &
- name: Make tempdir for artifacts
run: mkdir /tmp/artifacts
- name: Run Lighthouse
uses: foo-software/lighthouse-check-action@v2.0.5
with:
accessToken: ${{ secrets.GITHUB_TOKEN }}
author: ${{ github.actor }}
outputDirectory: /tmp/artifacts
urls: "http://localhost:8080/,http://localhost:8080/rover,http://localhost:8080/sumobot"
sha: ${{ github.sha }}
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: Lighthouse reports
path: /tmp/artifacts
html5-validation-testing:
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Download artifact
uses: actions/download-artifact@v4.1.7
with:
name: public-website
path: ./public
- name: HTML5 Validation
uses: Cyb3r-Jak3/html5validator-action@v0.4.3
with:
root: ./public
deploy:
runs-on: ubuntu-latest
needs: [build, html5-validation-testing]
# needs: [build, security-testing, html5-validation-testing]
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2.3.4
- name: Download artifact
uses: actions/download-artifact@v4.1.7
with:
name: public-website
path: ./public
- name: Deploy
uses: peaceiris/actions-gh-pages@v3.7.3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public