-
Notifications
You must be signed in to change notification settings - Fork 9
101 lines (89 loc) · 2.7 KB
/
server-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: 'Server: Test & Build'
on:
push:
branches:
- master
tags:
- 'v*_server'
paths:
- 'server/**'
- '.github/workflows/server-*'
pull_request:
branches:
- master
paths:
- 'server/**'
- '.github/workflows/server-*'
jobs:
release:
strategy:
matrix:
os: [ubuntu-18.04]
plan:
- { stack-lts: "20.11", resolver: "--resolver lts-20.11" }
runs-on: ${{ matrix.os }}
steps:
- name: Install OS Packages
uses: mstksg/get-package@v1
with:
apt-get: happy libblas-dev liblapack-dev libgmp-dev
- uses: actions/checkout@v3
- name: Setup stack
uses: haskell/actions/setup@v2
with:
ghc-version: '9.2.5'
enable-stack: true
stack-version: 'latest'
- name: Cache ~/.stack
uses: actions/cache@v2
with:
path: ~/.stack
key: ${{ matrix.os }}-stack-lts-${{ matrix.plan.stack-lts }}-${{ hashFiles('server/package.yaml') }}-${{ hashFiles('server/stack.yaml') }}-${{ hashFiles('server/stack.yaml.lock') }}
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
set -ex
stack --no-terminal --install-ghc $ARGS test --bench --only-dependencies
set +ex
env:
ARGS: ${{ matrix.plan.resolver }}
working-directory: server
- name: Test & Build
run: |
set -ex
stack --no-terminal $ARGS test --bench --no-run-benchmarks --haddock --no-haddock-deps
cp $(stack exec -- which tsplay-exe) tsplay-exe
set +ex
env:
ARGS: ${{ matrix.plan.resolver }}
working-directory: server
- name: Get release version
if: startsWith(github.ref, 'refs/tags/')
id: get_version
run: echo ::set-env name=RELEASE_VERSION::$(echo ${GITHUB_REF:10})
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
- name: Publish to Registry
if: startsWith(github.ref, 'refs/tags/')
uses: elgohr/Publish-Docker-Github-Action@master
env:
BINARY_PATH: "tsplay-exe"
with:
name: gillchristian/tsplay
username: gillchristian
password: ${{ secrets.docker_password }}
workdir: server
tags: "latest,${{ env.RELEASE_VERSION }}"
buildargs: BINARY_PATH
- name: Deploy (webhook)
if: startsWith(github.ref, 'refs/tags/')
shell: bash
run: |
curl -d '{ "name": "tsplay.dev" }' \
-H "Authorization: $TOKEN" \
-H "Content-Type: application/json" \
-X POST "$WEBHOOK"
env:
WEBHOOK: ${{ secrets.deploy_webhook }}
TOKEN: ${{ secrets.deploy_token }}
ACTIONS_ALLOW_UNSECURE_COMMANDS: true