File tree Expand file tree Collapse file tree 4 files changed +51
-11
lines changed Expand file tree Collapse file tree 4 files changed +51
-11
lines changed Original file line number Diff line number Diff line change 27
27
uses : actions/checkout@v2
28
28
with :
29
29
submodules : ' true'
30
-
30
+ - uses : extractions/setup-just@v1
31
+ with :
32
+ just-version : 1.1.3
31
33
- name : Cache dependencies
32
34
uses : actions/cache@v2
33
35
with :
44
46
set -exuo pipefail
45
47
curl -sSL https://get.haskellstack.org/ | sh -s - -f
46
48
stack test --fast --no-terminal --stack-yaml=${{ matrix.stack-yaml }} --resolver=${{ matrix.resolver }}
49
+ - name : Static Binary check
50
+ shell : bash
51
+ run : |
52
+ set -exuo pipefail
53
+ just copy-static-pid1
54
+ just test
Original file line number Diff line number Diff line change @@ -13,14 +13,18 @@ jobs:
13
13
steps :
14
14
- name : Checkout code
15
15
uses : actions/checkout@v2
16
- - name : Create Release
17
- id : create_release
18
- uses : actions/create-release@v1
19
- env :
20
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
16
+ - uses : extractions/setup-just@v1
21
17
with :
22
- tag_name : ${{ github.ref }}
23
- release_name : pid1-${{ github.ref }}
24
- body_path : ChangeLog.md
25
- draft : false
26
- prerelease : false
18
+ just-version : 1.1.3
19
+ - name : Static Binary Generation
20
+ shell : bash
21
+ run : |
22
+ set -exuo pipefail
23
+ just copy-static-pid1
24
+ just test
25
+ - name : Release
26
+ uses : softprops/action-gh-release@v1
27
+ if : startsWith(github.ref, 'refs/tags/')
28
+ with :
29
+ files : pid1
30
+ generate_release_notes : true
Original file line number Diff line number Diff line change
1
+ FROM fpco/alpine-haskell-stack:9.2.5
2
+
3
+ COPY . /app
4
+
5
+ RUN apk add upx \
6
+ && env STACK_YAML=/app/stack.yaml stack --system-ghc install --local-bin-path /app --flag pid1:static \
7
+ && upx --best /app/pid1
Original file line number Diff line number Diff line change
1
+ # List all recipies
2
+ default :
3
+ just --list --unsorted
4
+
5
+ # Build image
6
+ build-image :
7
+ docker build --file Dockerfile . --tag pid1
8
+
9
+ # Copy static binary from container
10
+ copy-static-pid1 : build-image
11
+ #!/usr/bin/env bash
12
+ set -euo pipefail
13
+ CID=$(docker create pid1)
14
+ docker cp ${CID}:/ app/ pid1 .
15
+ docker rm ${CID}
16
+ ls -lah pid1
17
+
18
+ # Sanity test the binary
19
+ test :
20
+ file ./ pid1
21
+ ./ pid1 -- ps
You can’t perform that action at this time.
0 commit comments