Skip to content

Commit 5b81496

Browse files
committed
Add OpenBSD support
1 parent 42d8315 commit 5b81496

5 files changed

Lines changed: 92 additions & 7 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: 74 additions & 1 deletion
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"
@@ -499,6 +533,45 @@ jobs:
499533
run: |
500534
bash .github/scripts/test.sh
501535
536+
- if: failure()
537+
name: Upload artifact
538+
uses: actions/upload-artifact@v4
539+
with:
540+
name: testfiles-${{ matrix.ARTIFACT }}
541+
path: |
542+
./test/ghcup-test/golden/unix/GHCupInfo*json
543+
test-openbsd:
544+
name: Test OpenBSD
545+
needs: "build-openbsd"
546+
runs-on: [self-hosted, openbsd, X64]
547+
env:
548+
CABAL_VER: 3.14.1.1
549+
ARTIFACT: "x86_64-openbsd-ghcup"
550+
GHC_VER: 9.6.7
551+
ARCH: 64
552+
DISTRO: na
553+
RUNNER_OS: OpenBSD
554+
steps:
555+
- name: Checkout code
556+
uses: actions/checkout@v4
557+
with:
558+
submodules: 'true'
559+
560+
- name: Install prerequisites
561+
run: |
562+
gcc_ver=$(pkg_info -Q gcc | grep '^gcc-[0-9]' | sort -u | head -1 | awk '{ print $1 }')
563+
doas pkg_add -I ghc cabal-install git bash libiconv curl ${gcc_ver} gmp gmake libffi
564+
565+
- uses: actions/download-artifact@v4
566+
with:
567+
pattern: artifacts-*
568+
merge-multiple: true
569+
path: ./out
570+
571+
- name: Run test
572+
run: |
573+
bash .github/scripts/test.sh
574+
502575
- if: failure()
503576
name: Upload artifact
504577
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)