Skip to content

Commit

Permalink
Merge pull request #45 from GoogleCloudPlatform/latest-version
Browse files Browse the repository at this point in the history
Add support for specifying `latest` for version
  • Loading branch information
craigdbarber committed Jan 30, 2020
2 parents b1d344a + 0c88840 commit c965b60
Show file tree
Hide file tree
Showing 13 changed files with 440 additions and 44 deletions.
28 changes: 25 additions & 3 deletions .github/workflows/setup-gcloud-it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ name: Integration Tests
# kick off integration test runs for the time being.
on: [push]
jobs:
run:
name: setup-gcloud
versioned:
name: setup-gcloud versioned
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
Expand All @@ -16,7 +16,7 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: setup-gcloud local
- name: setup-gcloud
uses: ./setup-gcloud/
with:
version: '278.0.0'
Expand All @@ -26,3 +26,25 @@ jobs:
- name: Integration Tests
shell: bash
run: ./setup-gcloud/__tests__/integration-tests.sh
latest:
name: setup-gcloud latest
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v2

- name: setup-gcloud
uses: ./setup-gcloud/
with:
version: 'latest'
service_account_email: ${{ secrets.SETUP_GCLOUD_IT_EMAIL }}
service_account_key: ${{ secrets.SETUP_GCLOUD_IT_KEY }}

- name: Integration Tests
shell: bash
run: ./setup-gcloud/__tests__/integration-tests.sh


1 change: 1 addition & 0 deletions .github/workflows/setup-gcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ jobs:
name: setup-gcloud
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
steps:
Expand Down
4 changes: 2 additions & 2 deletions setup-gcloud/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ steps:
- uses: actions/checkout@v1
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with:
version: '275.0.0'
version: '278.0.0'
service_account_email: ${{ secrets.GCP_SA_EMAIL }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
- run: gcloud info
```

## Inputs

* `version`: The version of the gcloud to be installed. Example: `275.0.0`
* `version`: (Optional) The version of the gcloud to be installed. Example: `275.0.0`, Default: `latest`

* `service_account_email`: (Optional) The service account email which will be used for authentication.

Expand Down
2 changes: 1 addition & 1 deletion setup-gcloud/__tests__/install-util.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('installGcloudSDK tests', () => {
afterAll(async () => {
await io.rmRF(toolDir);
await io.rmRF(tempDir);
});
}, TEST_TIMEOUT_MILLIS);

it(
'Installs gcloud for current env',
Expand Down
30 changes: 30 additions & 0 deletions setup-gcloud/__tests__/version-util.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* Tests version-util.
*/

import {getLatestGcloudSDKVersion} from '../src/version-util';

describe('getLatestGcloudSDKVersion test', () => {
it('Successfully retrieves latest version', async () => {
const semVerPattern = /^[0-9]+\.[0-9]+\.[0-9]+$/;
const result = await getLatestGcloudSDKVersion();
expect(result).toBeDefined();
expect(semVerPattern.test(result)).toBe(true);
});
});
4 changes: 2 additions & 2 deletions setup-gcloud/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ description: 'Setup a gcloud environment and add it to the PATH'
author: 'GoogleCloudPlatform'
inputs:
version:
description: 'The version of the gcloud SDK to be installed. Example: 275.0.0'
default: '275.0.0'
description: 'The version of the gcloud SDK to be installed. Example: 278.0.0'
default: 'latest'
required: false
service_account_email:
description: 'The service account email which will be used for authentication.'
Expand Down

0 comments on commit c965b60

Please sign in to comment.