-
Notifications
You must be signed in to change notification settings - Fork 14
132 lines (114 loc) · 3.41 KB
/
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Build and Test
on:
push:
defaults:
run:
shell: bash
jobs:
test:
name: Build and Test
runs-on: ubuntu-latest
strategy:
max-parallel: 5
matrix:
pg-version: ["pg12", "pg13", "pg14", "pg15", "pg16"]
stack-yaml: ["stack-lts-18.28-ghc-8.10.7.yml","stack-lts-19.33-ghc-9.0.2.yml","stack-lts-20.26-ghc-9.2.8.yml","stack-nightly-2023-10-01-ghc-9.6.3.yml","stack.yml"]
permissions:
packages: write
contents: read
actions: read
steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@v3
- name: Cache
uses: actions/cache@v3
env:
cache-version: build-v2
with:
key: ${{ env.cache-version }}-${{ hashFiles('orville-postgresql/stack*.yml') }}-${{ hashFiles('orville-postgresql/package.yaml') }}
restore-keys: |
${{ env.cache-version }}-
path: |
./stack-root
- name: Build dev environment
run: |
set -e
cd orville-postgresql
docker-compose build -q
- name: Run Tests
run: |
set -e
cd orville-postgresql
PG_VERSION=${{ matrix.pg-version }}
cp compose.override.github.yml compose.override.yml
docker-compose run \
--rm \
dev \
stack --stack-yaml ${{ matrix.stack-yaml }} test \
--ghc-options=-j --flag orville-postgresql:ci
formatting-check:
name: Formatting Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache
uses: actions/cache@v3
env:
cache-version: format-v1
with:
key: ${{ env.cache-version }}-${{ hashFiles('orville-postgresql/stack*.yml') }}-${{ hashFiles('orville-postgresql/package.yaml') }}
restore-keys: |
${{ env.cache-version }}-
path: |
./stack-root
- name: Build dev environment
run: |
set -e
cd orville-postgresql
docker-compose build -q
- name: Format and Check for Diff
run: |
set -e
cd orville-postgresql
cp compose.override.github.yml compose.override.yml
docker-compose run \
--rm \
dev \
sh -c ./scripts/format-repo.sh
sh -c scripts/format-check-ci.sh
cabal-check:
name: Cabal Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache
uses: actions/cache@v3
env:
cache-version: format-v1
with:
key: ${{ env.cache-version }}-${{ hashFiles('orville-postgresql/stack*.yml') }}-${{ hashFiles('orville-postgresql/package.yaml') }}
restore-keys: |
${{ env.cache-version }}-
path: |
./stack-root
- name: Build dev environment
run: |
set -e
cd orville-postgresql
docker-compose build -q
- name: Format and Check for Diff
run: |
set -e
cd orville-postgresql
cp compose.override.github.yml compose.override.yml
docker-compose run \
--rm \
dev \
cabal check