mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-05-27 16:24:19 +00:00
36f5539b9a
* ci: introduce reproducible builds * ci: return 20.04 * smp server: increase timing test threshold * ci: test outside docker * ci: fix test step --------- Co-authored-by: Evgeny Poberezkin <evgeny@poberezkin.com>
95 lines
3.0 KiB
YAML
95 lines
3.0 KiB
YAML
name: build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- stable
|
|
tags:
|
|
- "v*"
|
|
pull_request:
|
|
|
|
jobs:
|
|
build:
|
|
name: "Ubuntu: ${{ matrix.os }}, GHC: ${{ matrix.ghc }}"
|
|
env:
|
|
apps: "smp-server xftp-server ntf-server xftp"
|
|
runs-on: ubuntu-${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: 22.04
|
|
ghc: "8.10.7"
|
|
platform_name: 20_04-x86-64
|
|
- os: 20.04
|
|
ghc: "9.6.3"
|
|
platform_name: 20_04-x86-64
|
|
- os: 22.04
|
|
ghc: "9.6.3"
|
|
platform_name: 22_04-x86-64
|
|
- os: 24.04
|
|
ghc: "9.6.3"
|
|
platform_name: 24_04-x86-64
|
|
steps:
|
|
- name: Clone project
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Prepare image
|
|
shell: bash
|
|
run: docker build -f Dockerfile.build --build-arg TAG=${{ matrix.os }} --build-arg GHC=${{ matrix.ghc }} -t local .
|
|
|
|
- name: Start container
|
|
shell: bash
|
|
run: docker run -t -d --name builder local
|
|
|
|
- name: Build binaries
|
|
shell: bash
|
|
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'
|
|
|
|
- name: Copy binaries from container and prepare them
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
shell: bash
|
|
run: |
|
|
docker cp builder:/out .
|
|
for i in $apps; do mv ./out/$i ./$i-ubuntu-${{ matrix.platform_name }}; done
|
|
|
|
- name: Build changelog
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
id: build_changelog
|
|
uses: mikepenz/release-changelog-builder-action@v5
|
|
with:
|
|
configuration: .github/changelog_conf.json
|
|
failOnError: true
|
|
ignorePreReleases: true
|
|
commitMode: true
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Create release
|
|
if: startsWith(github.ref, 'refs/tags/v') && matrix.ghc != '8.10.7'
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
body: |
|
|
See full changelog [here](https://github.com/simplex-chat/simplexmq/blob/master/CHANGELOG.md).
|
|
|
|
Commits:
|
|
${{ steps.build_changelog.outputs.changelog }}
|
|
prerelease: true
|
|
files: |
|
|
LICENSE
|
|
smp-server-ubuntu-${{ matrix.platform_name }}
|
|
ntf-server-ubuntu-${{ matrix.platform_name }}
|
|
xftp-server-ubuntu-${{ matrix.platform_name }}
|
|
xftp-ubuntu-${{ matrix.platform_name }}
|
|
fail_on_unmatched_files: true
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Test
|
|
shell: bash
|
|
run: |
|
|
docker exec -t builder sh -c 'mv $(find /project/dist-newstyle -name "simplexmq-test" -type f -executable) /out/'
|
|
docker cp builder:/out/simplexmq-test .
|
|
./simplexmq-test
|