mirror of https://github.com/pulumi/pulumi.git
402 lines
14 KiB
YAML
402 lines
14 KiB
YAML
on:
|
|
repository_dispatch:
|
|
types: [ run-acceptance-tests-command ]
|
|
pull_request:
|
|
paths-ignore:
|
|
- 'CHANGELOG.md'
|
|
- 'CHANGELOG_PENDING.md'
|
|
|
|
env:
|
|
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_PROD_ACCESS_TOKEN }}
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
PULUMI_TEST_OWNER: "moolumi"
|
|
PR_COMMIT_SHA: ${{ github.event.client_payload.pull_request.head.sha }}
|
|
|
|
# Cancel checks on prior commits when new commits are added to a PR.
|
|
# This is motivated by temporary throughput issues on our GitHub
|
|
# Actions workers availability.
|
|
#
|
|
# Note from GitHub docs: Concurrency is currently in beta and subject
|
|
# to change.
|
|
#
|
|
# See also: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency
|
|
#
|
|
# Note on the the `group` computed expression: it is compiling
|
|
# `github.head_ref == '' ? github.run_id : github.head_ref` expression
|
|
# to the primitives available in GitHub Actions. The idea to use
|
|
# `head_ref` on `pull_request` triggers, but use unique
|
|
# `github.run_id` on `run-acceptance-tests-command` triggers. This
|
|
# effectively disables `concurrency` checks for
|
|
# `run-acceptance-tests-command` triggers.
|
|
concurrency:
|
|
group: run-build-acceptance-tests-${{(fromJSON(format('[{0},{1}]',toJSON(github.head_ref),toJSON(github.run_id))))[github.head_ref=='']}}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
|
|
comment-notification:
|
|
# We only care about adding the result to the PR if it's a repository_dispatch event
|
|
if: github.event_name == 'repository_dispatch'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Create URL to the run output
|
|
id: vars
|
|
run: echo ::set-output name=run-url::https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID
|
|
- name: Update with Result
|
|
uses: peter-evans/create-or-update-comment@v1
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
|
|
issue-number: ${{ github.event.client_payload.github.payload.issue.number }}
|
|
body: |
|
|
Please view the results of the PR Build + Acceptance Tests Run [Here][1]
|
|
|
|
[1]: ${{ steps.vars.outputs.run-url }}
|
|
|
|
go-lint:
|
|
container: golangci/golangci-lint:latest
|
|
name: Lint ${{ matrix.directory }}
|
|
strategy:
|
|
matrix:
|
|
directory: [ sdk, pkg, tests ]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Repo
|
|
uses: actions/checkout@v2
|
|
with:
|
|
ref: ${{ env.PR_COMMIT_SHA }}
|
|
- name: Lint ${{ matrix.directory }}
|
|
run: |
|
|
cd ${{ matrix.directory }} && golangci-lint run -c ../.golangci.yml
|
|
|
|
sdk-lint:
|
|
name: Lint SDKs
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Set up Go ${{ matrix.go-version }}
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v1
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- name: Set up DotNet ${{ matrix.dotnet-version }}
|
|
uses: actions/setup-dotnet@v1
|
|
with:
|
|
dotnet-version: ${{ matrix.dotnet-version }}
|
|
- run: mkdir -p ${{ runner.temp }}/opt/pulumi/nuget
|
|
- run: dotnet nuget add source ${{ runner.temp }}/opt/pulumi/nuget
|
|
- name: Set up Node ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
- name: Install Python deps
|
|
run: |
|
|
python -m pip install --upgrade pip requests wheel urllib3 chardet
|
|
- name: Setup git
|
|
run: |
|
|
git config --global user.email "you@example.com"
|
|
git config --global user.name "Your Name"
|
|
- name: Update path
|
|
run: |
|
|
echo "${{ runner.temp }}/opt/pulumi/bin" >> $GITHUB_PATH
|
|
- name: Checkout Repo
|
|
uses: actions/checkout@v2
|
|
with:
|
|
ref: ${{ env.PR_COMMIT_SHA }}
|
|
- name: Fetch Tags
|
|
run: |
|
|
git fetch --quiet --prune --unshallow --tags
|
|
- name: Set Go Dep path
|
|
run: |
|
|
echo "PULUMI_GO_DEP_ROOT=$(dirname $(pwd))" >> $GITHUB_ENV
|
|
- name: Install pulumictl
|
|
uses: jaxxstorm/action-install-gh-release@v1.3.1
|
|
with:
|
|
repo: pulumi/pulumictl
|
|
- name: Ensure
|
|
run: |
|
|
make ensure
|
|
- name: Lint Node
|
|
run: |
|
|
cd sdk/nodejs && make lint
|
|
- name: Lint Python
|
|
run: |
|
|
cd sdk/python && make lint
|
|
- name: Lint .NET
|
|
run: |
|
|
cd sdk/dotnet && make lint
|
|
|
|
build:
|
|
name: Build
|
|
uses: pulumi/pulumi/.github/workflows/build.yml@master
|
|
with:
|
|
enable-coverage: true
|
|
|
|
test:
|
|
name: Test
|
|
needs: build
|
|
strategy:
|
|
matrix:
|
|
platform: [ ubuntu-latest, macos-latest ]
|
|
go-version: [ 1.17.x ]
|
|
python-version: [ 3.9.x ]
|
|
dotnet-version: [ 3.1.x ]
|
|
node-version: [ 14.x ]
|
|
|
|
# See scripts/tests_subsets.py when editing
|
|
test-subset: [ integration, integration-and-codegen, auto, etc ]
|
|
|
|
exclude:
|
|
- platform: macos-latest
|
|
|
|
# Only run catch-all `etc` test-subset on Mac for PR
|
|
# verification because of a throughput bottleneck on Mac
|
|
# runners. Note that `master.yml` specifies all test subsets
|
|
# to still run on `master` branch verifications.
|
|
include:
|
|
- platform: macos-latest
|
|
test-subset: etc
|
|
go-version: 1.17.x
|
|
python-version: 3.9.x
|
|
dotnet-version: 3.1.x
|
|
node-version: 14.x
|
|
|
|
fail-fast: false
|
|
if: github.event_name == 'repository_dispatch' || github.event.pull_request.head.repo.full_name == github.repository
|
|
runs-on: ${{ matrix.platform }}
|
|
steps:
|
|
- name: Set PULUMI_TEST_SUBSET env var
|
|
run: |
|
|
echo "PULUMI_TEST_SUBSET=${{ matrix.test-subset }}" >> $GITHUB_ENV
|
|
- name: Enable code coverage
|
|
run: |
|
|
echo "PULUMI_TEST_COVERAGE_PATH=$(pwd)/coverage" >> $GITHUB_ENV
|
|
- name: Set up Go ${{ matrix.go-version }}
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v1
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- name: Set up DotNet ${{ matrix.dotnet-version }}
|
|
uses: actions/setup-dotnet@v1
|
|
with:
|
|
dotnet-version: ${{ matrix.dotnet-version }}
|
|
- run: mkdir -p ${{ runner.temp }}/opt/pulumi/nuget
|
|
- run: dotnet nuget add source ${{ runner.temp }}/opt/pulumi/nuget
|
|
- name: Set up Node ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v2
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
- name: Install yarn
|
|
run: |
|
|
npm install -g yarn
|
|
- name: Install Python deps
|
|
run: |
|
|
python -m pip install --upgrade pip requests wheel urllib3 chardet
|
|
- name: Setup git
|
|
run: |
|
|
git config --global user.email "you@example.com"
|
|
git config --global user.name "Your Name"
|
|
- name: Update path
|
|
run: |
|
|
echo "${{ runner.temp }}/opt/pulumi/bin" >> $GITHUB_PATH
|
|
- name: Checkout Repo
|
|
uses: actions/checkout@v2
|
|
with:
|
|
ref: ${{ env.PR_COMMIT_SHA }}
|
|
- name: Fetch Tags
|
|
run: |
|
|
git fetch --quiet --prune --unshallow --tags
|
|
- name: Set Go Dep path
|
|
run: |
|
|
echo "PULUMI_GO_DEP_ROOT=$(dirname $(pwd))" >> $GITHUB_ENV
|
|
- name: Install pulumictl
|
|
uses: jaxxstorm/action-install-gh-release@v1.3.1
|
|
with:
|
|
repo: pulumi/pulumictl
|
|
- name: Install gotestsum
|
|
uses: jaxxstorm/action-install-gh-release@v1.3.1
|
|
with:
|
|
repo: gotestyourself/gotestsum
|
|
- name: Install goteststats
|
|
uses: jaxxstorm/action-install-gh-release@v1.3.1
|
|
with:
|
|
repo: t0yv0/goteststats
|
|
tag: v0.0.7
|
|
- name: Download Pulumi Go Binaries (linux-x64)
|
|
if: ${{ matrix.platform == 'ubuntu-latest' }}
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: pulumi-linux-x64
|
|
path: artifacts/go
|
|
- name: Download Pulumi Go Binaries (darwin-x64)
|
|
if: ${{ matrix.platform == 'macos-latest' }}
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: pulumi-darwin-x64
|
|
path: artifacts/go
|
|
- name: Install Pulumi Go Binaries
|
|
run: |
|
|
mkdir -p bin
|
|
tar -xf artifacts/go/*.tar.gz -C bin
|
|
echo "$PWD/bin/pulumi" >> $GITHUB_PATH
|
|
- name: Download Pulumi .NET NuGet packages
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: pulumi-nuget-packages
|
|
# path set to match PULUMI_LOCAL_NUGET
|
|
path: ${{ runner.temp }}/opt/pulumi/nuget
|
|
- name: Verify Pulumi Version
|
|
run: |
|
|
which pulumi
|
|
pulumi version
|
|
find ./bin
|
|
- name: Inspect downloaded artifacts
|
|
run: |
|
|
find artifacts
|
|
echo "PULUMI_LOCAL_NUGET=$PULUMI_LOCAL_NUGET"
|
|
ls $PULUMI_LOCAL_NUGET
|
|
env:
|
|
PULUMI_LOCAL_NUGET: ${{ runner.temp }}/opt/pulumi/nuget
|
|
- name: Ensure dependencies for the Node SDK
|
|
run: |
|
|
cd sdk/nodejs
|
|
make ensure
|
|
- name: Build the Node SDK
|
|
run: |
|
|
cd sdk/nodejs
|
|
make build_package
|
|
cd bin
|
|
yarn link
|
|
- name: Ensure dependencies for the Python SDK
|
|
run: |
|
|
cd sdk/python
|
|
make ensure
|
|
- name: Install Python SDK
|
|
run: |
|
|
cd sdk/python
|
|
make build_package
|
|
- name: Ensure coverage gathering dependencies
|
|
run: |
|
|
make ensure_cover
|
|
- name: Test
|
|
run: make TEST_ALL_DEPS= test_all
|
|
env:
|
|
PULUMI_NODE_MODULES: ${{ runner.temp }}/opt/pulumi/node_modules
|
|
PULUMI_LOCAL_NUGET: ${{ runner.temp }}/opt/pulumi/nuget
|
|
PULUMI_ROOT: ${{ runner.temp }}/opt/pulumi
|
|
- name: Merge Go coverage data
|
|
run: |
|
|
pulumictl cover merge --in ./coverage --out ./coverage/go-all.txt
|
|
rm ./coverage/*.cov
|
|
- name: Upload code coverage
|
|
uses: codecov/codecov-action@v2
|
|
with:
|
|
directory: coverage
|
|
files: '*'
|
|
fail_ci_if_error: false
|
|
verbose: true
|
|
- name: Summarize Test Time by Package
|
|
run: |
|
|
mkdir -p test-results
|
|
touch test-results/empty.json # otherwise goteststats fails below when no files match
|
|
goteststats -statistic pkg-time test-results/*.json
|
|
- name: Summarize Test Times by Indivudal Test
|
|
run: |
|
|
goteststats -statistic test-time test-results/*.json | head -n 100
|
|
|
|
windows-build:
|
|
name: Windows Build + Test
|
|
strategy:
|
|
matrix:
|
|
go-version: [1.17.x]
|
|
node-version: [14.x]
|
|
python-version: [3.9.x]
|
|
dotnet: [3.1.x]
|
|
if: github.event_name == 'repository_dispatch' || github.event.pull_request.head.repo.full_name == github.repository
|
|
runs-on: windows-latest
|
|
env:
|
|
GOPATH: ${{ github.workspace }}
|
|
PULUMI_LOCAL_NUGET: "D:\\Pulumi\\nuget"
|
|
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
|
|
steps:
|
|
- name: Install DotNet ${{ matrix.dotnet }}
|
|
uses: actions/setup-dotnet@v1
|
|
with:
|
|
dotnet-version: ${{ matrix.dotnet }}
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
- name: Set up Go ${{ matrix.go-version }}
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- name: Install Python Deps
|
|
run: |
|
|
pip3 install pyenv-win
|
|
- name: Create Local Nuget
|
|
run: mkdir -p "${{ env.PULUMI_LOCAL_NUGET }}"
|
|
shell: bash
|
|
- run: dotnet nuget add source ${{ env.PULUMI_LOCAL_NUGET }}
|
|
- name: Set Build Env Vars
|
|
shell: bash
|
|
run: |
|
|
echo "D:\\Pulumi\\bin" >> $GITHUB_PATH
|
|
- name: Install AWS CLI Tools
|
|
uses: chrislennon/action-aws-cli@v1.1
|
|
- name: Install pulumictl
|
|
uses: jaxxstorm/action-install-gh-release@v1.3.1
|
|
with:
|
|
repo: pulumi/pulumictl
|
|
- name: Check out code into the Go module directory
|
|
uses: actions/checkout@v2
|
|
with:
|
|
path: ./src/github.com/${{ github.repository }}
|
|
ref: ${{ env.PR_COMMIT_SHA }}
|
|
- name: Fetch Tags
|
|
run: |
|
|
cd ./src/github.com/${{ github.repository }} && git fetch --quiet --prune --unshallow --tags
|
|
- name: Clean
|
|
run: dotnet nuget locals all --clear
|
|
- name: Create Local Nuget
|
|
run: mkdir -p "D:\\Pulumi\\nuget"
|
|
shell: bash
|
|
- name: Get dependencies
|
|
run: |
|
|
cd src\github.com\${{ github.repository }}
|
|
pushd .
|
|
cd sdk
|
|
go mod download
|
|
popd
|
|
pushd .
|
|
cd pkg
|
|
go mod download
|
|
popd
|
|
pushd .
|
|
cd tests
|
|
go mod download
|
|
popd
|
|
- name: Build Pulumi
|
|
run: |
|
|
cd src\github.com\${{ github.repository }}
|
|
dotnet msbuild /t:Build /v:Detailed build.proj /p:PulumiRoot="D:\\Pulumi" /p:PythonVersion="${{ matrix.python-version }}"
|
|
- run: |
|
|
which pulumi
|
|
pulumi version
|
|
shell: bash
|
|
- name: Run Pulumi Tests
|
|
env:
|
|
PYTHON_VERSION: ${{ matrix.python-version }}
|
|
run: |
|
|
cd src\github.com\${{ github.repository }}
|
|
dotnet msbuild /t:Tests /v:Detailed build.proj /p:PulumiRoot="D:\\Pulumi" /p:PythonVersion="${{ matrix.python-version }}"
|