2021-02-10 19:37:46 +01:00
name : "Master Build, Test & Deploy"
2019-09-30 14:51:38 +02:00
2019-09-30 15:41:14 +02:00
on :
2022-03-25 16:24:21 +01:00
workflow_dispatch :
2019-09-30 15:41:14 +02:00
push :
branches :
- master
2019-09-30 14:51:38 +02:00
jobs :
2021-01-22 16:33:15 +01:00
main :
2019-09-30 14:51:38 +02:00
runs-on : ubuntu-latest
steps :
2022-10-06 14:58:01 +02:00
- uses : actions/checkout@v3
2021-01-22 16:33:15 +01:00
2021-01-22 16:27:42 +01:00
- name : Set node version
2022-10-06 14:58:01 +02:00
uses : actions/setup-node@v3
2021-01-22 15:53:53 +01:00
with :
2022-09-09 22:22:55 +02:00
node-version : '18.x'
2021-01-22 16:33:15 +01:00
2021-01-22 16:27:42 +01:00
- name : Install
2019-09-30 14:51:38 +02:00
run : |
2021-01-22 15:53:53 +01:00
npm install
2021-02-12 14:51:51 +01:00
npm run setheapsize
2021-01-22 16:27:42 +01:00
2019-09-30 14:51:38 +02:00
- name : Lint
2019-09-30 14:56:26 +02:00
run : npx grunt lint
2021-01-22 16:27:42 +01:00
2019-09-30 14:51:38 +02:00
- name : Unit Tests
run : |
2021-01-22 15:33:35 +01:00
npm test
2022-03-28 16:42:11 +02:00
npm run testnodeconsumer
2021-01-22 16:27:42 +01:00
2021-01-22 15:59:26 +01:00
- name : Production Build
2021-02-01 15:10:21 +01:00
if : success()
2023-03-22 12:59:35 +01:00
run : npx grunt prod --msg="Version 10 is here! Read about the new features <a href='https://github.com/gchq/CyberChef/wiki/Character-encoding,-EOL-separators,-and-editor-features'>here</a>"
2021-01-22 16:33:15 +01:00
2021-01-22 16:17:17 +01:00
- name : Generate sitemap
run : npx grunt exec:sitemap
2021-01-22 16:27:42 +01:00
2023-03-09 15:01:21 +01:00
- name : UI Tests
if : success()
run : |
sudo apt-get install xvfb
xvfb-run --server-args="-screen 0 1200x800x24" npx grunt testui
2021-01-22 16:27:42 +01:00
2021-01-22 18:15:58 +01:00
- name : Prepare for GitHub Pages
2021-02-01 15:18:17 +01:00
if : success()
2021-01-22 18:15:58 +01:00
run : npx grunt copy:ghPages
2021-01-22 18:13:17 +01:00
- name : Deploy to GitHub Pages
if : success() && github.ref == 'refs/heads/master'
2022-10-06 14:58:01 +02:00
uses : crazy-max/ghaction-github-pages@v3
2021-01-22 18:13:17 +01:00
with :
target_branch : gh-pages
build_dir : ./build/prod
env :
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}