Skip to content

Commit f28c984

Browse files
authored
chore: only run unit tests once (#205)
Right now, unit tests are run twice, once during unit and once during integration. This fixes that.
1 parent a322f22 commit f28c984

2 files changed

Lines changed: 18 additions & 33 deletions

File tree

.github/workflows/integration.yml

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -152,35 +152,3 @@ jobs:
152152

153153
- name: 'Get output'
154154
run: 'echo "${{ steps.upload.outputs.uploaded }}"'
155-
156-
mocha:
157-
if: ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name && github.actor != 'dependabot[bot]' }}
158-
name: 'mocha'
159-
runs-on: '${{ matrix.os }}'
160-
strategy:
161-
fail-fast: false
162-
matrix:
163-
os:
164-
- 'ubuntu-latest'
165-
- 'windows-latest'
166-
- 'macos-latest'
167-
168-
steps:
169-
- uses: 'actions/checkout@v2'
170-
171-
- uses: 'actions/setup-node@v2'
172-
with:
173-
node-version: '12.x'
174-
175-
- name: 'npm build'
176-
run: 'npm ci && npm run build'
177-
178-
- uses: 'google-github-actions/auth@main'
179-
with:
180-
credentials_json: '${{ secrets.UPLOAD_CLOUD_STORAGE_GCP_SA_KEY_JSON }}'
181-
182-
- name: 'npm test'
183-
run: 'npm run test'
184-
env:
185-
UPLOAD_CLOUD_STORAGE_TEST_BUCKET: '${{ secrets.UPLOAD_CLOUD_STORAGE_TEST_BUCKET }}'
186-
UPLOAD_CLOUD_STORAGE_TEST_PROJECT: '${{ secrets.UPLOAD_CLOUD_STORAGE_PROJECT }}'

.github/workflows/unit.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ jobs:
1717
unit:
1818
name: 'unit'
1919
runs-on: '${{ matrix.os }}'
20+
21+
permissions:
22+
contents: 'read'
23+
id-token: 'write'
24+
2025
strategy:
2126
fail-fast: false
2227
matrix:
@@ -38,8 +43,20 @@ jobs:
3843
- name: 'npm lint'
3944
# There's no need to run the linter for each operating system, since it
4045
# will find the same thing 3x and clog up the PR review.
41-
if: ${{matrix.os == 'ubuntu-latest'}}
46+
if: ${{ matrix.os == 'ubuntu-latest' }}
4247
run: 'npm run lint'
4348

49+
# Only authenticate if this is a full CI run.
50+
- uses: 'google-github-actions/auth@main'
51+
with:
52+
workload_identity_provider: '${{ secrets.WIF_PROVIDER_NAME }}'
53+
service_account: '${{ secrets.UPLOAD_CLOUD_STORAGE_GCP_SA_EMAIL }}'
54+
if: ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name && github.actor != 'dependabot[bot]' }}
55+
56+
# The secrets will only be injected in pushes to main or from maintainers.
57+
# If they aren't present, the associated steps are skipped.
4458
- name: 'npm test'
4559
run: 'npm run test'
60+
env:
61+
UPLOAD_CLOUD_STORAGE_TEST_BUCKET: '${{ secrets.UPLOAD_CLOUD_STORAGE_TEST_BUCKET }}'
62+
UPLOAD_CLOUD_STORAGE_TEST_PROJECT: '${{ secrets.UPLOAD_CLOUD_STORAGE_PROJECT }}'

0 commit comments

Comments
 (0)