@@ -35,23 +35,27 @@ jobs:
3535 yarn
3636 - name : build
3737 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"
38+ run : |
39+ set -o pipefail
40+ yarn build:changed firestore | tee ${{ runner.temp }}/yarn.log.txt
41+ continue-on-error : false
42+ - name : Check if Firestore is changed
43+ id : check-changed
44+ run : egrep "Skipping all" ${{ runner.temp }}/yarn.log.txt
4145 # Continue when "Skipping all" is not found
4246 continue-on-error : true
4347 - name : set output
4448 # This means "Skipping all" was not found
45- if : steps.build .outcome != 'success'
49+ if : steps.check-changed .outcome != 'success'
4650 id : set-output
4751 run : echo "CHANGED=true" >> "$GITHUB_OUTPUT";
4852 - name : Archive build
49- if : ${{ !cancelled() && steps.build.outcome != 'success' }}
53+ if : ${{ !cancelled() && steps.build.outcome == 'success' && steps.check-changed.outcome != 'success' }}
5054 run : |
51- tar -cf build.tar --exclude="\ .git" .
55+ tar -cf build.tar --exclude=.git .
5256 gzip build.tar
5357 - name : Upload build archive
54- if : ${{ !cancelled() && steps.build.outcome != 'success' }}
58+ if : ${{ !cancelled() && steps.build.outcome == 'success' && steps.check-changed.outcome != 'success' }}
5559 uses : actions/upload-artifact@v3
5660 with :
5761 name : build.tar.gz
8185 - name : Bump Node memory limit
8286 run : echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
8387 - name : Test setup and yarn install
84- run : |
85- cp config/ci.config.json config/project.json
88+ run : cp config/ci.config.json config/project.json
8689 - name : Run compat tests
8790 run : cd packages/firestore-compat && yarn run test:ci
8891
@@ -112,11 +115,41 @@ jobs:
112115 - name : Bump Node memory limit
113116 run : echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
114117 - name : Test setup and yarn install
115- run : |
116- cp config/ci.config.json config/project.json
118+ run : cp config/ci.config.json config/project.json
117119 - name : Run tests
118120 run : cd packages/firestore && yarn run ${{ matrix.test-name }}
119121
122+ compat-test-firefox :
123+ name : Test Firestore Compatible on Firefox
124+ # Whatever version of Firefox comes with 22.04 is causing Firefox
125+ # startup to hang when launched by karma. Need to look further into
126+ # why.
127+ runs-on : ubuntu-20.04
128+ needs : build
129+ if : ${{ needs.build.outputs.changed == 'true'}}
130+ steps :
131+ - name : install Firefox stable
132+ run : |
133+ sudo apt-get update
134+ sudo apt-get install firefox
135+ - name : Set up Node (14)
136+ uses : actions/setup-node@v3
137+ with :
138+ node-version : 14.x
139+ - name : Download build archive
140+ uses : actions/download-artifact@v3
141+ with :
142+ name : build.tar.gz
143+ - name : Unzip build artifact
144+ run : tar xf build.tar.gz
145+ - name : Bump Node memory limit
146+ run : echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
147+ - name : Test setup and yarn install
148+ run : cp config/ci.config.json config/project.json
149+ - name : Run compat tests
150+ run : cd packages/firestore-compat && xvfb-run yarn run test:ci
151+ env :
152+ BROWSERS : ' Firefox'
120153
121154 test-firefox :
122155 name : Test Firestore on Firefox
@@ -147,9 +180,20 @@ jobs:
147180 - name : Bump Node memory limit
148181 run : echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
149182 - name : Test setup and yarn install
150- run : |
151- cp config/ci.config.json config/project.json
183+ run : cp config/ci.config.json config/project.json
152184 - name : Run tests
153185 run : cd packages/firestore && xvfb-run yarn run ${{ matrix.test-name }}
154186 env :
155187 BROWSERS : ' Firefox'
188+
189+ # A job that fails if any required job in the test matrix fails,
190+ # to be used as a required check for merging.
191+ check-required-tests :
192+ runs-on : ubuntu-latest
193+ if : always()
194+ name : Check all required tests results
195+ needs : [build, test-chrome, compat-test-chrome]
196+ steps :
197+ - name : Check test matrix
198+ if : needs.build.result == 'failure' || needs.test-chrome.result == 'failure' || needs.compat-test-chrome.result == 'failure'
199+ run : exit 1
0 commit comments