mirror of
https://github.com/google-github-actions/setup-gcloud.git
synced 2026-08-21 08:29:23 +00:00
Cloud Run Action (#117)
* Cloud Run Action Drafted * Cloud Run action * refactor * rename * Add metadata and tests * Update Readme and required fields * Update e2e tests * Update tests * Add log messages * fix typo in obj field * Update YAML * Update Env Var names * Update workflow tests * Update tests * Update testing * Update tests * Update workflow * Update workflow dir * fix typo * test output * Update integration tests * add workdir * set up auth for service request * Add check for empty array * Wait for URL * fix test * Update for PR comments
This commit is contained in:
parent
79f381996b
commit
a244a889d6
19 changed files with 329019 additions and 0 deletions
177
.github/workflows/deploy-cloudrun-it.yml
vendored
Normal file
177
.github/workflows/deploy-cloudrun-it.yml
vendored
Normal file
|
|
@ -0,0 +1,177 @@
|
|||
name: deploy-cloudrun Integration
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'deploy-cloudrun/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'deploy-cloudrun/**'
|
||||
|
||||
jobs:
|
||||
gcloud:
|
||||
name: with setup-gcloud
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ./setup-gcloud # Set up ADC to make authenticated request to service
|
||||
with:
|
||||
service_account_email: ${{ secrets.DEPLOY_CLOUDRUN_SA_EMAIL }}
|
||||
service_account_key: ${{ secrets.DEPLOY_CLOUDRUN_SA_KEY_B64 }}
|
||||
export_default_credentials: true
|
||||
- id: deploy
|
||||
uses: ./deploy-cloudrun
|
||||
env:
|
||||
GCLOUD_PROJECT: ${{ secrets.DEPLOY_CLOUDRUN_PROJECT_ID }}
|
||||
with:
|
||||
image: gcr.io/cloudrun/hello
|
||||
service: test-gcloud
|
||||
- uses: actions/setup-node@master
|
||||
with:
|
||||
node-version: 12.x
|
||||
- run: npm install
|
||||
working-directory: ./deploy-cloudrun
|
||||
- name: integration tests
|
||||
run: npm run e2e-tests
|
||||
working-directory: ./deploy-cloudrun
|
||||
env:
|
||||
URL: ${{ steps.deploy.outputs.url }}
|
||||
|
||||
b64_json:
|
||||
name: with base64 json creds
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- id: deploy
|
||||
uses: ./deploy-cloudrun
|
||||
with:
|
||||
credentials: ${{ secrets.DEPLOY_CLOUDRUN_SA_KEY_B64 }}
|
||||
image: gcr.io/cloudrun/hello
|
||||
service: test-b64
|
||||
- uses: actions/setup-node@master
|
||||
with:
|
||||
node-version: 12.x
|
||||
- run: npm install
|
||||
working-directory: ./deploy-cloudrun
|
||||
- uses: ./setup-gcloud # Set up ADC to make authenticated request to service
|
||||
with:
|
||||
service_account_email: ${{ secrets.DEPLOY_CLOUDRUN_SA_EMAIL }}
|
||||
service_account_key: ${{ secrets.DEPLOY_CLOUDRUN_SA_KEY_B64 }}
|
||||
export_default_credentials: true
|
||||
- name: integration tests
|
||||
run: npm run e2e-tests
|
||||
working-directory: ./deploy-cloudrun
|
||||
env:
|
||||
URL: ${{ steps.deploy.outputs.url }}
|
||||
GCLOUD_PROJECT: ${{ secrets.DEPLOY_CLOUDRUN_PROJECT_ID }}
|
||||
|
||||
json:
|
||||
name: with json creds
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- id: deploy
|
||||
uses: ./deploy-cloudrun
|
||||
with:
|
||||
credentials: ${{ secrets.DEPLOY_CLOUDRUN_SA_KEY_JSON }}
|
||||
image: gcr.io/cloudrun/hello
|
||||
service: test-json
|
||||
- uses: actions/setup-node@master
|
||||
with:
|
||||
node-version: 12.x
|
||||
- run: npm install
|
||||
working-directory: ./deploy-cloudrun
|
||||
- uses: ./setup-gcloud # Set up ADC to make authenticated request to service
|
||||
with:
|
||||
service_account_email: ${{ secrets.DEPLOY_CLOUDRUN_SA_EMAIL }}
|
||||
service_account_key: ${{ secrets.DEPLOY_CLOUDRUN_SA_KEY_B64 }}
|
||||
export_default_credentials: true
|
||||
- name: integration tests
|
||||
run: npm run e2e-tests
|
||||
working-directory: ./deploy-cloudrun
|
||||
env:
|
||||
URL: ${{ steps.deploy.outputs.url }}
|
||||
GCLOUD_PROJECT: ${{ secrets.DEPLOY_CLOUDRUN_PROJECT_ID }}
|
||||
|
||||
envVars:
|
||||
name: with Env Vars
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- id: deploy
|
||||
uses: ./deploy-cloudrun
|
||||
with:
|
||||
credentials: ${{ secrets.DEPLOY_CLOUDRUN_SA_KEY_JSON }}
|
||||
image: gcr.io/cloudrun/hello
|
||||
service: test-envvars
|
||||
env_vars:
|
||||
- uses: actions/setup-node@master
|
||||
with:
|
||||
node-version: 12.x
|
||||
- run: npm install
|
||||
working-directory: ./deploy-cloudrun
|
||||
- uses: ./setup-gcloud # Set up ADC to make authenticated request to service
|
||||
with:
|
||||
service_account_email: ${{ secrets.DEPLOY_CLOUDRUN_SA_EMAIL }}
|
||||
service_account_key: ${{ secrets.DEPLOY_CLOUDRUN_SA_KEY_B64 }}
|
||||
export_default_credentials: true
|
||||
- name: integration tests
|
||||
run: npm run e2e-tests
|
||||
working-directory: ./deploy-cloudrun
|
||||
env:
|
||||
URL: ${{ steps.deploy.outputs.url }}
|
||||
GCLOUD_PROJECT: ${{ secrets.DEPLOY_CLOUDRUN_PROJECT_ID }}
|
||||
|
||||
yaml:
|
||||
name: with YAML metadata
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- id: deploy
|
||||
uses: ./deploy-cloudrun
|
||||
with:
|
||||
credentials: ${{ secrets.DEPLOY_CLOUDRUN_SA_KEY_JSON }}
|
||||
metadata: ./deploy-cloudrun/tests/unit/service.basic.yaml
|
||||
- uses: actions/setup-node@master
|
||||
with:
|
||||
node-version: 12.x
|
||||
- run: npm install
|
||||
working-directory: ./deploy-cloudrun
|
||||
- uses: ./setup-gcloud # Set up ADC to make authenticated request to service
|
||||
with:
|
||||
service_account_email: ${{ secrets.DEPLOY_CLOUDRUN_SA_EMAIL }}
|
||||
service_account_key: ${{ secrets.DEPLOY_CLOUDRUN_SA_KEY_B64 }}
|
||||
export_default_credentials: true
|
||||
- name: integration tests
|
||||
run: npm run e2e-tests
|
||||
working-directory: ./deploy-cloudrun
|
||||
env:
|
||||
URL: ${{ steps.deploy.outputs.url }}
|
||||
GCLOUD_PROJECT: ${{ secrets.DEPLOY_CLOUDRUN_PROJECT_ID }}
|
||||
|
||||
metadata:
|
||||
name: with full YAML metada
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- id: deploy
|
||||
uses: ./deploy-cloudrun
|
||||
with:
|
||||
credentials: ${{ secrets.DEPLOY_CLOUDRUN_SA_KEY_JSON }}
|
||||
metadata: ./deploy-cloudrun/tests/unit/service.full.yaml
|
||||
- uses: actions/setup-node@master
|
||||
with:
|
||||
node-version: 12.x
|
||||
- run: npm install
|
||||
working-directory: ./deploy-cloudrun
|
||||
- uses: ./setup-gcloud # Set up ADC to make authenticated request to service # Set up ADC to make authenticated request to service
|
||||
with:
|
||||
service_account_email: ${{ secrets.DEPLOY_CLOUDRUN_SA_EMAIL }}
|
||||
service_account_key: ${{ secrets.DEPLOY_CLOUDRUN_SA_KEY_B64 }}
|
||||
export_default_credentials: true
|
||||
- name: integration tests
|
||||
run: npm run e2e-tests
|
||||
working-directory: ./deploy-cloudrun
|
||||
env:
|
||||
URL: ${{ steps.deploy.outputs.url }}
|
||||
GCLOUD_PROJECT: ${{ secrets.DEPLOY_CLOUDRUN_PROJECT_ID }}
|
||||
44
.github/workflows/deploy-cloudrun.yml
vendored
Normal file
44
.github/workflows/deploy-cloudrun.yml
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
name: deploy-cloudrun Unit
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'deploy-cloudrun/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'deploy-cloudrun/**'
|
||||
|
||||
jobs:
|
||||
run:
|
||||
name: test
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: actions/setup-node@master
|
||||
with:
|
||||
node-version: 12.x
|
||||
|
||||
- name: npm install
|
||||
run: npm install
|
||||
working-directory: ./deploy-cloudrun
|
||||
|
||||
- name: npm lint
|
||||
run: npm run lint
|
||||
working-directory: ./deploy-cloudrun
|
||||
|
||||
- uses: ./setup-gcloud
|
||||
with:
|
||||
service_account_email: ${{ secrets.DEPLOY_CLOUDRUN_SA_EMAIL }}
|
||||
service_account_key: ${{ secrets.DEPLOY_CLOUDRUN_SA_KEY_B64 }}
|
||||
export_default_credentials: true
|
||||
- name: npm test
|
||||
run: npm run test
|
||||
working-directory: ./deploy-cloudrun
|
||||
env:
|
||||
TEST_DEPLOY_CLOUDRUN_CREDENTIALS: ${{ secrets.DEPLOY_CLOUDRUN_SA_KEY_B64 }}
|
||||
TEST_DEPLOY_CLOUDRUN_PROJECT: ${{ secrets.DEPLOY_CLOUDRUN_PROJECT_ID }}
|
||||
GCLOUD_PROJECT: ${{ secrets.DEPLOY_CLOUDRUN_PROJECT_ID }}
|
||||
Loading…
Add table
Add a link
Reference in a new issue