-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (68 loc) · 2.59 KB
/
backend-build-dev.yaml
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
# SOURCE: https://gist.github.com/KtorZ/ee63855c893747f5156da171027793e8
name: Dev - Continuous Integration / Core (CLI)
on:
push:
branches-ignore:
- main
jobs:
backend-build-dev:
strategy:
matrix:
os: [ubuntu-latest]
defaults:
run:
working-directory: backend/team-proj-abbr
runs-on: ${{ matrix.os }}
steps:
- name: ACTIONS_ALLOW_UNSECURE_COMMANDS
id: ACTIONS_ALLOW_UNSECURE_COMMANDS
run: echo 'ACTIONS_ALLOW_UNSECURE_COMMANDS=true' >> $GITHUB_ENV
working-directory: .
- name: 💽 Install OS Packages
uses: mstksg/get-package@v1
with:
apt-get: libgmp-dev
- name: 📥 Checkout repository
uses: actions/[email protected]
- name: 🧰 Setup Stack
uses: haskell/actions/setup@v2
with:
ghc-version: '8.10.7'
enable-stack: true
stack-version: 'latest'
- name: 🔑 Cache Key
id: cache_key
run: echo ::set-output name=key::$(md5sum stack.yaml | awk '{print $1}')
- name: 💾 Cache Dependencies
id: cache
uses: actions/cache@v1
with:
path: ~/.stack
key: ${{ matrix.os }}-${{ steps.cache_key.outputs.key }}
- name: 🏷️ Variables
id: variables
run: |
echo ::set-output name=pkg_name::$(cat *.cabal | grep "name:" | sed "s/name:\s*\(.*\)/\1/")
- name: 📸 Build Snapshot
if: steps.cache.outputs.cache-hit != 'true'
run: |
stack --no-terminal test --bench --only-snapshot
- name: 🔨 Build & Test
run: |
stack --no-terminal test --bench --haddock --no-haddock-deps --no-run-benchmarks
mkdir -p dist/haddock && mv $(stack path --local-install-root)/doc/* dist/haddock
sed -i 's@href="[^"]*/doc/\([^"]*.html\)"@href="\1"@g' dist/haddock/index.html
wget -O Makefile https://gist.githubusercontent.com/KtorZ/0c7411f9bda2db1b3e0ded2ef0c40381/raw/1f818bd0385d8d917903e3f67ee3bfee3002de7a/Makefile
mkdir -p .coverage && touch .coverage/template.overlay
DESTDIR=dist/coverage make report && DESTDIR=dist/coverage make badge
env:
PKG_NAME: ${{ steps.variables.outputs.pkg_name }}
# Guide: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-first-deployment-with-github_token
- name: 📘 Publish Documentation
if: matrix.os == 'ubuntu-latest' && github.event_name == 'push'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: backend/team-proj-abbr/dist
destination_dir: dev/backend/team-proj-abbr
enable_jekyll: true