1111
1212jobs :
1313 build :
14- name : build-${{ matrix.os }}-${{ matrix.ghc }}
15- runs-on : ${{ matrix.os }}
14+ name : " Ubuntu: ${{ matrix.os }}, GHC: ${{ matrix.ghc }}"
15+ env :
16+ apps : " smp-server xftp-server ntf-server xftp"
17+ runs-on : ubuntu-${{ matrix.os }}
1618 strategy :
1719 fail-fast : false
1820 matrix :
1921 include :
20- - os : ubuntu-20.04
21- platform_name : 20_04-x86-64
22+ - os : 22.04
2223 ghc : " 8.10.7"
23- - os : ubuntu-20.04
2424 platform_name : 20_04-x86-64
25+ - os : 20.04
26+ ghc : " 9.6.3"
27+ platform_name : 20_04-x86-64
28+ - os : 22.04
2529 ghc : " 9.6.3"
26- - os : ubuntu-22.04
2730 platform_name : 22_04-x86-64
31+ - os : 24.04
2832 ghc : " 9.6.3"
33+ platform_name : 24_04-x86-64
2934 steps :
3035 - name : Clone project
3136 uses : actions/checkout@v3
3237
33- - name : Setup Haskell
34- uses : haskell-actions/setup@v2
35- with :
36- ghc-version : ${{ matrix.ghc }}
37- cabal-version : " 3.10.1.0"
38-
39- - name : Cache dependencies
40- uses : actions/cache@v2
41- with :
42- path : |
43- ~/.cabal/store
44- dist-newstyle
45- key : ${{ matrix.os }}-${{ hashFiles('cabal.project', 'simplexmq.cabal') }}
38+ - name : Prepare image
39+ shell : bash
40+ run : docker build -f Dockerfile.build --build-arg TAG=${{ matrix.os }} --build-arg GHC=${{ matrix.ghc }} -t local .
4641
47- - name : Build
42+ - name : Start container
4843 shell : bash
49- run : cabal build --enable-tests
44+ run : docker run -t -d --name builder local
5045
51- - name : Test
52- timeout-minutes : 40
46+ - name : Build binaries
5347 shell : bash
54- run : cabal test --test-show-details=direct
48+ run : docker exec -t -e apps="$apps" builder sh -c 'cabal build --enable-tests && mkdir /out && for i in $apps; do bin=$(find /project/dist-newstyle -name "$i" -type f -executable); strip "$bin"; chmod +x "$bin"; mv "$bin" /out/; done'
5549
56- - name : Prepare binaries
50+ - name : Copy binaries from container and prepare them
5751 if : startsWith(github.ref, 'refs/tags/v')
5852 shell : bash
5953 run : |
60- mv $(cabal list-bin smp-server) smp-server-ubuntu-${{ matrix.platform_name}}
61- mv $(cabal list-bin ntf-server) ntf-server-ubuntu-${{ matrix.platform_name}}
62- mv $(cabal list-bin xftp-server) xftp-server-ubuntu-${{ matrix.platform_name}}
63- mv $(cabal list-bin xftp) xftp-ubuntu-${{ matrix.platform_name}}
54+ docker cp builder:/out .
55+ for i in $apps; do mv ./out/$i ./$i-ubuntu-${{ matrix.platform_name }}; done
6456
6557 - name : Build changelog
6658 if : startsWith(github.ref, 'refs/tags/v')
6759 id : build_changelog
68- uses : mikepenz/release-changelog-builder-action@v1
60+ uses : mikepenz/release-changelog-builder-action@v5
6961 with :
7062 configuration : .github/changelog_conf.json
7163 failOnError : true
7668
7769 - name : Create release
7870 if : startsWith(github.ref, 'refs/tags/v') && matrix.ghc != '8.10.7'
79- uses : softprops/action-gh-release@v1
71+ uses : softprops/action-gh-release@v2
8072 with :
8173 body : |
8274 See full changelog [here](https://github.com/simplex-chat/simplexmq/blob/master/CHANGELOG.md).
@@ -86,10 +78,17 @@ jobs:
8678 prerelease : true
8779 files : |
8880 LICENSE
89- smp-server-ubuntu-${{ matrix.platform_name}}
90- ntf-server-ubuntu-${{ matrix.platform_name}}
91- xftp-server-ubuntu-${{ matrix.platform_name}}
92- xftp-ubuntu-${{ matrix.platform_name}}
81+ smp-server-ubuntu-${{ matrix.platform_name }}
82+ ntf-server-ubuntu-${{ matrix.platform_name }}
83+ xftp-server-ubuntu-${{ matrix.platform_name }}
84+ xftp-ubuntu-${{ matrix.platform_name }}
9385 fail_on_unmatched_files : true
9486 env :
9587 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
88+
89+ - name : Test
90+ shell : bash
91+ run : |
92+ docker exec -t builder sh -c 'mv $(find /project/dist-newstyle -name "simplexmq-test" -type f -executable) /out/'
93+ docker cp builder:/out/simplexmq-test .
94+ ./simplexmq-test
0 commit comments