@@ -2,10 +2,16 @@ name: Test Firestore
22
33on : pull_request
44
5+ env :
6+ artifactRetentionDays : 14
7+
58jobs :
6- test-chrome :
7- name : Test Firestore on Chrome and Node If Changed
9+ build :
10+ name : Build Firestore
11+
812 runs-on : ubuntu-latest
13+ outputs :
14+ changed : ${{ steps.set-output.outputs.CHANGED }}
915
1016 steps :
1117 - name : Checkout Repo
@@ -28,27 +34,112 @@ jobs:
2834 cp config/ci.config.json config/project.json
2935 yarn
3036 - name : build
31- run : yarn build:changed firestore
32- - name : Run tests if firestore or its dependencies has changed
33- run : yarn test:changed firestore
37+ id : build
38+ # TODO(wuandy): Separate yarn and egrep into steps, so build failure
39+ # is captured by github actions.
40+ run : yarn build:changed firestore | egrep "Skipping all"
41+ # Continue when "Skipping all" is not found
42+ continue-on-error : true
43+ - name : set output
44+ # This means "Skipping all" was not found
45+ if : steps.build.outcome != 'success'
46+ id : set-output
47+ run : echo "CHANGED=true" >> "$GITHUB_OUTPUT";
48+ - name : Archive build
49+ if : ${{ !cancelled() && steps.build.outcome != 'success' }}
50+ run : |
51+ tar -cf build.tar --exclude="\.git" .
52+ gzip build.tar
53+ - name : Upload build archive
54+ if : ${{ !cancelled() && steps.build.outcome != 'success' }}
55+ uses : actions/upload-artifact@v3
56+ with :
57+ name : build.tar.gz
58+ path : build.tar.gz
59+ retention-days : ${{ env.artifactRetentionDays }}
60+
61+ compat-test-chrome :
62+ name : Test Firestore Compatible
63+ runs-on : ubuntu-latest
64+ needs : build
65+ if : ${{ needs.build.outputs.changed == 'true'}}
66+ steps :
67+ - name : Set up Node (14)
68+ uses : actions/setup-node@v3
69+ with :
70+ node-version : 14.x
71+ - name : install Chrome stable
72+ run : |
73+ sudo apt-get update
74+ sudo apt-get install google-chrome-stable
75+ - name : Download build archive
76+ uses : actions/download-artifact@v3
77+ with :
78+ name : build.tar.gz
79+ - name : Unzip build artifact
80+ run : tar xf build.tar.gz
81+ - name : Bump Node memory limit
82+ run : echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
83+ - name : Test setup and yarn install
84+ run : |
85+ cp config/ci.config.json config/project.json
86+ - name : Run compat tests
87+ run : cd packages/firestore-compat && yarn run test:ci
88+
89+ test-chrome :
90+ name : Test Firestore
91+ strategy :
92+ matrix :
93+ test-name : ["test:browser", "test:travis", "test:lite:browser", "test:browser:prod:nameddb", "test:lite:browser:nameddb"]
94+ runs-on : ubuntu-latest
95+ needs : build
96+ if : ${{ needs.build.outputs.changed == 'true'}}
97+ steps :
98+ - name : Set up Node (14)
99+ uses : actions/setup-node@v3
100+ with :
101+ node-version : 14.x
102+ - name : install Chrome stable
103+ run : |
104+ sudo apt-get update
105+ sudo apt-get install google-chrome-stable
106+ - name : Download build archive
107+ uses : actions/download-artifact@v3
108+ with :
109+ name : build.tar.gz
110+ - name : Unzip build artifact
111+ run : tar xf build.tar.gz
112+ - name : Bump Node memory limit
113+ run : echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
114+ - name : Test setup and yarn install
115+ run : |
116+ cp config/ci.config.json config/project.json
117+ - name : Run tests
118+ run : cd packages/firestore && yarn run ${{ matrix.test-name }}
119+
34120
35121 test-firefox :
36- name : Test Firestore on Firefox If Changed
122+ name : Test Firestore on Firefox
123+ strategy :
124+ matrix :
125+ test-name : ["test:browser", "test:travis", "test:lite:browser", "test:browser:prod:nameddb", "test:lite:browser:nameddb"]
37126 # Whatever version of Firefox comes with 22.04 is causing Firefox
38127 # startup to hang when launched by karma. Need to look further into
39128 # why.
40129 runs-on : ubuntu-20.04
41-
130+ needs : build
131+ if : ${{ needs.build.outputs.changed == 'true'}}
42132 steps :
43133 - name : install Firefox stable
44134 run : |
45135 sudo apt-get update
46136 sudo apt-get install firefox
47- - name : Checkout Repo
48- uses : actions/checkout@master
137+ - name : Download build archive
138+ uses : actions/download-artifact@v3
49139 with :
50- # This makes Actions fetch all Git history so run-changed script can diff properly.
51- fetch-depth : 0
140+ name : build.tar.gz
141+ - name : Unzip build artifact
142+ run : tar xf build.tar.gz
52143 - name : Set up Node (14)
53144 uses : actions/setup-node@v3
54145 with :
@@ -58,10 +149,7 @@ jobs:
58149 - name : Test setup and yarn install
59150 run : |
60151 cp config/ci.config.json config/project.json
61- yarn
62- - name : build
63- run : yarn build:changed firestore
64- - name : Run tests if firestore or its dependencies has changed
65- run : xvfb-run yarn test:changed firestore
152+ - name : Run tests
153+ run : cd packages/firestore && xvfb-run yarn run ${{ matrix.test-name }}
66154 env :
67155 BROWSERS : ' Firefox'
0 commit comments