Skip to content

Commit 1aa4bc2

Browse files
authored
[internal] Update GitHub Actions workflow files (#148)
1 parent 91853d5 commit 1aa4bc2

File tree

11 files changed

+154
-241
lines changed

11 files changed

+154
-241
lines changed

.github/actions/setup-tools/action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ inputs:
1414
dotnet
1515
java
1616
default: all
17+
cache-go:
18+
description: |
19+
Whether to enable the GitHub cache for Go. Appropriate for disabling in
20+
smaller jobs that typically completely before the "real" job has an
21+
opportunity to populate the cache.
22+
default: "true"
1723

1824
runs:
1925
using: "composite"
@@ -27,6 +33,8 @@ runs:
2733
provider/*.sum
2834
upstream/*.sum
2935
sdk/*.sum
36+
# TODO(https://github.com/actions/setup-go/issues/316): Restore but don't save the cache.
37+
cache: ${{ inputs.cache-go }}
3038

3139
- name: Install pulumictl
3240
if: inputs.tools == 'all' || contains(inputs.tools, 'pulumictl')

.github/workflows/license.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ jobs:
3737
uses: ./.github/actions/setup-tools
3838
with:
3939
tools: go
40+
cache-go: false
4041
- run: make upstream
4142
- uses: pulumi/license-check-action@main
4243
with:

.github/workflows/main.yml

Lines changed: 5 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -126,67 +126,15 @@ jobs:
126126
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
127127

128128
test:
129-
name: test
129+
uses: ./.github/workflows/test.yml
130130
needs:
131131
- prerequisites
132132
- build_provider
133133
- build_sdk
134-
permissions:
135-
contents: read
136-
id-token: write
137-
runs-on: ubuntu-latest
138-
env:
139-
PROVIDER_VERSION: ${{ needs.prerequisites.outputs.version }}
140-
steps:
141-
- name: Checkout Repo
142-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
143-
with:
144-
persist-credentials: false
145-
- name: Setup tools
146-
uses: ./.github/actions/setup-tools
147-
with:
148-
tools: pulumictl, pulumicli, ${{ matrix.language }}
149-
- name: Prepare local workspace
150-
run: make prepare_local_workspace
151-
- name: Download bin
152-
uses: ./.github/actions/download-bin
153-
- name: Download SDK
154-
uses: ./.github/actions/download-sdk
155-
with:
156-
language: ${{ matrix.language }}
157-
- name: Restore makefile progress
158-
run: make --touch provider schema build_${{ matrix.language }}
159-
- name: Update path
160-
run: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH"
161-
- name: Install Python deps
162-
if: matrix.language == 'python'
163-
run: |-
164-
pip3 install virtualenv==20.0.23
165-
pip3 install pipenv
166-
- name: Install dependencies
167-
run: make install_${{ matrix.language}}_sdk
168-
- name: Install gotestfmt
169-
uses: GoTestTools/gotestfmt-action@v2
170-
with:
171-
token: ${{ secrets.GITHUB_TOKEN }}
172-
version: v2.5.0
173-
- name: make upstream
174-
run: |
175-
make upstream
176-
- name: Run provider tests
177-
run: |
178-
cd provider && go test -v -json -count=1 -cover -timeout 2h -tags=${{ matrix.language }} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt
179-
- name: Run tests
180-
run: cd examples && go test -v -count=1 -cover -timeout 2h -tags=${{ matrix.language }} -parallel 4
181-
strategy:
182-
fail-fast: false
183-
matrix:
184-
language:
185-
- nodejs
186-
- python
187-
- dotnet
188-
- go
189-
- java
134+
secrets: inherit
135+
with:
136+
version: ${{ needs.prerequisites.outputs.version }}
137+
190138
name: main
191139
on:
192140
workflow_dispatch: {}

.github/workflows/prerelease.yml

Lines changed: 4 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -67,67 +67,14 @@ jobs:
6767
isPrerelease: true
6868

6969
test:
70-
name: test
70+
uses: ./.github/workflows/test.yml
7171
needs:
7272
- prerequisites
7373
- build_provider
7474
- build_sdk
75-
permissions:
76-
contents: read
77-
id-token: write
78-
runs-on: ubuntu-latest
79-
env:
80-
PROVIDER_VERSION: ${{ needs.prerequisites.outputs.version }}
81-
steps:
82-
- name: Checkout Repo
83-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
84-
with:
85-
persist-credentials: false
86-
- name: Setup tools
87-
uses: ./.github/actions/setup-tools
88-
with:
89-
tools: pulumictl, pulumicli, nodejs, python, dotnet, go, java
90-
- name: Prepare local workspace
91-
run: make prepare_local_workspace
92-
- name: Download bin
93-
uses: ./.github/actions/download-bin
94-
- name: Download SDK
95-
uses: ./.github/actions/download-sdk
96-
with:
97-
language: ${{ matrix.language }}
98-
- name: Restore makefile progress
99-
run: make --touch provider schema build_${{ matrix.language }}
100-
- name: Update path
101-
run: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH"
102-
- name: Install Python deps
103-
if: matrix.language == 'python'
104-
run: |-
105-
pip3 install virtualenv==20.0.23
106-
pip3 install pipenv
107-
- name: Install dependencies
108-
run: make install_${{ matrix.language}}_sdk
109-
- name: Install gotestfmt
110-
uses: GoTestTools/gotestfmt-action@v2
111-
with:
112-
token: ${{ secrets.GITHUB_TOKEN }}
113-
version: v2.5.0
114-
- name: make upstream
115-
run: |
116-
make upstream
117-
- name: Run provider tests
118-
run: |
119-
cd provider && go test -v -json -count=1 -cover -timeout 2h -tags=${{ matrix.language }} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt
120-
- name: Run tests
121-
run: cd examples && go test -v -count=1 -cover -timeout 2h -tags=${{ matrix.language }} -parallel 4 .
122-
strategy:
123-
fail-fast: false
124-
matrix:
125-
language:
126-
- nodejs
127-
- python
128-
- dotnet
129-
- go
130-
- java
75+
secrets: inherit
76+
with:
77+
version: ${{ needs.prerequisites.outputs.version }}
13178

13279
name: prerelease
13380
on:

.github/workflows/prerequisites.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ jobs:
7070
run: make provider
7171
- name: Unit-test provider code
7272
run: make test_provider
73+
- name: Upload coverage reports to Codecov
74+
uses: codecov/codecov-action@c2fcb216de2b0348de0100baa3ea2cad9f100a01 # v5.1.0
75+
env:
76+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
7377
- if: inputs.is_pr
7478
name: Check Schema is Valid
7579
run: |

.github/workflows/publish.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ jobs:
112112
name: publish_sdk
113113
needs: publish
114114
runs-on: ubuntu-latest
115+
outputs:
116+
python_version: ${{ steps.python_version.outputs.version }}
115117
steps:
116118
- name: Checkout Repo
117119
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -152,6 +154,13 @@ jobs:
152154
go.*
153155
go/**
154156
!*.tar.gz
157+
- name: Extract python version
158+
id: python_version
159+
working-directory: sdk/python
160+
run: |
161+
pip install toml-cli==0.7.0
162+
version=$(toml get --toml-path pyproject.toml project.version)
163+
echo "version=${version}" >> "$GITHUB_OUTPUT"
155164
create_docs_build:
156165
name: create_docs_build
157166
needs: publish_sdk
@@ -203,3 +212,4 @@ jobs:
203212
# Prelease is run often but we only have 5 concurrent macos runners, so we only test after the stable release.
204213
enableMacosRunner: ${{ inputs.isPrerelease == false }}
205214
skipGoSdk: ${{ inputs.skipGoSdk }}
215+
pythonVersion: ${{ needs.publish_sdk.outputs.python_version }}

.github/workflows/release.yml

Lines changed: 4 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -73,64 +73,11 @@ jobs:
7373
isPrerelease: false
7474

7575
test:
76-
name: test
76+
uses: ./.github/workflows/test.yml
7777
needs:
7878
- prerequisites
7979
- build_provider
8080
- build_sdk
81-
permissions:
82-
contents: read
83-
id-token: write
84-
runs-on: ubuntu-latest
85-
env:
86-
PROVIDER_VERSION: ${{ needs.prerequisites.outputs.version }}
87-
steps:
88-
- name: Checkout Repo
89-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
90-
with:
91-
persist-credentials: false
92-
- name: Setup tools
93-
uses: ./.github/actions/setup-tools
94-
with:
95-
tools: pulumictl, pulumicli, ${{ matrix.language }}
96-
- name: Prepare local workspace
97-
run: make prepare_local_workspace
98-
- name: Download bin
99-
uses: ./.github/actions/download-bin
100-
- name: Download SDK
101-
uses: ./.github/actions/download-sdk
102-
with:
103-
language: ${{ matrix.language }}
104-
- name: Restore makefile progress
105-
run: make --touch provider schema build_${{ matrix.language }}
106-
- name: Update path
107-
run: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH"
108-
- name: Install Python deps
109-
if: matrix.language == 'python'
110-
run: |-
111-
pip3 install virtualenv==20.0.23
112-
pip3 install pipenv
113-
- name: Install dependencies
114-
run: make install_${{ matrix.language}}_sdk
115-
- name: Install gotestfmt
116-
uses: GoTestTools/gotestfmt-action@v2
117-
with:
118-
token: ${{ secrets.GITHUB_TOKEN }}
119-
version: v2.5.0
120-
- name: make upstream
121-
run: |
122-
make upstream
123-
- name: Run provider tests
124-
run: |
125-
cd provider && go test -v -json -count=1 -cover -timeout 2h -tags=${{ matrix.language }} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt
126-
- name: Run tests
127-
run: cd examples && go test -v -count=1 -cover -timeout 2h -tags=${{ matrix.language }} -parallel 4 .
128-
strategy:
129-
fail-fast: false
130-
matrix:
131-
language:
132-
- nodejs
133-
- python
134-
- dotnet
135-
- go
136-
- java
81+
secrets: inherit
82+
with:
83+
version: ${{ needs.prerequisites.outputs.version }}

.github/workflows/run-acceptance-tests.yml

Lines changed: 6 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -113,81 +113,18 @@ jobs:
113113
sha: ${{ github.event.pull_request.head.sha || github.sha }}
114114

115115
test:
116+
# Don't run tests on PRs from forks.
116117
if: github.event_name == 'repository_dispatch' ||
117118
github.event.pull_request.head.repo.full_name == github.repository
118-
name: test
119+
uses: ./.github/workflows/test.yml
119120
needs:
120121
- prerequisites
121122
- build_provider
122123
- build_sdk
123-
permissions:
124-
contents: read
125-
id-token: write
126-
runs-on: ubuntu-latest
127-
env:
128-
PROVIDER_VERSION: ${{ needs.prerequisites.outputs.version }}
129-
steps:
130-
- name: Checkout Repo
131-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
132-
with:
133-
ref: ${{ env.PR_COMMIT_SHA }}
134-
persist-credentials: false
135-
- name: Checkout p/examples
136-
if: matrix.testTarget == 'pulumiExamples'
137-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
138-
with:
139-
repository: pulumi/examples
140-
path: p-examples
141-
- name: Setup tools
142-
uses: ./.github/actions/setup-tools
143-
with:
144-
tools: pulumictl, pulumicli, ${{ matrix.language }}
145-
- name: Prepare local workspace
146-
run: make prepare_local_workspace
147-
- name: Download bin
148-
uses: ./.github/actions/download-bin
149-
- name: Download SDK
150-
uses: ./.github/actions/download-sdk
151-
with:
152-
language: ${{ matrix.language }}
153-
- name: Restore makefile progress
154-
run: make --touch provider schema build_${{ matrix.language }}
155-
- name: Update path
156-
run: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH"
157-
- name: Install Python deps
158-
if: matrix.language == 'python'
159-
run: |-
160-
pip3 install virtualenv==20.0.23
161-
pip3 install pipenv
162-
- name: Install dependencies
163-
run: make install_${{ matrix.language}}_sdk
164-
- name: Install gotestfmt
165-
uses: GoTestTools/gotestfmt-action@v2
166-
with:
167-
token: ${{ secrets.GITHUB_TOKEN }}
168-
version: v2.5.0
169-
- name: make upstream
170-
run: |
171-
make upstream
172-
- name: Run provider tests
173-
run: |
174-
cd provider && go test -v -json -count=1 -cover -timeout 2h -tags=${{ matrix.language }} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt
175-
- name: Run tests
176-
if: matrix.testTarget == 'local'
177-
run: cd examples && go test -v -count=1 -cover -timeout 2h -tags=${{ matrix.language }} -skip TestPulumiExamples -parallel 4 .
178-
- name: Run pulumi/examples tests
179-
if: matrix.testTarget == 'pulumiExamples'
180-
run: cd examples && go test -v -count=1 -cover -timeout 2h -tags=${{ matrix.language }} -run TestPulumiExamples -parallel 4 .
181-
strategy:
182-
fail-fast: false
183-
matrix:
184-
language:
185-
- nodejs
186-
- python
187-
- dotnet
188-
- go
189-
- java
190-
testTarget: [local]
124+
secrets: inherit
125+
with:
126+
version: ${{ needs.prerequisites.outputs.version }}
127+
191128
license_check:
192129
name: License Check
193130
uses: ./.github/workflows/license.yml

0 commit comments

Comments
 (0)