Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up CI jobs #135

Merged
merged 1 commit into from
Dec 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 65 additions & 71 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -1,109 +1,103 @@
name: get-secretmanager-secrets Integration
name: 'integration'

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

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

jobs:
gcloud:
auth_workload_identity_federation:
if: ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name && github.actor != 'dependabot[bot]' }}
name: with setup-gcloud
runs-on: ubuntu-latest
name: 'auth_workload_identity_federation'
permissions:
contents: 'read'
id-token: 'write'
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v2
- uses: google-github-actions/setup-gcloud@master
- uses: 'actions/checkout@v2'

- uses: 'actions/setup-node@v2'
with:
service_account_key: ${{ secrets.GET_SECRETMANAGER_SECRETS_SA_KEY_B64 }}
export_default_credentials: true
- id: build
name: Build dist
run: |-
npm install
npm run build
- id: secrets
name: get secrets
uses: ./
node-version: '12.x'

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

- uses: 'google-github-actions/auth@main'
with:
secrets: |-
token:${{ secrets.GET_SECRETMANAGER_SECRETS_SECRET_REF }}
password:${{ secrets.GET_SECRETMANAGER_SECRETS_SECRET_VERSION_REF }}
- name: get output
run: echo '${{ steps.secrets.outputs.token }}${{ steps.secrets.outputs.password }}'
workload_identity_provider: '${{ secrets.WIF_PROVIDER_NAME }}'
service_account: '${{ secrets.GET_SECRETMANAGER_SECRETS_SA_EMAIL }}'

b64_json:
if: ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name && github.actor != 'dependabot[bot]' }}
name: with base64 json creds
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: build
name: Build dist
run: |-
npm install
npm run build
- id: secrets
name: get secrets
uses: ./
- id: 'secrets'
name: 'secrets'
uses: './'
with:
credentials: ${{ secrets.GET_SECRETMANAGER_SECRETS_SA_KEY_JSON }}
secrets: |-
token:${{ secrets.GET_SECRETMANAGER_SECRETS_SECRET_REF }}
password:${{ secrets.GET_SECRETMANAGER_SECRETS_SECRET_VERSION_REF }}
- name: get output

- name: 'outputs'
run: echo '${{ steps.secrets.outputs.token }}${{ steps.secrets.outputs.password }}'

json:
auth_credentials:
if: ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name && github.actor != 'dependabot[bot]' }}
name: with json creds
runs-on: ubuntu-latest
name: 'auth_credentials'
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v2
- id: build
name: Build dist
run: |-
npm install
npm run build
- id: secrets
name: get secrets
uses: ./
- uses: 'actions/checkout@v2'

- uses: 'actions/setup-node@v2'
with:
node-version: '12.x'

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

- uses: 'google-github-actions/auth@main'
with:
credentials_json: '${{ secrets.GET_SECRETMANAGER_SECRETS_SA_KEY_B64 }}'

- id: 'secrets'
name: 'secrets'
uses: './'
with:
credentials: ${{ secrets.GET_SECRETMANAGER_SECRETS_SA_KEY_JSON }}
secrets: |-
token:${{ secrets.GET_SECRETMANAGER_SECRETS_SECRET_REF }}
password:${{ secrets.GET_SECRETMANAGER_SECRETS_SECRET_VERSION_REF }}
- name: get output

- name: 'outputs'
run: echo '${{ steps.secrets.outputs.token }}${{ steps.secrets.outputs.password }}'

wif:
permissions:
contents: 'read'
id-token: 'write'
# Deprecated
json:
if: ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name && github.actor != 'dependabot[bot]' }}
name: with wif
runs-on: ubuntu-latest
name: 'json'
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v2
- uses: google-github-actions/auth@main
- uses: 'actions/checkout@v2'

- uses: 'actions/setup-node@v2'
with:
workload_identity_provider: ${{ secrets.WIF_PROVIDER_NAME }}
service_account: ${{ secrets.GET_SECRETMANAGER_SECRETS_SA_EMAIL }}
- id: build
name: Build dist
run: |-
npm install
npm run build
- id: secrets
name: get secrets
uses: ./
node-version: '12.x'

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

- id: 'secrets'
name: 'secrets'
uses: './'
with:
credentials: '${{ secrets.GET_SECRETMANAGER_SECRETS_SA_KEY_JSON }}'
secrets: |-
token:${{ secrets.GET_SECRETMANAGER_SECRETS_SECRET_REF }}
password:${{ secrets.GET_SECRETMANAGER_SECRETS_SECRET_VERSION_REF }}
- name: get output

- name: 'outputs'
run: echo '${{ steps.secrets.outputs.token }}${{ steps.secrets.outputs.password }}'
14 changes: 8 additions & 6 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
on: pull_request_target
name: 'label'

on: 'pull_request_target'

jobs:
apply-label:
sethvargo marked this conversation as resolved.
Show resolved Hide resolved
if: github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
runs-on: 'ubuntu-latest'
steps:
- uses: actions/github-script@v3
- uses: 'actions/github-script@v3'
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github-token: '${{ secrets.GITHUB_TOKEN }}'
script: |-
github.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
Expand Down
46 changes: 29 additions & 17 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,45 @@
name: get-secretmanager-secrets Unit
name: 'unit'

on: [push, pull_request]
on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'

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

jobs:
run:
name: test
runs-on: ${{ matrix.operating-system }}
name: 'unit'
runs-on: '${{ matrix.os }}'
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
os:
- 'ubuntu-latest'
- 'windows-latest'
- 'macos-latest'
steps:
- uses: actions/checkout@v2
- uses: 'actions/checkout@v2'

- uses: actions/setup-node@master
- uses: 'actions/setup-node@v2'
with:
node-version: 12.x
node-version: '12.x'

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

- name: npm lint
run: npm run lint
- name: 'npm lint'
# There's no need to run the linter for each operating system, since it
# will find the same thing 3x and clog up the PR review.
if: ${{matrix.os == 'ubuntu-latest'}}
run: 'npm run lint'

- name: npm test
run: npm run test
- name: 'npm test'
env:
TEST_GET_SECRETMANAGER_SECRETS_CREDENTIALS: ${{ secrets.GET_SECRETMANAGER_SECRETS_SA_KEY_JSON }}
TEST_GET_SECRETMANAGER_SECRETS_SECRET_VERSION_REF: ${{ secrets.GET_SECRETMANAGER_SECRETS_SECRET_VERSION_REF }}
TEST_GET_SECRETMANAGER_SECRETS_CREDENTIALS: '${{ secrets.GET_SECRETMANAGER_SECRETS_SA_KEY_JSON }}'
TEST_GET_SECRETMANAGER_SECRETS_SECRET_VERSION_REF: '${{ secrets.GET_SECRETMANAGER_SECRETS_SECRET_VERSION_REF }}'
run: npm run test