Skip to content

Commit 8be658f

Browse files
authored
Adding command dispatch functionality for community PRs (#47)
1 parent 077c589 commit 8be658f

File tree

3 files changed

+287
-228
lines changed

3 files changed

+287
-228
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Command Dispatch for testing
2+
on:
3+
issue_comment:
4+
types: [created, edited]
5+
6+
jobs:
7+
command-dispatch-for-testing:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- name: Run Build
12+
uses: peter-evans/slash-command-dispatch@v2
13+
with:
14+
token: ${{ secrets.EVENT_PAT }}
15+
reaction-token: ${{ secrets.GITHUB_TOKEN }}
16+
commands: run-acceptance-tests
17+
permission: write
18+
issue-type: pull-request
19+
repository: pulumi/pulumi-command

.github/workflows/pull_request.yml

Lines changed: 14 additions & 228 deletions
Original file line numberDiff line numberDiff line change
@@ -1,235 +1,21 @@
11
name: pull-request
22
"on":
3-
pull_request:
4-
branches:
5-
- master
6-
paths-ignore:
7-
- CHANGELOG.md
3+
pull_request_target:
4+
85
env:
96
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10-
PROVIDER: command
11-
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
12-
PULUMI_API: https://api.pulumi-staging.io
13-
PULUMI_GO_DEP_ROOT: ${{ github.workspace }}/..
14-
PULUMI_LOCAL_NUGET: ${{ github.workspace }}/nuget
15-
TRAVIS_OS_NAME: linux
16-
jobs:
17-
prerequisites:
18-
name: prerequisites
19-
runs-on: ubuntu-latest
20-
strategy:
21-
matrix:
22-
goversion: [1.16.x]
23-
steps:
24-
- name: Checkout Repo
25-
uses: actions/checkout@v2
26-
with:
27-
lfs: true
28-
- name: Checkout Scripts Repo
29-
uses: actions/checkout@v2
30-
with:
31-
path: ci-scripts
32-
repository: pulumi/scripts
33-
- name: Unshallow clone for tags
34-
run: git fetch --prune --unshallow --tags
35-
- name: Install Go
36-
uses: actions/setup-go@v2
37-
with:
38-
go-version: ${{ matrix.goversion }}
39-
- name: Install pulumictl
40-
uses: jaxxstorm/[email protected]
41-
with:
42-
repo: pulumi/pulumictl
43-
- name: Install Schema Tools
44-
uses: jaxxstorm/[email protected]
45-
with:
46-
repo: mikhailshilkov/schema-tools
47-
- name: Install Pulumi CLI
48-
uses: pulumi/setup-pulumi@v2
49-
# - name: Initialize submodules
50-
# run: make init_submodules
51-
- name: Build codegen binaries
52-
run: make gen
53-
# - name: Build Schema
54-
# run: make generate_schema
55-
# - name: Check Schema is Valid
56-
# run: |
57-
# echo 'SCHEMA_CHANGES<<EOF' >> $GITHUB_ENV
58-
# schema-tools compare ${{ env.PROVIDER }} master --local-path=provider/cmd/pulumi-resource-${{ env.PROVIDER }}/schema.json >> $GITHUB_ENV
59-
# echo 'EOF' >> $GITHUB_ENV
60-
# - name: Comment on PR with Details of Schema Check
61-
# uses: thollander/[email protected]
62-
# with:
63-
# message: |
64-
# ### Does the PR have any schema changes?
657

66-
# ${{ env.SCHEMA_CHANGES }}
67-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68-
- name: Build provider binary
69-
run: make provider
70-
- name: Check worktree clean
71-
run: ./ci-scripts/ci/check-worktree-is-clean
72-
- name: Upload artifacts
73-
uses: actions/upload-artifact@v2
74-
with:
75-
name: pulumi-${{ env.PROVIDER }}
76-
path: ${{ github.workspace }}/bin
77-
- name: Test Provider Library
78-
run: make test_provider
79-
build_sdks:
80-
name: build_sdks
81-
runs-on: ubuntu-latest
82-
needs: prerequisites
83-
strategy:
84-
fail-fast: true
85-
matrix:
86-
dotnetversion: [3.1.301]
87-
goversion: [1.16.x]
88-
language: [nodejs, python, dotnet, go]
89-
nodeversion: [14.x]
90-
pythonversion: [3.7]
91-
steps:
92-
- name: Checkout Repo
93-
uses: actions/checkout@v2
94-
- name: Checkout Scripts Repo
95-
uses: actions/checkout@v2
96-
with:
97-
path: ci-scripts
98-
repository: pulumi/scripts
99-
- name: Unshallow clone for tags
100-
run: git fetch --prune --unshallow --tags
101-
- name: Install Go
102-
uses: actions/setup-go@v2
103-
with:
104-
go-version: ${{ matrix.goversion }}
105-
- name: Setup Node
106-
uses: actions/setup-node@v1
107-
with:
108-
node-version: ${{matrix.nodeversion}}
109-
registry-url: https://registry.npmjs.org
110-
- name: Setup DotNet
111-
uses: actions/setup-dotnet@v1
112-
with:
113-
dotnet-version: ${{matrix.dotnetversion}}
114-
- name: Setup Python
115-
uses: actions/setup-python@v1
116-
with:
117-
python-version: ${{matrix.pythonversion}}
118-
- name: Install pulumictl
119-
uses: jaxxstorm/[email protected]
120-
with:
121-
repo: pulumi/pulumictl
122-
- name: Install Pulumi CLI
123-
uses: pulumi/setup-pulumi@v2
124-
- name: Download provider + tfgen binaries
125-
uses: actions/download-artifact@v2
126-
with:
127-
name: pulumi-${{ env.PROVIDER }}
128-
path: ${{ github.workspace }}/bin
129-
- name: Restore binary perms
130-
run: find ${{ github.workspace }} -name "pulumi-*-${{ env.PROVIDER }}" -print
131-
-exec chmod +x {} \;
132-
- name: Generate SDK
133-
run: make ${{ matrix.language }}_sdk
134-
# - name: Build SDK
135-
# run: make build_${{ matrix.language }}
136-
- name: Check worktree clean
137-
run: ./ci-scripts/ci/check-worktree-is-clean
138-
- name: Compress SDK folder
139-
run: tar -zcf sdk/${{ matrix.language }}.tar.gz -C sdk/${{ matrix.language }} .
140-
- name: Upload artifacts
141-
uses: actions/upload-artifact@v2
142-
with:
143-
name: ${{ matrix.language }}-sdk.tar.gz
144-
path: ${{ github.workspace}}/sdk/${{ matrix.language }}.tar.gz
145-
test:
146-
name: ${{ matrix.language }} Tests
147-
needs: build_sdks
8+
jobs:
9+
comment-on-pr:
10+
# We only care about commenting on a PR if the PR is from a fork
11+
if: github.event.pull_request.head.repo.full_name != github.repository
14812
runs-on: ubuntu-latest
149-
strategy:
150-
fail-fast: true
151-
matrix:
152-
dotnetversion: [3.1.301]
153-
goversion: [1.16.x]
154-
language: [nodejs, python, dotnet, go]
155-
nodeversion: [14.x]
156-
pythonversion: [3.7]
15713
steps:
158-
- name: Checkout Repo
159-
uses: actions/checkout@v2
160-
with:
161-
ref: ${{ env.PR_COMMIT_SHA }}
162-
- name: Checkout Scripts Repo
163-
uses: actions/checkout@v2
164-
with:
165-
path: ci-scripts
166-
repository: pulumi/scripts
167-
- name: Unshallow clone for tags
168-
run: git fetch --prune --unshallow --tags
169-
- name: Install Go
170-
uses: actions/setup-go@v2
171-
with:
172-
go-version: ${{ matrix.goversion }}
173-
- name: Install pulumictl
174-
uses: jaxxstorm/[email protected]
175-
with:
176-
repo: pulumi/pulumictl
177-
- name: Install Pulumi CLI
178-
uses: pulumi/setup-pulumi@v2
179-
- name: Setup Node
180-
uses: actions/setup-node@v1
181-
with:
182-
node-version: ${{matrix.nodeversion}}
183-
registry-url: https://registry.npmjs.org
184-
- name: Setup DotNet
185-
uses: actions/setup-dotnet@v1
186-
with:
187-
dotnet-version: ${{matrix.dotnetversion}}
188-
- name: Setup Python
189-
uses: actions/setup-python@v1
190-
with:
191-
python-version: ${{matrix.pythonversion}}
192-
- name: Download binaries
193-
uses: actions/download-artifact@v2
194-
with:
195-
name: pulumi-${{ env.PROVIDER }}
196-
path: ${{ github.workspace }}/bin
197-
- name: Restore binary perms
198-
run: find ${{ github.workspace }} -name "pulumi-*-${{ env.PROVIDER }}" -print
199-
-exec chmod +x {} \;
200-
- name: Download SDK
201-
uses: actions/download-artifact@v2
202-
with:
203-
name: ${{ matrix.language }}-sdk.tar.gz
204-
path: ${{ github.workspace}}/sdk
205-
- name: Uncompress SDK folder
206-
run: tar -zxf ${{ github.workspace}}/sdk/${{ matrix.language}}.tar.gz -C ${{ github.workspace}}/sdk/${{ matrix.language}}
207-
- name: Update path
208-
run: echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
209-
- name: Install Node deps
210-
run: yarn global add typescript
211-
- run: dotnet nuget add source ${{ github.workspace }}/nuget
212-
- name: Install Python deps
213-
run: |-
214-
pip3 install virtualenv==20.0.23
215-
pip3 install pipenv
216-
- name: Install dependencies
217-
run: make install_${{ matrix.language}}_sdk
218-
- name: Configure AWS Credentials
219-
uses: aws-actions/configure-aws-credentials@v1
220-
with:
221-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
222-
aws-region: us-west-2
223-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
224-
role-duration-seconds: 3600
225-
role-session-name: ${{ env.PROVIDER }}@githubActions
226-
role-to-assume: ${{ secrets.AWS_CI_ROLE_ARN }}
227-
- name: Set up gotestfmt
228-
uses: haveyoudebuggedit/gotestfmt-action@v2
229-
with:
230-
token: ${{ secrets.GITHUB_TOKEN }}
231-
- name: Run tests
232-
run: |
233-
set -euo pipefail
234-
cd examples && go test -json -v -count=1 -cover -timeout 2h -tags=${{ matrix.language
235-
}} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt
14+
- uses: actions/checkout@v2
15+
- name: Comment PR
16+
uses: thollander/actions-comment-pull-request@main
17+
with:
18+
message: |
19+
PR is now waiting for a maintainer to run the acceptance tests. This PR will only perform build and linting.
20+
**Note for the maintainer:** To run the acceptance tests, please comment */run-acceptance-tests* on the PR
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)