Skip to content

Commit 673c285

Browse files
authored
Merge pull request #882 from gitlabhq/split-ce-and-ee-acceptance-workflows
Split EE and CE acceptance workflows
2 parents 500f986 + 2eb0793 commit 673c285

File tree

2 files changed

+50
-25
lines changed

2 files changed

+50
-25
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# This workflow runs acceptance tests on pull requests (CE)
2+
3+
name: pr-acceptance-ce
4+
5+
on:
6+
pull_request:
7+
# Acceptance tests are unnecessary to run on some types of PRs.
8+
paths-ignore:
9+
- 'docs/**'
10+
- 'examples/**'
11+
- 'README.md'
12+
- 'CHANGELOG.md'
13+
- 'CONTRIBUTING.md'
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
go-version:
21+
runs-on: ubuntu-latest
22+
outputs:
23+
go-version: ${{ steps.go-version.outputs.go-version }}
24+
steps:
25+
- uses: actions/checkout@v2
26+
# Read the .go-version file and output it for other jobs to use.
27+
- id: go-version
28+
run: echo "::set-output name=go-version::$(cat .go-version)"
29+
30+
acceptance-ce:
31+
timeout-minutes: 60
32+
runs-on: ubuntu-latest
33+
needs: [go-version]
34+
steps:
35+
- uses: actions/setup-go@v2
36+
with:
37+
go-version: ${{ needs.go-version.outputs.go-version }}
38+
- uses: actions/checkout@v2
39+
# Cache the Go modules.
40+
- uses: actions/cache@v2
41+
with:
42+
path: ~/go/pkg/mod
43+
key: ${{ github.job }}-${{ runner.os }}-go${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum', 'GNUMakefile') }}
44+
- run: make testacc-up
45+
- run: make testacc

.github/workflows/pr-acceptance.yml renamed to .github/workflows/pr-acceptance-ee.yml

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
# This workflow runs acceptance tests on pull requests (both CE and EE). It needs to be run in the
1+
# This workflow runs acceptance tests on pull requests (EE). It needs to be run in the
22
# target project instead of the fork in order to use secrets. This is why the actions/checkout
33
# action regularly has to specify the pull request sha.
44
#
55
# SECURITY ADVISORY
66
# Be careful while making changes to this file.
77
# See: https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
88

9-
name: pr-acceptance
9+
name: pr-acceptance-ee
1010

1111
on:
1212
# The pull_request_target event type fires for pull requests, but in the context of the target
1313
# project.
1414
pull_request_target:
15+
types: [labeled]
1516
# Acceptance tests are unnecessary to run on some types of PRs.
1617
paths-ignore:
1718
- 'docs/**'
@@ -51,32 +52,10 @@ jobs:
5152
if: ${{ env.LICENSE_ENCRYPTION_PASSWORD != '' }}
5253
run: echo "::set-output name=defined::true"
5354

54-
acceptance-ce:
55-
timeout-minutes: 60
56-
runs-on: ubuntu-latest
57-
needs: [go-version]
58-
steps:
59-
- uses: actions/setup-go@v2
60-
with:
61-
go-version: ${{ needs.go-version.outputs.go-version }}
62-
# Check out the pull request code (as opposed to the target project).
63-
- uses: actions/checkout@v2
64-
with:
65-
ref: ${{ github.event.pull_request.head.sha }}
66-
# Cache the Go modules.
67-
- uses: actions/cache@v2
68-
with:
69-
path: ~/go/pkg/mod
70-
key: ${{ github.job }}-${{ runner.os }}-go${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum', 'GNUMakefile') }}
71-
# CAUTION: EXECUTING UNTRUSTED CODE.
72-
# This is made safe because we have not referenced any secrets or GitHub tokens.
73-
- run: make testacc-up
74-
- run: make testacc
75-
7655
acceptance-ee:
7756
# Only run EE tests if the LICENSE_ENCRYPTION_PASSWORD secret exists, so that the workflow
7857
# doesn't fail when code is pushed to a fork.
79-
if: ${{ needs.license-encryption-password.outputs.defined }}
58+
if: needs.license-encryption-password.outputs.defined && contains(github.event.pull_request.labels.*.name, 'safe to test')
8059
timeout-minutes: 60
8160
runs-on: ubuntu-latest
8261
needs: [go-version, license-encryption-password]
@@ -107,3 +86,4 @@ jobs:
10786
# This is made safe because we have already cleaned up the unencrypted GitLab license file,
10887
# we have no other secrets, and we are not using GitHub tokens.
10988
- run: make testacc
89+

0 commit comments

Comments
 (0)