Skip to content

Commit

Permalink
Regenerate Github Actions workflows for pulumi-scaleway (#351)
Browse files Browse the repository at this point in the history
* Regenerate workflows for pulumi-scaleway
* Add permissions on the calling side

---------

Co-authored-by: pulumi-bot <bot@pulumi.com>
  • Loading branch information
ringods and pulumi-bot authored Dec 17, 2024
1 parent cd8a4c7 commit e835a28
Show file tree
Hide file tree
Showing 14 changed files with 214 additions and 231 deletions.
12 changes: 11 additions & 1 deletion .github/actions/setup-tools/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,29 @@ inputs:
dotnet
java
default: all
cache-go:
description: |
Whether to enable the GitHub cache for Go. Appropriate for disabling in
smaller jobs that typically completely before the "real" job has an
opportunity to populate the cache.
default: "true"

runs:
using: "composite"
steps:
- name: Install Go
if: inputs.tools == 'all' || contains(inputs.tools, 'go')
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5
with:
go-version: "1.22.x"
cache-dependency-path: |
provider/*.sum
upstream/*.sum
sdk/go/*.sum
sdk/*.sum
*.sum
# TODO(https://github.com/actions/setup-go/issues/316): Restore but don't save the cache.
cache: ${{ inputs.cache-go }}

- name: Install pulumictl
if: inputs.tools == 'all' || contains(inputs.tools, 'pulumictl')
Expand Down
34 changes: 9 additions & 25 deletions .github/workflows/build_provider.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# WARNING: This file is autogenerated - changes will be overwritten when regenerated by https://github.com/pulumi/ci-mgmt

name: "Build Provider"

on:
Expand All @@ -15,7 +17,6 @@ jobs:
env:
PROVIDER_VERSION: ${{ inputs.version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SIGN: ${{ secrets.AZURE_SIGNING_KEY_VAULT_URI != '' }}
strategy:
fail-fast: true
matrix:
Expand Down Expand Up @@ -53,30 +54,13 @@ jobs:
run: make --touch provider schema

- name: Build provider
if: matrix.platform.os != 'windows'
run: make bin/${{ matrix.platform.os }}-${{ matrix.platform.arch }}/pulumi-resource-scaleway

- name: Build windows provider
if: matrix.platform.os == 'windows'
run: make bin/${{ matrix.platform.os }}-${{ matrix.platform.arch }}/pulumi-resource-scaleway.exe

- name: Sign windows provider
if: matrix.platform.os == 'windows' && env.SIGN == 'true'
run: |
az login --service-principal \
-u ${{ secrets.AZURE_SIGNING_CLIENT_ID }} \
-p ${{ secrets.AZURE_SIGNING_CLIENT_SECRET }} \
-t ${{ secrets.AZURE_SIGNING_TENANT_ID }} \
-o none;
wget https://github.com/ebourg/jsign/releases/download/6.0/jsign-6.0.jar;
java -jar jsign-6.0.jar \
--storetype AZUREKEYVAULT \
--keystore "PulumiCodeSigning" \
--url ${{ secrets.AZURE_SIGNING_KEY_VAULT_URI }} \
--storepass "$(az account get-access-token --resource "https://vault.azure.net" | jq -r .accessToken)" \
bin/windows-amd64/pulumi-resource-scaleway.exe;
run: make "provider-${{ matrix.platform.os }}-${{ matrix.platform.arch }}"
env:
AZURE_SIGNING_CLIENT_ID: ${{ secrets.AZURE_SIGNING_CLIENT_ID }}
AZURE_SIGNING_CLIENT_SECRET: ${{ secrets.AZURE_SIGNING_CLIENT_SECRET }}
AZURE_SIGNING_TENANT_ID: ${{ secrets.AZURE_SIGNING_TENANT_ID }}
AZURE_SIGNING_KEY_VAULT_URI: ${{ secrets.AZURE_SIGNING_KEY_VAULT_URI }}
SKIP_SIGNING: ${{ secrets.AZURE_SIGNING_CLIENT_ID == '' && secrets.AZURE_SIGNING_CLIENT_SECRET == '' && secrets.AZURE_SIGNING_TENANT_ID == '' && secrets.AZURE_SIGNING_KEY_VAULT_URI == '' }}

- name: Package provider
run: make provider_dist-${{ matrix.platform.os }}-${{ matrix.platform.arch }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build_sdk.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# WARNING: This file is autogenerated - changes will be overwritten when regenerated by https://github.com/pulumi/ci-mgmt

name: "Build SDK"

on:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/license.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
uses: ./.github/actions/setup-tools
with:
tools: go
cache-go: false
- run: make upstream
- uses: pulumi/license-check-action@main
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
with:
persist-credentials: false
- name: Install go
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5
with:
# The versions of golangci-lint and setup-go here cross-depend and need to update together.
go-version: 1.23
Expand Down
52 changes: 5 additions & 47 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,60 +126,18 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

test:
name: test
uses: ./.github/workflows/test.yml
needs:
- prerequisites
- build_provider
- build_sdk
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
env:
PROVIDER_VERSION: ${{ needs.prerequisites.outputs.version }}
steps:
- name: Checkout Repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Setup tools
uses: ./.github/actions/setup-tools
with:
tools: pulumictl, pulumicli, ${{ matrix.language }}
- name: Prepare local workspace
run: make prepare_local_workspace
- name: Download bin
uses: ./.github/actions/download-bin
- name: Download SDK
uses: ./.github/actions/download-sdk
with:
language: ${{ matrix.language }}
- name: Restore makefile progress
run: make --touch provider schema build_${{ matrix.language }}
- name: Update path
run: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH"
- name: Install Python deps
if: matrix.language == 'python'
run: |-
pip3 install virtualenv==20.0.23
pip3 install pipenv
- name: Install dependencies
run: make install_${{ matrix.language}}_sdk
- name: Install gotestfmt
uses: GoTestTools/gotestfmt-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: v2.5.0
- name: Run tests
run: cd examples && go test -count=1 -cover -timeout 2h -tags=${{ matrix.language }} -parallel 4
strategy:
fail-fast: false
matrix:
language:
- dotnet
- go
- nodejs
- python
secrets: inherit
with:
version: ${{ needs.prerequisites.outputs.version }}

name: main
on:
workflow_dispatch: {}
Expand Down
51 changes: 4 additions & 47 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,60 +67,17 @@ jobs:
isPrerelease: true

test:
name: test
uses: ./.github/workflows/test.yml
needs:
- prerequisites
- build_provider
- build_sdk
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
env:
PROVIDER_VERSION: ${{ needs.prerequisites.outputs.version }}
steps:
- name: Checkout Repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Setup tools
uses: ./.github/actions/setup-tools
with:
tools: pulumictl, pulumicli, dotnet, go, nodejs, python
- name: Prepare local workspace
run: make prepare_local_workspace
- name: Download bin
uses: ./.github/actions/download-bin
- name: Download SDK
uses: ./.github/actions/download-sdk
with:
language: ${{ matrix.language }}
- name: Restore makefile progress
run: make --touch provider schema build_${{ matrix.language }}
- name: Update path
run: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH"
- name: Install Python deps
if: matrix.language == 'python'
run: |-
pip3 install virtualenv==20.0.23
pip3 install pipenv
- name: Install dependencies
run: make install_${{ matrix.language}}_sdk
- name: Install gotestfmt
uses: GoTestTools/gotestfmt-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: v2.5.0
- name: Run tests
run: cd examples && go test -count=1 -cover -timeout 2h -tags=${{ matrix.language }} -parallel 4 .
strategy:
fail-fast: false
matrix:
language:
- dotnet
- go
- nodejs
- python
secrets: inherit
with:
version: ${{ needs.prerequisites.outputs.version }}

name: prerelease
on:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/prerequisites.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# WARNING: This file is autogenerated - changes will be overwritten when regenerated by https://github.com/pulumi/ci-mgmt

name: "Prerequisites"

on:
Expand Down Expand Up @@ -68,6 +70,10 @@ jobs:
run: make provider
- name: Unit-test provider code
run: make test_provider
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@7f8b4b4bde536c465e797be725718b88c5d95e0e # v5.1.1
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- if: inputs.is_pr
name: Check Schema is Valid
run: |
Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ jobs:
name: publish_sdk
needs: publish
runs-on: ubuntu-latest
outputs:
python_version: ${{ steps.python_version.outputs.version }}
steps:
- name: Checkout Repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand All @@ -112,13 +114,13 @@ jobs:
tools: pulumictl, pulumicli, dotnet, go, nodejs, python
- name: Publish SDKs
if: inputs.skipJavaSdk == false
uses: pulumi/pulumi-package-publisher@1c0359ba74243cf6651efacfd839c751d8ff87e2 # v0.0.20
uses: pulumi/pulumi-package-publisher@696a0fe98f86d86ada2a842d1859f3e8c40d6cd7 # v0.0.21
with:
sdk: all,!java
version: ${{ inputs.version }}
- name: Publish SDKs (except Java)
if: inputs.skipJavaSdk == true
uses: pulumi/pulumi-package-publisher@1c0359ba74243cf6651efacfd839c751d8ff87e2 # v0.0.20
uses: pulumi/pulumi-package-publisher@696a0fe98f86d86ada2a842d1859f3e8c40d6cd7 # v0.0.21
with:
sdk: all,!java,!java
version: ${{ inputs.version }}
Expand All @@ -140,6 +142,13 @@ jobs:
go.*
go/**
!*.tar.gz
- name: Extract python version
id: python_version
working-directory: sdk/python
run: |
pip install toml-cli==0.7.0
version=$(toml get --toml-path pyproject.toml project.version)
echo "version=${version}" >> "$GITHUB_OUTPUT"
clean_up_release_labels:
name: Clean up release labels
Expand Down Expand Up @@ -172,3 +181,4 @@ jobs:
# Prelease is run often but we only have 5 concurrent macos runners, so we only test after the stable release.
enableMacosRunner: ${{ inputs.isPrerelease == false }}
skipGoSdk: ${{ inputs.skipGoSdk }}
pythonVersion: ${{ needs.publish_sdk.outputs.python_version }}
51 changes: 4 additions & 47 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,57 +73,14 @@ jobs:
isPrerelease: false

test:
name: test
uses: ./.github/workflows/test.yml
needs:
- prerequisites
- build_provider
- build_sdk
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
env:
PROVIDER_VERSION: ${{ needs.prerequisites.outputs.version }}
steps:
- name: Checkout Repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Setup tools
uses: ./.github/actions/setup-tools
with:
tools: pulumictl, pulumicli, ${{ matrix.language }}
- name: Prepare local workspace
run: make prepare_local_workspace
- name: Download bin
uses: ./.github/actions/download-bin
- name: Download SDK
uses: ./.github/actions/download-sdk
with:
language: ${{ matrix.language }}
- name: Restore makefile progress
run: make --touch provider schema build_${{ matrix.language }}
- name: Update path
run: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH"
- name: Install Python deps
if: matrix.language == 'python'
run: |-
pip3 install virtualenv==20.0.23
pip3 install pipenv
- name: Install dependencies
run: make install_${{ matrix.language}}_sdk
- name: Install gotestfmt
uses: GoTestTools/gotestfmt-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: v2.5.0
- name: Run tests
run: cd examples && go test -count=1 -cover -timeout 2h -tags=${{ matrix.language }} -parallel 4 .
strategy:
fail-fast: false
matrix:
language:
- dotnet
- go
- nodejs
- python
secrets: inherit
with:
version: ${{ needs.prerequisites.outputs.version }}
Loading

0 comments on commit e835a28

Please sign in to comment.