-
Notifications
You must be signed in to change notification settings - Fork 8
102 lines (97 loc) · 3.72 KB
/
ci2.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
102
# Inspired by https://tech.freckle.com/2021/05/18/haskell-on-actions/
name: Build and test 🚀
on:
push:
branches:
- "**" # Only trigger on branches (i.e. not tags, ..)
paths-ignore:
- "docs/**" # If only documentation changes, no need to build.
jobs:
build-and-test-docker:
name: Build with Docker
runs-on: ubuntu-22.04
env:
DOCKER_AMPERSAND_IMAGE: ampersandtarski/ampersand
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Prepare for docker
run: |
echo Running on branch ${GITHUB_REF##*/}
docker version
- name: Build final image
run: docker build . --tag ${DOCKER_AMPERSAND_IMAGE}:latest --build-arg GIT_SHA=${{ github.sha }} --build-arg GIT_Branch=${{ github.ref }}
# For main branch push latest to DockerHub
- name: Login to DockerHub
if: github.ref == 'refs/heads/main'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Push latest
if: github.ref == 'refs/heads/main'
run: docker push ${DOCKER_AMPERSAND_IMAGE}:latest
build-and-test-ubuntu:
name: Build and test on ubuntu-22.04 🏗 🧪
runs-on: ubuntu-22.04
steps:
- name: Checkout project contents 📡
uses: actions/checkout@v4
- name: Set up Mariadb 🧰
uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: "mariadb-11.5"
- name: Build and test 🏗 🧪
uses: freckle/stack-action@v5 # stack-action does all these steps: dependencies, build, test.
with:
stack-build-arguments: "--copy-bins --flag ampersand:buildAll"
upgrade-stack: false
cache-save-always: true
build-and-test-macOS-13:
name: Build and test on macos-13 🏗 🧪
runs-on: macos-13
steps:
- name: Checkout project contents 📡
uses: actions/checkout@v4
- name: Set up Mariadb 🧰
uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: "mariadb-11.5"
# See issue https://github.com/freckle/stack-action/issues/80 for why we need to install stack and php as well
## run: curl -sSL https://get.haskellstack.org/ | sh
# - run: brew install php
- name: Build and test 🏗 🧪
uses: freckle/stack-action@v5
with:
stack-build-arguments: "--copy-bins --flag ampersand:buildAll"
test: false #Temporarily disable test because of bug in MariaDB with macOS. See https://jira.mariadb.org/browse/MDEV-35173
build-and-test-windows:
name: Build and test on windows-2022 🏗 🧪
runs-on: windows-2022
steps:
- name: Checkout project contents 📡
uses: actions/checkout@v4
- name: Use cache (manually) 📦 # See https://github.com/freckle/stack-cache-action/issues/5
uses: actions/cache@v4
# TODO: Cache might be done better, see for inspiration: https://github.com/godu/advent-of-code-2020/blob/46796832f59d185457a8edf8de043a54a451d688/.github/workflows/ci.yml
with:
path: |
~/.ghc
~/.stack
~/.stack-work
key: ${{ runner.os }}-stack
- name: Set up Mariadb 🧰
uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: "mariadb-11.5"
- name: Setup PHP 🧰
uses: shivammathur/setup-php@v2
with:
php-version: "8.0"
extensions: mysqli
- name: Build and test 🏗 🧪
uses: freckle/stack-action@v5
with:
stack-build-arguments: "--copy-bins --flag ampersand:buildAll"
upgrade-stack: false
cache-save-always: true