Skip to content

Commit 3c3f5ef

Browse files
authored
Merge pull request #5856 from jsoref/integration-tests-in-forks
Integration tests in forks
2 parents f439146 + ba70082 commit 3c3f5ef

File tree

1 file changed

+41
-5
lines changed

1 file changed

+41
-5
lines changed

.github/workflows/integration-tests.yml

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,45 @@ jobs:
9595
name: ${{ runner.os }}
9696
path: _release/stack-*
9797

98+
configuration:
99+
name: Check for self-hosted runners
100+
runs-on: ubuntu-latest
101+
env:
102+
CAN_SIGN: ${{ secrets.RELEASE_SIGNING_KEY != '' }}
103+
outputs:
104+
arm64: ${{ steps.runners.outputs.arm64 }}
105+
can-sign: ${{ env.CAN_SIGN }}
106+
steps:
107+
- name: Check for hosted runners
108+
id: runners
109+
shell: bash
110+
env:
111+
SELF_HOSTED_RUNNERS: ${{ secrets.SELF_HOSTED_RUNNERS || (github.repository_owner == 'commercialhaskell' && 'arm64') }}
112+
run: |
113+
echo "::set-output name=runners::$SELF_HOSTED_RUNNERS"
114+
if echo "$SELF_HOSTED_RUNNERS" | grep -q 'arm64'; then
115+
echo "::set-output name=arm64::['self-hosted', 'linux', 'ARM64']"
116+
else
117+
echo '::set-output name=arm64::"ubuntu-latest"'
118+
fi
119+
98120
linux-arm64:
99121
name: Linux ARM64
100-
runs-on: [self-hosted, linux, ARM64]
122+
runs-on: ${{ fromJSON(needs.configuration.outputs.arm64) }}
123+
needs: configuration
101124
steps:
125+
- name: Skipping ARM64
126+
if: needs.configuration.outputs.arm64 == 'ubuntu-latest'
127+
shell: bash
128+
run: |
129+
echo '::notice title=ARM64 skipped::To build ARM64, a self-hosted runner needs to be configured and the SELF_HOSTED_RUNNERS secret must contain arm64'
130+
102131
- name: Clone project
132+
if: needs.configuration.outputs.arm64 != 'ubuntu-latest'
103133
uses: actions/checkout@v3
104134

105135
- name: Build bindist
136+
if: needs.configuration.outputs.arm64 != 'ubuntu-latest'
106137
shell: bash
107138
run: |
108139
set -ex
@@ -112,13 +143,16 @@ jobs:
112143
docker run --rm -v $(pwd):/src -w /src stack bash -c "/home/stack/release build"
113144
114145
- name: Upload bindist
146+
if: needs.configuration.outputs.arm64 != 'ubuntu-latest'
115147
uses: actions/upload-artifact@v3
116148
with:
117149
name: Linux-ARM64
118150
path: _release/stack-*
119151

120152
github-release:
121153
name: Create GitHub release
154+
permissions:
155+
contents: write
122156
needs:
123157
- integration-tests
124158
- linux-arm64
@@ -141,11 +175,13 @@ jobs:
141175
name: Windows
142176
path: _release
143177
- name: Download Linux-ARM64 artifact
178+
if: contains(needs.configuration.outputs.runners, 'arm64')
144179
uses: actions/download-artifact@v3
145180
with:
146181
name: Linux-ARM64
147182
path: _release
148183
- name: Hash and sign assets
184+
if: needs.configuration.outputs.can-sign
149185
shell: bash
150186
env:
151187
RELEASE_SIGNING_KEY: ${{ secrets.RELEASE_SIGNING_KEY }}
@@ -163,11 +199,11 @@ jobs:
163199
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
164200
- name: Create GitHub release (final)
165201
if: "!startsWith(github.ref, 'refs/tags/rc/')"
166-
uses: actions/create-release@v1
202+
uses: ncipollo/release-action@v1.10.0
167203
env:
168204
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
169205
with:
170-
tag_name: ${{ github.ref }}
206+
tag: ${{ github.ref }}
171207
body: |
172208
See https://haskellstack.org/ for installation and upgrade instructions.
173209
@@ -182,11 +218,11 @@ jobs:
182218
prerelease: false
183219
- name: Create GitHub release (release candidate)
184220
if: "startsWith(github.ref, 'refs/tags/rc/')"
185-
uses: actions/create-release@v1
221+
uses: ncipollo/release-action@v1.10.0
186222
env:
187223
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
188224
with:
189-
tag_name: ${{ github.ref }}
225+
tag: ${{ github.ref }}
190226
body: |
191227
**Changes since v[INSERT PREVIOUS VERSION]:**
192228

0 commit comments

Comments
 (0)