Skip to content

Adding Changedlog_Pending to ignore list of main GHA workflow (#347) #811

Adding Changedlog_Pending to ignore list of main GHA workflow (#347)

Adding Changedlog_Pending to ignore list of main GHA workflow (#347) #811

name: Build and run tests
on:
push:
branches:
- main
tags-ignore:
- v*
- sdk/*
- '**'
pull_request:
branches:
- main
paths_ignore:
- CHANGELOG.md
repository_dispatch:
types:
- run-acceptance-tests-command
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
PULUMI_BACKEND_URL: https://api.pulumi-staging.io
# Required to properly write "go mod edit -replace=.." when running go examples
PULUMI_GO_DEP_ROOT: ${{ github.workspace }}/..
PROVIDER: pulumiservice
# Need to pin this as 0.10.0 until codegen is updated
PULUMI_JAVA_SDK_VERSION: 0.10.0
# Lookup nuget packages from this directory as well as default nuget directories
PULUMI_LOCAL_NUGET: ${{ github.workspace }}/nuget
PULUMI_TEST_OWNER: service-provider-test-org
PULUMI_TEST_USE_SERVICE: true
jobs:
build_sdks:
if: github.event_name == 'repository_dispatch' || github.event.pull_request.head.repo.full_name == github.repository
name: build_sdks
runs-on: ubuntu-latest
needs: prerequisites
strategy:
fail-fast: true
matrix:
dotnetversion: [ 3.1.301 ]
goversion: [ 1.21.x ]
language: [ nodejs, python, dotnet, go, java ]
nodeversion: [ 20.x ]
pythonversion: [ 3.11 ]
javaversion: [ 11 ]
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Checkout Scripts Repo
uses: actions/checkout@v4
with:
path: ci-scripts
repository: pulumi/scripts
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
- name: Install Go
uses: actions/setup-go@v5
if: ${{ matrix.language == 'go' }}
with:
go-version: ${{ matrix.goversion }}
cache-dependency-path: sdk/go.sum
- name: Setup Node
uses: actions/setup-node@v4
if: ${{ matrix.language == 'nodejs' }}
with:
node-version: ${{matrix.nodeversion}}
registry-url: https://registry.npmjs.org
- name: Setup DotNet
uses: actions/setup-dotnet@v4
if: ${{ matrix.language == 'dotnet' }}
with:
dotnet-version: ${{matrix.dotnetversion}}
- name: Setup Python
uses: actions/setup-python@v5
if: ${{ matrix.language == 'python' }}
with:
python-version: ${{matrix.pythonversion}}
- name: Set up JDK 11
uses: actions/setup-java@v4
if: ${{ matrix.language == 'java' }}
with:
java-version: ${{matrix.javaversion}}
distribution: 'adopt'
cache: 'gradle'
- name: Validate Gradle wrapper
uses: gradle/actions/wrapper-validation@v3
if: ${{ matrix.language == 'java' }}
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.11.0
with:
repo: pulumi/pulumictl
- name: Install Pulumi CLI
uses: pulumi/actions@v5
- name: Download provider + tfgen binaries
uses: actions/download-artifact@v4
with:
name: pulumi-${{ env.PROVIDER }}
path: ${{ github.workspace }}/bin
- name: Restore binary perms
run: find ${{ github.workspace }} -name "pulumi-*-${{ env.PROVIDER }}" -print
-exec chmod +x {} \;
- name: Generate SDK
run: make ${{ matrix.language }}_sdk
- name: Check worktree clean
run: ./ci-scripts/ci/check-worktree-is-clean
- run: git status --porcelain
- name: Compress SDK folder
run: tar -zcf sdk/${{ matrix.language }}.tar.gz -C sdk/${{ matrix.language }} .
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.language }}-sdk.tar.gz
path: ${{ github.workspace}}/sdk/${{ matrix.language }}.tar.gz
overwrite: true
prerequisites:
name: prerequisites
runs-on: ubuntu-latest
strategy:
matrix:
goversion: [1.21.x]
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
lfs: true
- name: Checkout Scripts Repo
uses: actions/checkout@v4
with:
path: ci-scripts
repository: pulumi/scripts
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.goversion }}
cache-dependency-path: examples/go.sum
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.11.0
with:
repo: pulumi/pulumictl
- name: Install Pulumi CLI
uses: pulumi/actions@v5
- name: Build codegen binaries
run: make gen
- name: Build provider binary
run: make provider
- name: Check worktree clean
run: ./ci-scripts/ci/check-worktree-is-clean
- run: git status --porcelain
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: pulumi-${{ env.PROVIDER }}
path: ${{ github.workspace }}/bin
overwrite: true
- name: Test Provider Library
run: make test_provider
test:
name: ${{ matrix.language }} Tests
needs: build_sdks
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
language: [nodejs, java, yaml, go, dotnet, python]
dotnetversion: [3.1.301]
goversion: [1.21.x]
nodeversion: [20.x]
pythonversion: [3.11]
javaversion: [11]
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Checkout Scripts Repo
uses: actions/checkout@v4
with:
path: ci-scripts
repository: pulumi/scripts
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.goversion }}
cache-dependency-path: examples/go.sum
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.11.0
with:
repo: pulumi/pulumictl
- name: Install Pulumi CLI
uses: pulumi/actions@v5
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{matrix.nodeversion}}
registry-url: https://registry.npmjs.org
- name: Setup DotNet
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{matrix.dotnetversion}}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{matrix.pythonversion}}
- name: Download binaries
uses: actions/download-artifact@v4
with:
name: pulumi-${{ env.PROVIDER }}
path: ${{ github.workspace }}/bin
- name: Restore binary perms
run: find ${{ github.workspace }} -name "pulumi-*-${{ env.PROVIDER }}" -print
-exec chmod +x {} \;
- name: Download SDK
if: ${{ matrix.language != 'yaml' }}
uses: actions/download-artifact@v4
with:
name: ${{ matrix.language }}-sdk.tar.gz
path: ${{ github.workspace}}/sdk
- name: Uncompress SDK folder
if: ${{ matrix.language != 'yaml' }}
run: tar -zxf ${{ github.workspace}}/sdk/${{ matrix.language}}.tar.gz -C ${{ github.workspace}}/sdk/${{ matrix.language}}
- name: Update path
run: echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
- name: Install Node deps
run: yarn global add typescript
- run: dotnet nuget add source ${{ github.workspace }}/nuget
- name: Install Python deps
run: |-
pip3 install virtualenv==20.0.23
pip3 install pipenv
- name: Install dependencies
if: ${{ matrix.language != 'yaml' }}
run: make install_${{ matrix.language}}_sdk
- name: Set up gotestfmt
uses: GoTestTools/gotestfmt-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run tests
run: |
set -euo pipefail
cd examples && go test -json -v -count=1 -cover -timeout 2h -tags=${{ matrix.language
}} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt