-
-
Notifications
You must be signed in to change notification settings - Fork 2
62 lines (53 loc) · 1.85 KB
/
angular-tests.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
name: Angular Tests
on:
push:
branches:
- '*' # Trigger on all branches
jobs:
build:
runs-on: [x64]
timeout-minutes: 8
if: github.event_name == 'push' # Only trigger on pushes
steps:
- name: Check if this is the latest commit
id: latest_commit_check
run: |
# Use PowerShell syntax for executing commands
$latestCommit = git rev-parse HEAD
$latestRef = git for-each-ref --sort=-committerdate refs/heads/ --format '%(objectname)%(refname)' | Select-Object -First 1 | ForEach-Object { $_.Split(" ")[1] }
if ($latestCommit -eq $latestRef) {
echo "is_latest_commit=true" >> $GITHUB_ENV
} else {
echo "is_latest_commit=false" >> $GITHUB_ENV
}
- name: Paths Changes Filter
uses: dorny/[email protected]
with:
filters: |
src:
- 'src/**'
- name: Setup Node.js
if: env.is_latest_commit == 'true'
uses: actions/setup-node@v2
with:
node-version: '16.x'
- name: Install Angular CLI
if: env.is_latest_commit == 'true'
run: yarn global add @angular/cli # Use Yarn to install Angular CLI
- name: Cache Yarn dependencies
if: env.is_latest_commit == 'true'
uses: actions/cache@v2
with:
path: ~/.cache/yarn
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Clear Yarn Cache
if: env.is_latest_commit == 'true'
run: yarn cache clean
- name: Install dependencies
if: env.is_latest_commit == 'true'
run: yarn install # Use Yarn to install dependencies
- name: Run tests
if: env.is_latest_commit == 'true'
run: yarn test-headless # Use Yarn to run tests