-
Notifications
You must be signed in to change notification settings - Fork 98
142 lines (124 loc) 路 4.31 KB
/
Copy pathmain.yml
File metadata and controls
142 lines (124 loc) 路 4.31 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
name: Build and test
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
cache-dependency-path: src/package-lock.json
- name: Build and test
working-directory: src
run: |
npm ci
npm run build
npm run test
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: dist
path: src/dist
retention-days: 1
# Test ng add and ng deploy across multiple Angular versions (sequentially)
# This catches breaking changes in angular.json structure
# Each test creates its own git repo and deploys locally to verify the full flow
#
# Why checkout + npm ci? The ng-add.js requires @angular-devkit/core which must
# be resolvable from the dist folder. Node.js resolves modules by traversing up
# from the file's location, so we need src/node_modules available.
test-angular-versions:
needs: build-and-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
cache-dependency-path: src/package-lock.json
- name: Install dependencies for module resolution
working-directory: src
run: npm ci
- name: Configure git
run: |
git config --global user.name "CI Bot"
git config --global user.email "ci@test.local"
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: dist
path: src/dist
- name: Link angular-cli-ghpages
working-directory: src/dist
run: npm link
# Test projects are created OUTSIDE the repo to get their own git repos
# (Angular CLI creates a git repo by default with --defaults)
# Each test creates a bare repo as a fake remote to deploy to
- name: Test Angular 18
run: |
cd /tmp
git init --bare remote-18.git
npx @angular/cli@18 new test-app-18 --defaults
cd test-app-18
git remote add origin /tmp/remote-18.git
npm link angular-cli-ghpages
npx ng add angular-cli-ghpages
npx ng deploy
cd /tmp/remote-18.git && git branch | grep gh-pages
echo "Angular 18: build + deploy successful"
- name: Test Angular 19
run: |
cd /tmp
git init --bare remote-19.git
npx @angular/cli@19 new test-app-19 --defaults
cd test-app-19
git remote add origin /tmp/remote-19.git
npm link angular-cli-ghpages
npx ng add angular-cli-ghpages
npx ng deploy
cd /tmp/remote-19.git && git branch | grep gh-pages
echo "Angular 19: build + deploy successful"
- name: Test Angular 20
run: |
cd /tmp
git init --bare remote-20.git
npx @angular/cli@20 new test-app-20 --defaults
cd test-app-20
git remote add origin /tmp/remote-20.git
npm link angular-cli-ghpages
npx ng add angular-cli-ghpages
npx ng deploy
cd /tmp/remote-20.git && git branch | grep gh-pages
echo "Angular 20: build + deploy successful"
- name: Test Angular 21
run: |
cd /tmp
git init --bare remote-21.git
npx @angular/cli@21 new test-app-21 --defaults
cd test-app-21
git remote add origin /tmp/remote-21.git
npm link angular-cli-ghpages
npx ng add angular-cli-ghpages
npx ng deploy
cd /tmp/remote-21.git && git branch | grep gh-pages
echo "Angular 21: build + deploy successful"
- name: Test Angular 22
run: |
cd /tmp
git init --bare remote-22.git
npx @angular/cli@22 new test-app-22 --defaults
cd test-app-22
git remote add origin /tmp/remote-22.git
npm link angular-cli-ghpages
npx ng add angular-cli-ghpages
npx ng deploy
cd /tmp/remote-22.git && git branch | grep gh-pages
echo "Angular 22: build + deploy successful"