ci: seperate builds (pg/standard) #8791
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} | |
services: | |
postgres: | |
image: postgres:15 | |
env: | |
POSTGRES_HOST_AUTH_METHOD: trust # Allows passwordless access | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
# Maps tcp port 5432 on service container to the host | |
- 5432:5432 | |
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 smp-server (postgresql) and tests | |
shell: bash | |
run: docker exec -t -e apps="$apps" builder sh -c 'cabal build --enable-tests -fserver_postgres exe:smp-server && mkdir -p /out && for i in smp-server simplexmq-test; do bin=$(find /project/dist-newstyle -name "$i" -type f -executable); strip "$bin"; chmod +x "$bin"; mv "$bin" /out/; done' | |
- name: Copy smp-server (postgresql) and tests from container and prepare them | |
if: startsWith(github.ref, 'refs/tags/v') | |
shell: bash | |
run: | | |
docker cp builder:/out . | |
mv ./out/smp-server ./smp-server-postgres-ubuntu-${{ matrix.platform_name }} | |
mv ./out/simplexmq-test . | |
- name: Build everything else (standard) | |
shell: bash | |
run: docker exec -t -e apps="$apps" builder sh -c 'cabal build && mkdir -p /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 }} | |
smp-server-postgres-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 | |
env: | |
PGHOST: localhost | |
run: | | |
./simplexmq-test |