Skip to content

Commit 17cbbd5

Browse files
committed
2 parents 48719c7 + 508e3f3 commit 17cbbd5

File tree

236 files changed

+32086
-51346
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

236 files changed

+32086
-51346
lines changed

.github/actions/create-test/action.yml

Lines changed: 11 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,20 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
1415
name: Create a new survey
1516

1617
inputs:
1718
platform-repository:
18-
description: "ground-platform repository under test"
19+
description: 'ground-platform repository under test'
1920
default: google/ground-platform
2021

2122
upload-artifacts:
22-
description: "Whether to upload the final emulator data artifacts"
23-
default: "false"
23+
description: 'Whether to upload the final emulator data artifacts'
24+
default: 'false'
2425

2526
runs:
26-
using: "composite"
27+
using: 'composite'
2728
steps:
2829
- name: Checkout code
2930
uses: actions/checkout@v4
@@ -38,56 +39,18 @@ runs:
3839
restore-keys: |
3940
${{ runner.os }}-firebase-emulators-
4041
41-
- name: Set up Node.js
42-
uses: actions/setup-node@v2
43-
with:
44-
node-version: "20"
45-
46-
- name: Load cached Node modules
47-
id: cache-npm
48-
uses: actions/cache@v3
49-
env:
50-
cache-name: cache-node-modules
51-
with:
52-
# npm cache files are stored in `~/.npm` on Linux/macOS
53-
path: ~/.npm
54-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
55-
restore-keys: |
56-
${{ runner.os }}-build-${{ env.cache-name }}-
57-
${{ runner.os }}-build-
58-
${{ runner.os }}-
59-
60-
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
61-
name: List the state of Node modules
62-
continue-on-error: true
63-
shell: bash
64-
run: npm list
65-
66-
- name: Install Chrome
67-
uses: browser-actions/setup-chrome@v1
68-
id: setup-chrome
42+
- name: Set up environment
43+
uses: ./.github/actions/setup
6944
with:
70-
chrome-version: 125
71-
72-
- name: Save CHROME_PATH
73-
shell: bash
74-
run: echo "CHROME_PATH=${{ steps.setup-chrome.outputs.chrome-path }}" >> $GITHUB_ENV
75-
76-
- name: Install nx-linux-x64-gnu
77-
shell: bash
78-
run: npm install @nx/nx-linux-x64-gnu
79-
80-
- name: Install dependencies
81-
shell: bash
82-
run: npm install
45+
install-chrome: 'true'
8346

8447
- name: Build project and local deps
8548
shell: bash
86-
run: npx nx build
49+
run: pnpm exec nx build
8750

8851
- name: Run 'Create survey' test
8952
shell: bash
90-
run: npm run test:e2e:create
53+
run: pnpm run test:e2e:create
9154

9255
- name: Move Firebase emulator data (avoids .gitignore)
9356
shell: bash
@@ -98,7 +61,7 @@ runs:
9861
uses: actions/upload-artifact@v4
9962
with:
10063
name: data-create
101-
path: "**/test"
64+
path: '**/test'
10265
retention-days: 7
10366
overwrite: true
10467
if-no-files-found: error

.github/actions/setup/action.yml

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,54 @@
1-
name: "Set up environment"
2-
description: "Sets up Node.js and installs dependencies"
1+
name: Set up environment
2+
description: Sets up Node.js, pnpm, Nx cache, and installs dependencies
33

44
inputs:
55
cache-key-suffix:
6-
description: "Suffix for the Nx cache key (e.g. job name)"
6+
description: Suffix for the Nx cache key (e.g. job name)
77
required: false
8-
default: "default"
8+
default: default
9+
install-chrome:
10+
description: 'Whether to install Google Chrome'
11+
required: false
12+
default: 'false'
913

1014
runs:
11-
using: "composite"
15+
using: composite
1216
steps:
13-
- name: Cache Nx
17+
- name: Restore Nx cache
1418
uses: actions/cache@v4
1519
with:
1620
path: .nx/cache
1721
key: nx-${{ runner.os }}-${{ inputs.cache-key-suffix }}-${{ github.sha }}
1822
restore-keys: |
1923
nx-${{ runner.os }}-${{ inputs.cache-key-suffix }}-
2024
25+
- name: Install pnpm
26+
uses: pnpm/action-setup@v4
27+
with:
28+
version: 9
29+
2130
- name: Set up Node.js
2231
uses: actions/setup-node@v6
2332
with:
24-
node-version: "20"
25-
cache: "npm"
33+
node-version: '22'
34+
cache: pnpm
35+
36+
- name: Install dependencies
37+
shell: bash
38+
run: pnpm install --frozen-lockfile
39+
env:
40+
NX_REJECT_UNKNOWN_LOCAL_CACHE: '0'
41+
42+
- name: Install Chrome
43+
if: ${{ inputs.install-chrome == 'true' }}
44+
uses: browser-actions/setup-chrome@v1
45+
id: setup-chrome
46+
with:
47+
chrome-version: stable
2648

27-
- name: Install deps
28-
run: npm ci
49+
- name: Configure Chrome Environment
50+
if: ${{ inputs.install-chrome == 'true' }}
2951
shell: bash
52+
run: |
53+
echo "CHROME_BIN=${{ steps.setup-chrome.outputs.chrome-path }}" >> $GITHUB_ENV
54+
echo "CHROME_PATH=${{ steps.setup-chrome.outputs.chrome-path }}" >> $GITHUB_ENV
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Copyright 2026 The Ground Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
name: Start Firebase emulator for Android tests
15+
16+
inputs:
17+
platform-repository:
18+
description: "ground-platform repository under test"
19+
default: google/ground-platform
20+
21+
runs:
22+
using: "composite"
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
with:
27+
repository: ${{ inputs.platform-repository }}
28+
29+
- name: Load cached Firebase emulator
30+
uses: actions/cache@v4
31+
with:
32+
path: ~/.cache/firebase/emulators
33+
key: ${{ runner.os }}-firebase-emulators-${{ github.sha }}
34+
restore-keys: |
35+
${{ runner.os }}-firebase-emulators-
36+
37+
- name: Set up environment
38+
uses: ./.github/actions/setup
39+
40+
- name: Start Firebase emulator with Android test data
41+
shell: bash
42+
run: |
43+
MAX_TRIES=60
44+
pnpm exec nx start-android-test-data > firebase-emulator.log 2>&1 &
45+
46+
for ((i=1; i<=$MAX_TRIES; i++)); do
47+
if curl -sf http://localhost:4000 > /dev/null 2>&1; then
48+
echo "Firebase emulator started!"
49+
exit 0
50+
fi
51+
echo "Waiting for Firebase emulator to start... ($i/$MAX_TRIES)"
52+
sleep 5
53+
done
54+
55+
echo "Firebase Emulator failed to start"
56+
cat firebase-emulator.log
57+
exit 1
58+

.github/actions/verify-test/action.yml

Lines changed: 10 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,20 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
1415
name: Verify survey submissions
1516

1617
inputs:
1718
platform-repository:
18-
description: "ground-platform repository under test"
19+
description: 'ground-platform repository under test'
1920
default: google/ground-platform
2021

2122
use-repo-data:
22-
description: "Whether to use the local repository emulator data or not"
23-
default: "true"
23+
description: 'Whether to use the local repository emulator data or not'
24+
default: 'true'
2425

2526
runs:
26-
using: "composite"
27+
using: 'composite'
2728
steps:
2829
- name: Checkout code
2930
uses: actions/checkout@v4
@@ -38,49 +39,14 @@ runs:
3839
restore-keys: |
3940
${{ runner.os }}-firebase-emulators-
4041
41-
- name: Set up Node.js
42-
uses: actions/setup-node@v2
43-
with:
44-
node-version: "20"
45-
46-
- name: Load cached Node modules
47-
id: cache-npm
48-
uses: actions/cache@v3
49-
env:
50-
cache-name: cache-node-modules
51-
with:
52-
# npm cache files are stored in `~/.npm` on Linux/macOS
53-
path: ~/.npm
54-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
55-
restore-keys: |
56-
${{ runner.os }}-build-${{ env.cache-name }}-
57-
${{ runner.os }}-build-
58-
${{ runner.os }}-
59-
60-
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
61-
name: List the state of Node modules
62-
continue-on-error: true
63-
shell: bash
64-
run: npm list
65-
66-
- name: Install Chrome
67-
uses: browser-actions/setup-chrome@v1
68-
id: setup-chrome
42+
- name: Set up environment
43+
uses: ./.github/actions/setup
6944
with:
70-
chrome-version: 125
71-
72-
- name: Save CHROME_PATH
73-
shell: bash
74-
run: |
75-
echo "CHROME_PATH=${{ steps.setup-chrome.outputs.chrome-path }}" >> $GITHUB_ENV
76-
77-
- name: Install nx-linux-x64-gnu
78-
shell: bash
79-
run: npm install @nx/nx-linux-x64-gnu
45+
install-chrome: 'true'
8046

8147
- name: Build project and local deps
8248
shell: bash
83-
run: npx nx build
49+
run: pnpm exec nx build
8450

8551
- name: Copy Firebase emulator data
8652
uses: actions/download-artifact@v4
@@ -96,4 +62,4 @@ runs:
9662

9763
- name: Run 'Verify survey' test
9864
shell: bash
99-
run: npm run test:e2e:verify
65+
run: pnpm run test:e2e:verify

0 commit comments

Comments
 (0)