Skip to content

Commit

Permalink
Reduce duplicate in integration tests
Browse files Browse the repository at this point in the history
As part of the 1.0 release, we removed service_account support from setup-gcloud, but many of the integration tests were actually duplicates now, since they used to test service_account. This updates the integration tests to run all the tests in a single job (reducing the number of times we install NPM packages and download gcloud).
  • Loading branch information
sethvargo committed Nov 10, 2022
1 parent d51b534 commit 310210f
Show file tree
Hide file tree
Showing 10 changed files with 285 additions and 547 deletions.
109 changes: 109 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: 'Integration'

on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
workflow_dispatch:

concurrency:
group: '${{ github.workflow }}-${{ github.head_ref || github.ref }}'
cancel-in-progress: true

jobs:
integration:
if: ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name && github.actor != 'dependabot[bot]' }}
strategy:
fail-fast: false
matrix:
os:
- 'ubuntu-latest'
- 'windows-latest'
- 'macos-latest'
runs-on: '${{ matrix.os }}'

permissions:
id-token: 'write'

steps:
- uses: 'actions/checkout@v3'
with:
node-version: '16.x'

- name: 'Build'
run: 'npm ci && npm run build'

# Default installation
- name: 'Install version'
uses: './'
with:
version: '374.0.0'

# Latest installation
- name: 'Install latest'
uses: './'
with:
version: 'latest'

# By default, there is no configuration
- name: 'Check defaults'
run: 'npm run integration'
env:
TEST_ACCOUNT: '(unset)'
TEST_PROJECT_ID: '(unset)'

# Install components
- name: 'Install components'
uses: './'
with:
install_components: 'alpha,beta'

- name: 'Check components'
run: 'npm run integration'
env:
TEST_COMPONENTS: 'alpha,beta'

# Set a project ID
- name: 'Set project ID'
uses: './'
with:
project_id: '${{ secrets.SETUP_GCLOUD_IT_PROJECT_ID }}'

- name: 'Check project ID'
run: 'npm run integration'
env:
TEST_PROJECT_ID: '${{ secrets.SETUP_GCLOUD_IT_PROJECT_ID }}'

# Authenticate via WIF
- name: 'Authenticate via WIF'
uses: 'google-github-actions/auth@main'
with:
workload_identity_provider: '${{ secrets.WIF_PROVIDER_NAME }}'
service_account: '${{ secrets.OIDC_AUTH_SA_EMAIL }}'

- name: 'Setup gcloud with WIF'
uses: './'

- name: 'Check WIF authentication'
run: 'npm run integration'
env:
TEST_ACCOUNT: '${{ secrets.OIDC_AUTH_SA_EMAIL }}'
TEST_PROJECT_ID: '${{ secrets.SETUP_GCLOUD_IT_PROJECT_ID }}'

# Authenticate via SAKE
- name: 'Authenticate via SAKE'
uses: 'google-github-actions/auth@main'
with:
credentials_json: '${{ secrets.SETUP_GCLOUD_IT_KEY }}'

- name: 'Setup gcloud with SAKE'
uses: './'

- name: 'Check WIF authentication'
run: 'npm run integration'
env:
TEST_ACCOUNT: 'TODO'
TEST_PROJECT_ID: 'TODO'
Loading

0 comments on commit 310210f

Please sign in to comment.