From fe46c3afda5244bd7aa54922e613afb146b5b32b Mon Sep 17 00:00:00 2001 From: Pulumi Bot Date: Mon, 2 Oct 2023 06:03:18 +0000 Subject: [PATCH] [internal] Update GitHub Actions workflow files --- .github/workflows/command-dispatch.yml | 4 +- .github/workflows/lint.yml | 67 ++++++++++++++++++++++ .github/workflows/master.yml | 48 +++++++--------- .github/workflows/prerelease.yml | 30 +--------- .github/workflows/release.yml | 50 +++++++--------- .github/workflows/release_command.yml | 43 ++++++++++++++ .github/workflows/run-acceptance-tests.yml | 33 +---------- .gitignore | 3 + 8 files changed, 162 insertions(+), 116 deletions(-) create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/release_command.yml diff --git a/.github/workflows/command-dispatch.yml b/.github/workflows/command-dispatch.yml index 15c8a365..0082dd88 100644 --- a/.github/workflows/command-dispatch.yml +++ b/.github/workflows/command-dispatch.yml @@ -35,7 +35,9 @@ jobs: uses: actions/checkout@v3 - uses: peter-evans/slash-command-dispatch@v2 with: - commands: run-acceptance-tests + commands: | + run-acceptance-tests + release issue-type: pull-request permission: write reaction-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..ad5525c4 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,67 @@ +# WARNING: This file is autogenerated - changes will be overwritten if not made via https://github.com/pulumi/ci-mgmt + +name: lint + +on: + workflow_call: + inputs: {} + +env: + DOTNETVERSION: | + 6.0.x + 3.1.301 + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GOVERSION: 1.21.x + JAVAVERSION: "11" + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + NODEVERSION: 16.x + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + NUGET_PUBLISH_KEY: ${{ secrets.NUGET_PUBLISH_KEY }} + PUBLISH_REPO_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + PUBLISH_REPO_USERNAME: ${{ secrets.OSSRH_USERNAME }} + 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 }} + PYTHONVERSION: "3.9" + SIGNING_KEY: ${{ secrets.JAVA_SIGNING_KEY }} + SIGNING_KEY_ID: ${{ secrets.JAVA_SIGNING_KEY_ID }} + SIGNING_PASSWORD: ${{ secrets.JAVA_SIGNING_PASSWORD }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + TF_APPEND_USER_AGENT: pulumi + TRAVIS_OS_NAME: linux + +jobs: + lint: + name: lint + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v3 + - name: Install go + uses: actions/setup-go@v4 + with: + # The versions of golangci-lint and setup-go here cross-depend and need to update together. + go-version: 1.21 + # Either this action or golangci-lint needs to disable the cache + cache: false + - name: disarm go:embed directives to enable lint + continue-on-error: true # this fails if there are no go:embed directives + run: | + git grep -l 'go:embed' -- provider | xargs sed -i 's/go:embed/ goembed/g' + - name: prepare upstream + continue-on-error: true + run: make upstream + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: v1.54.1 + working-directory: provider + - if: failure() && github.event_name == 'push' + name: Notify Slack + uses: 8398a7/action-slack@v3 + with: + author_name: Failure in linting provider + fields: repo,commit,author,action + status: ${{ job.status }} diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index b37e661a..bea688ae 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -177,34 +177,8 @@ jobs: aws s3 cp "${{ env.COVERAGE_OUTPUT_DIR }}/summary.json" "${s3FullURI}" --acl bucket-owner-full-control lint: name: lint - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v3 - - name: Install Go - uses: actions/setup-go@v4 - with: - cache-dependency-path: | - sdk/go.sum - go-version: 1.21.x - - name: disarm go:embed directives to enable lint - run: | - git grep -l 'go:embed' -- provider | xargs sed -i 's/go:embed/ goembed/g' - - name: prepare upstream - continue-on-error: true - run: make upstream - - name: golangci-lint - uses: golangci/golangci-lint-action@v3 - with: - version: v1.54.1 - working-directory: provider - - if: failure() && github.event_name == 'push' - name: Notify Slack - uses: 8398a7/action-slack@v3 - with: - author_name: Failure in linting provider - fields: repo,commit,author,action - status: ${{ job.status }} + uses: ./.github/workflows/lint.yml + secrets: inherit prerequisites: name: prerequisites runs-on: ubuntu-latest @@ -342,6 +316,24 @@ jobs: if: failure() name: Send Publish Failure To Slack uses: rtCamp/action-slack-notify@v2 + + tag_release_if_labeled_needs_release: + name: Tag release if labeled as needs-release + needs: publish_sdk + runs-on: ubuntu-latest + steps: + - name: check if this commit needs release + uses: pulumi/action-release-by-pr-label@main + with: + command: "release-if-needed" + repo: ${{ github.repository }} + commit: ${{ github.sha }} + slack_channel: ${{ secrets.RELEASE_OPS_SLACK_CHANNEL }} + env: + RELEASE_BOT_ENDPOINT: ${{ secrets.RELEASE_BOT_ENDPOINT }} + RELEASE_BOT_KEY: ${{ secrets.RELEASE_BOT_KEY }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + test: name: test needs: build_sdk diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index bb01b509..86577340 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -124,34 +124,8 @@ jobs: - java lint: name: lint - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v3 - - name: Install Go - uses: actions/setup-go@v4 - with: - cache-dependency-path: | - sdk/go.sum - go-version: 1.21.x - - name: disarm go:embed directives to enable lint - run: | - git grep -l 'go:embed' -- provider | xargs sed -i 's/go:embed/ goembed/g' - - name: prepare upstream - continue-on-error: true - run: make upstream - - name: golangci-lint - uses: golangci/golangci-lint-action@v3 - with: - version: v1.54.1 - working-directory: provider - - if: failure() && github.event_name == 'push' - name: Notify Slack - uses: 8398a7/action-slack@v3 - with: - author_name: Failure in linting provider - fields: repo,commit,author,action - status: ${{ job.status }} + uses: ./.github/workflows/lint.yml + secrets: inherit prerequisites: name: prerequisites runs-on: ubuntu-latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8f3755dc..bee967e7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -137,34 +137,8 @@ jobs: "${GITHUB_REF#refs/tags/}" lint: name: lint - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v3 - - name: Install Go - uses: actions/setup-go@v4 - with: - cache-dependency-path: | - sdk/go.sum - go-version: 1.21.x - - name: disarm go:embed directives to enable lint - run: | - git grep -l 'go:embed' -- provider | xargs sed -i 's/go:embed/ goembed/g' - - name: prepare upstream - continue-on-error: true - run: make upstream - - name: golangci-lint - uses: golangci/golangci-lint-action@v3 - with: - version: v1.54.1 - working-directory: provider - - if: failure() && github.event_name == 'push' - name: Notify Slack - uses: 8398a7/action-slack@v3 - with: - author_name: Failure in linting provider - fields: repo,commit,author,action - status: ${{ job.status }} + uses: ./.github/workflows/lint.yml + secrets: inherit prerequisites: name: prerequisites runs-on: ubuntu-latest @@ -314,6 +288,26 @@ jobs: - name: Add SDK version tag run: git tag "sdk/v$(pulumictl get version --language generic)" && git push origin "sdk/v$(pulumictl get version --language generic)" + + clean_up_release_labels: + name: Clean up release labels + needs: create_docs_build + + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v3 + - name: Unshallow clone for PR merge bases + run: git fetch --prune --unshallow --tags + - name: Clean up release labels + uses: pulumi/action-release-by-pr-label@main + with: + command: "clean-up-release-labels" + repo: ${{ github.repository }} + commit: ${{ github.sha }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + test: name: test needs: build_sdk diff --git a/.github/workflows/release_command.yml b/.github/workflows/release_command.yml new file mode 100644 index 00000000..8b39c586 --- /dev/null +++ b/.github/workflows/release_command.yml @@ -0,0 +1,43 @@ +# WARNING: This file is autogenerated - changes will be overwritten if not made via https://github.com/pulumi/ci-mgmt + +name: release-command +on: + repository_dispatch: + types: + - release-command +jobs: + should_release: + name: Should release PR + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v3 + - name: Should release PR + uses: pulumi/action-release-by-pr-label@main + with: + command: "should-release" + repo: ${{ github.repository }} + pr: ${{ github.event.client_payload.pull_request.number }} + version: ${{ github.event.client_payload.slash_command.args.all }} + slack_channel: ${{ secrets.RELEASE_OPS_STAGING_SLACK_CHANNEL }} + env: + RELEASE_BOT_ENDPOINT: ${{ secrets.RELEASE_BOT_ENDPOINT }} + RELEASE_BOT_KEY: ${{ secrets.RELEASE_BOT_KEY }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - if: failure() + name: Notify failure + uses: peter-evans/create-or-update-comment@v2 + 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: | + "release command failed: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + - if: success() + name: Notify success + uses: peter-evans/create-or-update-comment@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + repository: ${{ github.event.client_payload.github.payload.repository.full_name }} + comment-id: ${{ github.event.client_payload.github.payload.comment.id }} + reaction-type: hooray diff --git a/.github/workflows/run-acceptance-tests.yml b/.github/workflows/run-acceptance-tests.yml index 59905659..a031c7b9 100644 --- a/.github/workflows/run-acceptance-tests.yml +++ b/.github/workflows/run-acceptance-tests.yml @@ -146,37 +146,8 @@ jobs: if: github.event_name == 'repository_dispatch' || github.event.pull_request.head.repo.full_name == github.repository name: lint - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v3 - with: - ref: ${{ env.PR_COMMIT_SHA }} - - name: disarm go:embed directives to enable lint - run: | - git grep -l 'go:embed' -- provider | xargs sed -i 's/go:embed/ goembed/g' - - name: prepare upstream - continue-on-error: true - run: make upstream - - name: Install go - uses: actions/setup-go@v4 - with: - # The versions of golangci-lint and setup-go here cross-depend and need to update together. - go-version: 1.21 - # Either this action or golangci-lint needs to disable the cache - cache: false - - name: golangci-lint - uses: golangci/golangci-lint-action@v3 - with: - version: v1.54.1 - working-directory: provider - - if: failure() && github.event_name == 'push' - name: Notify Slack - uses: 8398a7/action-slack@v3 - with: - author_name: Failure in linting provider - fields: repo,commit,author,action - status: ${{ job.status }} + uses: ./.github/workflows/lint.yml + secrets: inherit prerequisites: if: github.event_name == 'repository_dispatch' || github.event.pull_request.head.repo.full_name == github.repository diff --git a/.gitignore b/.gitignore index 69f434ba..b9701f34 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,6 @@ sdk/java/build sdk/java/gradle sdk/java/gradlew sdk/java/gradlew.bat + + +sdk/python/venv