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

Initial GHA configuration #13

Merged
merged 4 commits into from
Dec 14, 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
13 changes: 13 additions & 0 deletions .github/workflows/cleanup-artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
jobs:
remove-old-artifacts:
runs-on: ubuntu-latest
steps:
- name: Remove old artifacts
uses: c-hive/gha-remove-artifacts@v1
with:
age: 1 month
skip-tags: true
name: cleanup
"on":
schedule:
- cron: 0 1 * * *
357 changes: 357 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,357 @@
name: master
"on":
push:
branches:
- master
- "feature-**"
paths-ignore:
- CHANGELOG.md
tags-ignore:
- v*
- sdk/*
- '**'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NUGET_PUBLISH_KEY: ${{ secrets.NUGET_PUBLISH_KEY }}
PROVIDER: command
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
PULUMI_API: https://api.pulumi-staging.io
PULUMI_GO_DEP_ROOT: ${{ github.workspace }}/..
PULUMI_LOCAL_NUGET: ${{ github.workspace }}/nuget
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
TRAVIS_OS_NAME: linux
jobs:
build_sdks:
name: build_sdks
runs-on: ubuntu-latest
needs: prerequisites
strategy:
fail-fast: true
matrix:
dotnetversion: [ 3.1.301 ]
goversion: [ 1.16.x ]
language: [ nodejs, python, dotnet, go ]
nodeversion: [ 14.x ]
pythonversion: [ 3.7 ]
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Checkout Scripts Repo
uses: actions/checkout@v2
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@v2
with:
go-version: ${{ matrix.goversion }}
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: ${{matrix.nodeversion}}
registry-url: https://registry.npmjs.org
- name: Setup DotNet
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{matrix.dotnetversion}}
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: ${{matrix.pythonversion}}
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.1.0
with:
repo: pulumi/pulumictl
- name: Install Pulumi CLI
uses: pulumi/setup-pulumi@v2
- name: Download provider + tfgen binaries
uses: actions/download-artifact@v2
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@v2
with:
name: ${{ matrix.language }}-sdk.tar.gz
path: ${{ github.workspace}}/sdk/${{ matrix.language }}.tar.gz
- if: failure() && github.event_name == 'push'
name: Notify Slack
uses: 8398a7/action-slack@v3
with:
author_name: Failure in running ${{ matrix.language }} tests
fields: repo,commit,author,action
status: ${{ job.status }}
prerequisites:
name: prerequisites
runs-on: ubuntu-latest
strategy:
matrix:
goversion: [1.16.x]
steps:
- name: Checkout Repo
uses: actions/checkout@v2
with:
lfs: true
- name: Checkout Scripts Repo
uses: actions/checkout@v2
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@v2
with:
go-version: ${{ matrix.goversion }}
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.1.0
with:
repo: pulumi/pulumictl
- name: Install Pulumi CLI
uses: pulumi/setup-pulumi@v2
- 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@v2
with:
name: pulumi-${{ env.PROVIDER }}
path: ${{ github.workspace }}/bin
- name: Test Provider Library
run: make test_provider
- if: failure() && github.event_name == 'push'
name: Notify Slack
uses: 8398a7/action-slack@v3
with:
author_name: Failure in running ${{ matrix.language }} tests
fields: repo,commit,author,action
status: ${{ job.status }}
test:
name: ${{ matrix.language }} Tests
needs: build_sdks
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
dotnetversion: [3.1.301]
goversion: [1.16.x]
language: [nodejs, python, dotnet, go]
nodeversion: [14.x]
pythonversion: [3.7]
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Checkout Scripts Repo
uses: actions/checkout@v2
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@v2
with:
go-version: ${{ matrix.goversion }}
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.1.0
with:
repo: pulumi/pulumictl
- name: Install Pulumi CLI
uses: pulumi/setup-pulumi@v2
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: ${{matrix.nodeversion}}
registry-url: https://registry.npmjs.org
- name: Setup DotNet
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{matrix.dotnetversion}}
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: ${{matrix.pythonversion}}
- name: Download binaries
uses: actions/download-artifact@v2
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
uses: actions/download-artifact@v2
with:
name: ${{ matrix.language }}-sdk.tar.gz
path: ${{ github.workspace}}/sdk
- name: Uncompress SDK folder
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
run: make install_${{ matrix.language}}_sdk
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-region: us-west-2
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
role-duration-seconds: 3600
role-session-name: ${{ env.PROVIDER }}@githubActions
role-to-assume: ${{ secrets.AWS_CI_ROLE_ARN }}
- name: Set up gotestfmt
uses: haveyoudebuggedit/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
- if: failure() && github.event_name == 'push'
name: Notify Slack
uses: 8398a7/action-slack@v3
with:
author_name: Failure in running ${{ matrix.language }} tests
fields: repo,commit,author,action
status: ${{ job.status }}
publish:
name: publish
needs: test
runs-on: ubuntu-latest
strategy:
matrix:
goversion: [ 1.16.x ]
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
- name: Checkout Scripts Repo
uses: actions/checkout@v2
with:
path: ci-scripts
repository: pulumi/scripts
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-region: us-east-2
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
role-duration-seconds: 3600
role-external-id: upload-pulumi-release
role-session-name: ${{ env.PROVIDER}}@githubActions
role-to-assume: ${{ secrets.AWS_UPLOAD_ROLE_ARN }}
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.goversion }}
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.1.0
with:
repo: pulumi/pulumictl
- name: Install Pulumi CLI
uses: pulumi/setup-pulumi@v2
- name: Set PreRelease Version
run: echo "GORELEASER_CURRENT_TAG=v$(pulumictl get version --language generic)" >> $GITHUB_ENV
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
args: -p 1 -f .goreleaser.prerelease.yml --rm-dist --skip-validate --timeout 60m0s
version: latest
publish_sdk:
name: publish_sdk
needs: publish
runs-on: ubuntu-latest
strategy:
matrix:
goversion: [ 1.16.x ]
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Checkout Scripts Repo
uses: actions/checkout@v2
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@v2
with:
go-version: ${{ matrix.goversion }}
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.1.0
with:
repo: pulumi/pulumictl
- name: Install Pulumi CLI
uses: pulumi/setup-pulumi@v2
- name: Setup Node
uses: actions/setup-node@v1
with:
always-auth: true
registry-url: https://registry.npmjs.org
- name: Setup DotNet
uses: actions/setup-dotnet@v1
- name: Setup Python
uses: actions/setup-python@v1
- name: Download Python SDK
uses: actions/download-artifact@v2
with:
name: python-sdk.tar.gz
path: ${{ github.workspace}}/sdk
- name: Unzip Python SDK
run: tar -zxf ${{ github.workspace}}/sdk/python.tar.gz -C ${{ github.workspace}}/sdk/python
- name: Install Twine
run: python -m pip install pip twine
- name: Download NodeJS SDK
uses: actions/download-artifact@v2
with:
name: nodejs-sdk.tar.gz
path: ${{ github.workspace}}/sdk
- name: Unzip NodeJS SDK
run: tar -zxf ${{ github.workspace}}/sdk/nodejs.tar.gz -C ${{ github.workspace}}/sdk/nodejs
- name: Download DotNet SDK
uses: actions/download-artifact@v2
with:
name: dotnet-sdk.tar.gz
path: ${{ github.workspace}}/sdk
- name: Unzip DotNet SDK
run: tar -zxf ${{ github.workspace}}/sdk/dotnet.tar.gz -C ${{ github.workspace}}/sdk/dotnet
- env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
name: Publish SDKs
run: ./ci-scripts/ci/publish-tfgen-package ${{ github.workspace }}
- if: failure() && github.event_name == 'push'
name: Notify Slack
uses: 8398a7/action-slack@v3
with:
author_name: Failure in publishing SDK
fields: repo,commit,author,action
status: ${{ job.status }}
Loading