Skip to content

Commit 434fb81

Browse files
committed
Bring tests back
1 parent 0004af6 commit 434fb81

File tree

2 files changed

+111
-110
lines changed

2 files changed

+111
-110
lines changed
Lines changed: 110 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,118 +1,118 @@
1-
# name: Build and Test
1+
name: Build and Test
22

3-
# on:
4-
# workflow_call:
5-
# inputs:
6-
# platform:
7-
# required: true
8-
# description: 'build platform'
9-
# type: string
10-
# target-platform:
11-
# required: true
12-
# description: 'target platform'
13-
# type: string
14-
# compiler-nix-name:
15-
# required: true
16-
# description: 'compiler name in nix format. e.g. ghc96'
17-
# type: string
18-
# minimal:
19-
# description: 'without hls, hlint, ...'
20-
# type: boolean
21-
# default: true
22-
# iog:
23-
# description: 'without iog libs: libsodium, libsecp256k1, libblst, ...'
24-
# type: boolean
25-
# default: false
26-
# package:
27-
# description: 'name of hackage package'
28-
# type: string
29-
# default: hello
3+
on:
4+
workflow_call:
5+
inputs:
6+
platform:
7+
required: true
8+
description: 'build platform'
9+
type: string
10+
target-platform:
11+
required: true
12+
description: 'target platform'
13+
type: string
14+
compiler-nix-name:
15+
required: true
16+
description: 'compiler name in nix format. e.g. ghc96'
17+
type: string
18+
minimal:
19+
description: 'without hls, hlint, ...'
20+
type: boolean
21+
default: true
22+
iog:
23+
description: 'without iog libs: libsodium, libsecp256k1, libblst, ...'
24+
type: boolean
25+
default: false
26+
package:
27+
description: 'name of hackage package'
28+
type: string
29+
default: hello
3030

31-
# jobs:
32-
# build:
33-
# name: Build ${{ inputs.package }} executable
34-
# defaults:
35-
# run:
36-
# shell: devx {0}
37-
# runs-on: ${{ inputs.platform == 'x86_64-linux' && 'ubuntu-latest' || 'macos-latest' }}
38-
# steps:
39-
# - name: Checkout code
40-
# uses: actions/checkout@v4
41-
# - name: Install GHC and Cabal
42-
# uses: input-output-hk/actions/devx@latest
43-
# with:
44-
# platform: ${{ inputs.platform }}
45-
# target-platform: ${{ inputs.target-platform }}
46-
# compiler-nix-name: ${{ inputs.compiler-nix-name }}
47-
# minimal: ${{ inputs.minimal }}
48-
# iog: ${{ inputs.iog }}
49-
# - name: cabal update
50-
# run: cabal update
51-
# - name: unapck hello
52-
# run: cabal unpack hello
53-
# - name: build hello
54-
# working-directory: hello-1.0.0.2
55-
# run: |
56-
# cabal build${{ inputs.target-platform == '-static' && ' --enable-executable-static' || '' }}
57-
# mkdir bin
58-
# cp dist-newstyle/build/*/*/hello-1.0.0.2/build/hello/hello${{ inputs.target-platform == '-windows' && '.exe' || '' }} bin
59-
# ls -lah bin/
60-
# - name: Fix up the nix dependencies
61-
# working-directory: hello-1.0.0.2
62-
# if: (inputs.platform == 'x86_64-darwin' || inputs.platform == 'aarch64-darwin') && inputs.target-platform == ''
63-
# run: fixup-nix-deps bin/hello
31+
jobs:
32+
build:
33+
name: Build ${{ inputs.package }} executable
34+
defaults:
35+
run:
36+
shell: devx {0}
37+
runs-on: ${{ inputs.platform == 'x86_64-linux' && 'ubuntu-latest' || 'macos-latest' }}
38+
steps:
39+
- name: Checkout code
40+
uses: actions/checkout@v4
41+
- name: Install GHC and Cabal
42+
uses: input-output-hk/actions/devx@latest
43+
with:
44+
platform: ${{ inputs.platform }}
45+
target-platform: ${{ inputs.target-platform }}
46+
compiler-nix-name: ${{ inputs.compiler-nix-name }}
47+
minimal: ${{ inputs.minimal }}
48+
iog: ${{ inputs.iog }}
49+
- name: cabal update
50+
run: cabal update
51+
- name: unapck hello
52+
run: cabal unpack hello
53+
- name: build hello
54+
working-directory: hello-1.0.0.2
55+
run: |
56+
cabal build${{ inputs.target-platform == '-static' && ' --enable-executable-static' || '' }}
57+
mkdir bin
58+
cp dist-newstyle/build/*/*/hello-1.0.0.2/build/hello/hello${{ inputs.target-platform == '-windows' && '.exe' || '' }} bin
59+
ls -lah bin/
60+
- name: Fix up the nix dependencies
61+
working-directory: hello-1.0.0.2
62+
if: (inputs.platform == 'x86_64-darwin' || inputs.platform == 'aarch64-darwin') && inputs.target-platform == ''
63+
run: fixup-nix-deps bin/hello
6464

65-
# - name: Inspect and patchup dynamic build product
66-
# working-directory: hello-1.0.0.2
67-
# if: ${{ inputs.platform == 'x86_64-linux' && inputs.target-platform == '' }}
68-
# run: |
69-
# nix-shell -p patchelf --run 'patchelf --print-interpreter bin/hello'
70-
# nix-shell -p patchelf --run 'patchelf --print-needed bin/hello'
71-
# # setting the interpreter to the 64bit ubuntu one.
72-
# nix-shell -p patchelf --run 'patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 bin/hello'
73-
# # this will copy _all_ dependent libraries. This might not be the
74-
# # greatest idea. But it's most likely the most reliable.
75-
# nix-shell -p patchelf --run 'mkdir -p bin/libs
76-
# for lib in $(patchelf --print-needed bin/hello); do
77-
# for path in $(patchelf --print-rpath bin/hello|tr : \ ); do
78-
# if [ -f "$path/$lib" ]; then
79-
# cp "$path/$lib" bin/libs/
80-
# if patchelf --print-interpreter "bin/libs/$lib" >/dev/null 2>&1; then
81-
# patchelf --set-interpreter /lib/ld-linux.so.2 "bin/libs/$lib"
82-
# fi
83-
# break
84-
# fi
85-
# done
86-
# done'
87-
# # we set /lib64 as well, even though we likely shouldn't need that, as all
88-
# # libraries are found in the libs folder we ship along.
89-
# nix-shell -p patchelf --run 'patchelf --set-rpath \$ORIGIN/lib:/lib64 bin/hello'
65+
- name: Inspect and patchup dynamic build product
66+
working-directory: hello-1.0.0.2
67+
if: ${{ inputs.platform == 'x86_64-linux' && inputs.target-platform == '' }}
68+
run: |
69+
nix-shell -p patchelf --run 'patchelf --print-interpreter bin/hello'
70+
nix-shell -p patchelf --run 'patchelf --print-needed bin/hello'
71+
# setting the interpreter to the 64bit ubuntu one.
72+
nix-shell -p patchelf --run 'patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 bin/hello'
73+
# this will copy _all_ dependent libraries. This might not be the
74+
# greatest idea. But it's most likely the most reliable.
75+
nix-shell -p patchelf --run 'mkdir -p bin/libs
76+
for lib in $(patchelf --print-needed bin/hello); do
77+
for path in $(patchelf --print-rpath bin/hello|tr : \ ); do
78+
if [ -f "$path/$lib" ]; then
79+
cp "$path/$lib" bin/libs/
80+
if patchelf --print-interpreter "bin/libs/$lib" >/dev/null 2>&1; then
81+
patchelf --set-interpreter /lib/ld-linux.so.2 "bin/libs/$lib"
82+
fi
83+
break
84+
fi
85+
done
86+
done'
87+
# we set /lib64 as well, even though we likely shouldn't need that, as all
88+
# libraries are found in the libs folder we ship along.
89+
nix-shell -p patchelf --run 'patchelf --set-rpath \$ORIGIN/lib:/lib64 bin/hello'
9090
91-
# - name: Upload hello executable
92-
# uses: actions/upload-artifact@v4
93-
# with:
94-
# overwrite: true
95-
# name: ${{ inputs.package }}-${{ inputs.platform }}${{ inputs.target-platform }}-${{ inputs.compiler-nix-name }}${{ inputs.minimal && '-minimal' || '' }}${{ inputs.iog && '-iog' || '' }}
96-
# path: |
97-
# hello-1.0.0.2/bin/hello${{ inputs.target-platform == '-windows' && '.exe' || '' }}
98-
# hello-1.0.0.2/bin/libs
91+
- name: Upload hello executable
92+
uses: actions/upload-artifact@v4
93+
with:
94+
overwrite: true
95+
name: ${{ inputs.package }}-${{ inputs.platform }}${{ inputs.target-platform }}-${{ inputs.compiler-nix-name }}${{ inputs.minimal && '-minimal' || '' }}${{ inputs.iog && '-iog' || '' }}
96+
path: |
97+
hello-1.0.0.2/bin/hello${{ inputs.target-platform == '-windows' && '.exe' || '' }}
98+
hello-1.0.0.2/bin/libs
9999
100-
# run:
101-
# name: Run ${{ inputs.package }} executable
102-
# needs: build
100+
run:
101+
name: Run ${{ inputs.package }} executable
102+
needs: build
103103

104-
# runs-on: ${{ inputs.target-platform == '-windows' && 'windows-latest' || (inputs.platform == 'x86_64-linux' && 'ubuntu-latest' || 'macos-latest') }}
105-
# steps:
106-
# - name: Download hello executable
107-
# uses: actions/download-artifact@v4
108-
# with:
109-
# name: ${{ inputs.package }}-${{ inputs.platform }}${{ inputs.target-platform }}-${{ inputs.compiler-nix-name }}${{ inputs.minimal && '-minimal' || '' }}${{ inputs.iog && '-iog' || '' }}
104+
runs-on: ${{ inputs.target-platform == '-windows' && 'windows-latest' || (inputs.platform == 'x86_64-linux' && 'ubuntu-latest' || 'macos-latest') }}
105+
steps:
106+
- name: Download hello executable
107+
uses: actions/download-artifact@v4
108+
with:
109+
name: ${{ inputs.package }}-${{ inputs.platform }}${{ inputs.target-platform }}-${{ inputs.compiler-nix-name }}${{ inputs.minimal && '-minimal' || '' }}${{ inputs.iog && '-iog' || '' }}
110110

111-
# # see https://github.com/actions/upload-artifact#permission-loss
112-
# # windows doesn't care \o/
113-
# - name: Restore Executable Permission
114-
# if: ${{ inputs.target-platform != '-windows' }}
115-
# run: chmod +x ./hello
111+
# see https://github.com/actions/upload-artifact#permission-loss
112+
# windows doesn't care \o/
113+
- name: Restore Executable Permission
114+
if: ${{ inputs.target-platform != '-windows' }}
115+
run: chmod +x ./hello
116116

117-
# - name: Run hello executable
118-
# run: ./hello
117+
- name: Run hello executable
118+
run: ./hello

.github/workflows/hello.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: Test that we can build the hello world example form hackage
2+
23
on:
34
push:
45
workflow_dispatch:

0 commit comments

Comments
 (0)