-
Notifications
You must be signed in to change notification settings - Fork 9
62 lines (53 loc) · 1.85 KB
/
cicd.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
name: CI/CD Pipeline
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build-test-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Adding Node.js
uses: actions/setup-node@v4
with:
node-version: 20.14.0
cache: 'npm'
- name: Install Dependencies
run: npm install
- name: Cache Angular build output
id: cache-ng-build
uses: actions/cache@v4
with:
path: dist
key: ng-build-${{ hashFiles('package-lock.json', 'src/**', 'angular.json', 'scripts/gh-pages-before-add.js') }}
restore-keys: |
ng-build-${{ hashFiles('package-lock.json', 'src/**', 'angular.json', 'scripts/gh-pages-before-add.js') }}
- name: Build Application
run: npm run build
if: steps.cache-ng-build.outputs.cache-hit != 'true'
- name: Run TestCafe tests in container
run: |
docker run -w /opt/tests -v ${{ github.workspace }}:/opt/tests timbru31/node-chrome:20 npx testcafe chrome:headless ./e2e/fixtures --app="npm run serve:ci" -c 4
- name: Upload Artifacts
uses: actions/upload-artifact@v4
if: failure()
with:
path: |
e2e/screenshots
e2e/visual-regression-screenshots
if-no-files-found: ignore
retention-days: 1
compression-level: 0
overwrite: true
- name: Deploy to Github Pages
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && success()
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
git remote set-url origin https://git:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
npm run deploy -- -u "github-actions-bot <[email protected]>"