1
- name : Unit tests
1
+ name : Test and publish
2
2
3
3
on :
4
4
push :
5
5
branches :
6
- - master
7
- pull_request :
6
+ - " **"
7
+ paths-ignore :
8
+ - " **/*.md"
9
+ release :
10
+ types :
11
+ - published
8
12
9
13
jobs :
10
14
build :
11
15
runs-on : ubuntu-latest
16
+ name : Build
12
17
steps :
13
- - uses : actions/checkout@v2
14
- - uses : actions/setup-node@v2-beta
15
- with :
16
- node-version : ' 12'
17
- check-latest : true
18
- - name : yarn cache dir
19
- id : yarn-cache-dir-path
20
- run : echo "::set-output name=dir::$(yarn cache dir)"
21
- - uses : actions/cache@v2
22
- with :
23
- path : ${{ steps.yarn-cache-dir-path.outputs.dir }}
24
- key : ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
25
- restore-keys : |
26
- ${{ runner.os }}-yarn-
27
- ${{ runner.os }}-
28
- - name : yarn test
29
- run : |
30
- yarn install --frozen-lockfile --prefer-offline
31
- yarn lint
32
- yarn build
33
- yarn test:all
18
+ - name : Checkout
19
+ uses : actions/checkout@v2
20
+ - name : Setup node
21
+ uses : actions/setup-node@v2-beta
22
+ with :
23
+ node-version : ' 14'
24
+ - name : Get cache directory
25
+ id : yarn-cache-dir-path
26
+ run : echo "::set-output name=dir::$(yarn cache dir)"
27
+ - name : Use yarn cache
28
+ uses : actions/cache@v2
29
+ with :
30
+ path : |
31
+ ${{ steps.yarn-cache-dir-path.outputs.dir }}
32
+ ~/.npm-packages-offline-cache
33
+ key : ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
34
+ restore-keys : |
35
+ ${{ runner.os }}-yarn-
36
+ ${{ runner.os }}-
37
+ - name : Install deps
38
+ run : |
39
+ yarn config set yarn-offline-mirror ~/.npm-packages-offline-cache
40
+ yarn config set yarn-offline-mirror-pruning true
41
+ yarn install --frozen-lockfile --prefer-offline
42
+ - name : Build
43
+ id : yarn-pack-dir
44
+ run : ./tools/build.sh
45
+ - name : ' Upload Artifact'
46
+ uses : actions/upload-artifact@v2
47
+ with :
48
+ name : angularfire-${{ github.run_id }}
49
+ path : |
50
+ angularfire.tgz
51
+ publish.sh
52
+ unpack.sh
53
+ retention-days : 1
54
+ test :
55
+ runs-on : ubuntu-latest
56
+ needs : build
57
+ strategy :
58
+ matrix :
59
+ node : ["10", "12", "14"]
60
+ name : Test Node.js ${{ matrix.node }} (Ubuntu)
61
+ steps :
62
+ - name : Checkout
63
+ uses : actions/checkout@v2
64
+ - name : Setup node
65
+ uses : actions/setup-node@v2-beta
66
+ with :
67
+ node-version : ${{ matrix.node }}
68
+ check-latest : true
69
+ - name : Get cache directory
70
+ id : yarn-cache-dir-path
71
+ run : echo "::set-output name=dir::$(yarn cache dir)"
72
+ - name : Use yarn cache
73
+ uses : actions/cache@v2
74
+ with :
75
+ path : |
76
+ ${{ steps.yarn-cache-dir-path.outputs.dir }}
77
+ ~/.npm-packages-offline-cache
78
+ key : ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
79
+ restore-keys : |
80
+ ${{ runner.os }}-yarn-
81
+ ${{ runner.os }}-
82
+ - name : Use Firebase emulator cache
83
+ uses : actions/cache@v2
84
+ with :
85
+ path : ~/.cache/firebase/emulators
86
+ key : firebase_emulators
87
+ - name : Install deps
88
+ run : |
89
+ yarn config set yarn-offline-mirror ~/.npm-packages-offline-cache
90
+ yarn config set yarn-offline-mirror-pruning true
91
+ yarn install --frozen-lockfile --prefer-offline
92
+ - name : ' Download Artifacts'
93
+ uses : actions/download-artifact@v2
94
+ - name : Expand Artifact
95
+ run : |
96
+ mkdir -p dist/packages-dist
97
+ chmod +x angularfire-${{ github.run_id }}/unpack.sh
98
+ ./angularfire-${{ github.run_id }}/unpack.sh
99
+ - name : Run tests
100
+ run : yarn test:all
101
+ publish :
102
+ runs-on : ubuntu-latest
103
+ name : Publish (NPM)
104
+ needs : test
105
+ if : ${{ github.ref == 'refs/heads/master' || github.event_name == 'release' }}
106
+ steps :
107
+ - name : Setup node
108
+ uses : actions/setup-node@v2-beta
109
+ with :
110
+ node-version : ' 14'
111
+ registry-url : ' https://registry.npmjs.org'
112
+ - name : ' Download Artifacts'
113
+ uses : actions/download-artifact@v2
114
+ - name : Publish
115
+ run : |
116
+ cd ./angularfire-${{ github.run_id }}/
117
+ chmod +x publish.sh
118
+ ./publish.sh
119
+ env :
120
+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
0 commit comments