Skip to content

Commit f086863

Browse files
committed
Add OpenBSD support
1 parent 42d8315 commit f086863

5 files changed

Lines changed: 96 additions & 9 deletions

File tree

.github/scripts/build.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,15 @@ git_describe
1010
download_cabal_cache "$HOME/.local/bin/cabal-cache"
1111

1212
# install toolchain (if necessary)
13-
ghcup -v install ghc --set --force "$GHC_VER"
14-
ghcup -v install cabal --force "$CABAL_VER"
15-
ghc --version
16-
cabal --version
17-
GHC="ghc-${GHC_VER}"
13+
if [ "${OS}" = "OpenBSD" ] ; then
14+
GHC="ghc-$(ghc --numeric-version)"
15+
else
16+
ghcup -v install ghc --set --force "$GHC_VER"
17+
ghcup -v install cabal --force "$CABAL_VER"
18+
ghc --version
19+
cabal --version
20+
GHC="ghc-${GHC_VER}"
21+
fi
1822

1923
# build
2024
ecabal update

.github/scripts/common.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ eghcup() {
5151
}
5252

5353
sha_sum() {
54-
if [ "${OS}" = "FreeBSD" ] ; then
54+
if [ "${OS}" = "FreeBSD" ] || [ "${OS}" = "OpenBSD" ] ; then
5555
sha256 "$@"
5656
else
5757
sha256sum "$@"

.github/scripts/env.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ if [ "${RUNNER_OS}" = "freebsd" ] ; then
1313
export RUNNER_OS=FreeBSD
1414
fi
1515

16+
if [ "${RUNNER_OS}" = "openbsd" ] ; then
17+
export RUNNER_OS=OpenBSD
18+
fi
19+
1620
export OS="$RUNNER_OS"
1721
export PATH="$HOME/.local/bin:$PATH"
1822

.github/scripts/test.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ sha_sum "$(raw_eghcup --offline whereis ghcup)"
3535
./"ghcup-test-optparse${ext}"
3636
rm "ghcup-test${ext}" "ghcup-test-optparse${ext}"
3737

38+
if [ "${OS}" = "OpenBSD" ] ; then
39+
exit 0
40+
fi
41+
3842
### manual cli based testing
3943

4044
eghcup --numeric-version

.github/workflows/release.yaml

Lines changed: 78 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ jobs:
225225
runs-on: [self-hosted, FreeBSD, X64]
226226
env:
227227
CABAL_VER: 3.14.1.1
228-
MACOSX_DEPLOYMENT_TARGET: 10.13
229228
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
230229
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
231230
S3_HOST: ${{ secrets.S3_HOST }}
@@ -261,6 +260,41 @@ jobs:
261260
path: |
262261
./out/*
263262
263+
build-openbsd:
264+
name: Build binary (OpenBSD)
265+
runs-on: [self-hosted, openbsd, X64]
266+
env:
267+
CABAL_VER: 3.14.1.1
268+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
269+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
270+
S3_HOST: ${{ secrets.S3_HOST }}
271+
ARTIFACT: "x86_64-openbsd-ghcup"
272+
GHC_VER: 9.6.7
273+
ARCH: 64
274+
DISTRO: na
275+
RUNNER_OS: OpenBSD
276+
steps:
277+
- name: Checkout code
278+
uses: actions/checkout@v4
279+
with:
280+
submodules: 'true'
281+
282+
- name: Install prerequisites
283+
run: |
284+
gcc_ver=$(pkg_info -Q gcc | grep '^gcc-[0-9]' | sort -u | head -1 | awk '{ print $1 }')
285+
doas pkg_add -I ghc cabal-install git bash libiconv curl ${gcc_ver} gmp gmake libffi
286+
287+
- name: Run build
288+
run: bash .github/scripts/build.sh
289+
290+
- if: always()
291+
name: Upload artifact
292+
uses: actions/upload-artifact@v4
293+
with:
294+
name: artifacts-${{ env.ARTIFACT }}
295+
path: |
296+
./out/*
297+
264298
test-linux:
265299
name: Test linux
266300
needs: "build-linux"
@@ -503,9 +537,50 @@ jobs:
503537
name: Upload artifact
504538
uses: actions/upload-artifact@v4
505539
with:
506-
name: testfiles-${{ matrix.ARTIFACT }}
540+
name: testfiles-${{ env.ARTIFACT }}
541+
path: |
542+
./test/ghcup-test/golden/unix/GHCupInfo*json
543+
544+
test-openbsd:
545+
name: Test OpenBSD
546+
needs: "build-openbsd"
547+
runs-on: [self-hosted, openbsd, X64]
548+
env:
549+
CABAL_VER: 3.14.1.1
550+
ARTIFACT: "x86_64-openbsd-ghcup"
551+
GHC_VER: 9.6.7
552+
ARCH: 64
553+
DISTRO: na
554+
RUNNER_OS: OpenBSD
555+
steps:
556+
- name: Checkout code
557+
uses: actions/checkout@v4
558+
with:
559+
submodules: 'true'
560+
561+
- name: Install prerequisites
562+
run: |
563+
gcc_ver=$(pkg_info -Q gcc | grep '^gcc-[0-9]' | sort -u | head -1 | awk '{ print $1 }')
564+
doas pkg_add -I ghc cabal-install git bash libiconv curl ${gcc_ver} gmp gmake libffi
565+
566+
- uses: actions/download-artifact@v4
567+
with:
568+
pattern: artifacts-*
569+
merge-multiple: true
570+
path: ./out
571+
572+
- name: Run test
573+
run: |
574+
bash .github/scripts/test.sh
575+
576+
- if: failure()
577+
name: Upload artifact
578+
uses: actions/upload-artifact@v4
579+
with:
580+
name: testfiles-${{ env.ARTIFACT }}
507581
path: |
508582
./test/ghcup-test/golden/unix/GHCupInfo*json
583+
509584
hls:
510585
name: hls
511586
needs: build-linux
@@ -539,7 +614,7 @@ jobs:
539614
540615
release:
541616
name: release
542-
needs: ["test-linux", "test-arm", "test-macwin", "test-freebsd", "hls"]
617+
needs: ["test-linux", "test-arm", "test-macwin", "test-freebsd", "test-openbsd", "hls"]
543618
runs-on: ubuntu-latest
544619
if: startsWith(github.ref, 'refs/tags/v')
545620
steps:

0 commit comments

Comments
 (0)