@@ -0,0 +1,185 @@
1+name: CI
2+
3+# Trigger the workflow on push or pull request, but only for the main branch
4+on:
5+ pull_request:
6+ push:
7+ branches: [master]
8+
9+# Env vars for tests
10+env:
11+ MINIO_ACCESS_KEY: minio
12+ MINIO_SECRET_KEY: minio123
13+ MINIO_LOCAL: 1
14+ MINIO_SECURE: 1
15+
16+jobs:
17+ cabal:
18+ name: ${{ matrix.os }} / ghc ${{ matrix.ghc }}
19+ runs-on: ${{ matrix.os }}
20+ strategy:
21+ matrix:
22+ os: [ubuntu-latest, macOS-latest, windows-latest]
23+ cabal: ["3.2"]
24+ ghc:
25+ - "8.4.4"
26+ - "8.6.5"
27+ - "8.8.4"
28+ - "8.10.2"
29+ exclude:
30+ - os: macOS-latest
31+ ghc: 8.8.4
32+ - os: macOS-latest
33+ ghc: 8.6.5
34+ - os: windows-latest
35+ ghc: 8.10.2
36+ - os: windows-latest
37+ ghc: 8.6.5
38+
39+ steps:
40+ - uses: actions/checkout@v2
41+ if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/main'
42+
43+ - uses: actions/setup-haskell@v1.1.4
44+ id: setup-haskell-cabal
45+ name: Setup Haskell
46+ with:
47+ ghc-version: ${{ matrix.ghc }}
48+ cabal-version: ${{ matrix.cabal }}
49+
50+ - name: Configure
51+ run: |
52+ cabal configure --enable-tests --enable-benchmarks --test-show-details=direct -fexamples -flive-test
53+
54+ - name: Freeze
55+ run: |
56+ cabal freeze
57+
58+ - uses: actions/cache@v2.1.3
59+ name: Cache ~/.cabal/store
60+ with:
61+ path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
62+ key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
63+
64+ - name: Install dependencies
65+ run: |
66+ cabal build all --only-dependencies -fexamples -flive-test
67+
68+ - name: Build
69+ run: |
70+ cabal build all -fexamples
71+
72+ - name: Setup MinIO for testing (Linux)
73+ if: matrix.os == 'ubuntu-latest'
74+ run: |
75+ mkdir -p /tmp/minio /tmp/minio-config/certs
76+ cp test/cert/* /tmp/minio-config/certs/
77+ (cd /tmp/minio; wget -q https://dl.min.io/server/minio/release/linux-amd64/minio; chmod +x ./minio)
78+ sudo cp /tmp/minio-config/certs/public.crt /usr/local/share/ca-certificates/
79+ sudo update-ca-certificates
80+
81+ - name: Setup MinIO for testing (MacOS)
82+ if: matrix.os == 'macos-latest'
83+ run: |
84+ mkdir -p /tmp/minio /tmp/minio-config/certs
85+ cp test/cert/* /tmp/minio-config/certs/
86+ (cd /tmp/minio; wget -q https://dl.min.io/server/minio/release/darwin-amd64/minio; chmod +x ./minio)
87+ sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain /tmp/minio-config/certs/public.crt
88+
89+ - name: Setup MinIO for testing (Windows)
90+ if: matrix.os == 'windows-latest'
91+ run: |
92+ New-Item -ItemType Directory -Path "$env:temp/minio-config/certs/"
93+ Copy-Item -Path test\cert\* -Destination "$env:temp/minio-config/certs/"
94+ Invoke-WebRequest -Uri https://dl.minio.io/server/minio/release/windows-amd64/minio.exe -OutFile $HOME/minio.exe
95+ Import-Certificate -FilePath "$env:temp/minio-config/certs/public.crt" -CertStoreLocation Cert:\LocalMachine\Root
96+
97+ - name: Test (Non-Windows)
98+ if: matrix.os != 'windows-latest'
99+ run: |
100+ /tmp/minio/minio server --quiet --certs-dir /tmp/minio-config/certs data1 data2 data3 data4 2>&1 > minio.log &
101+ ghc --version
102+ cabal --version
103+ cabal test all -flive-test
104+
105+ - name: Test (Windows)
106+ if: matrix.os == 'windows-latest'
107+ run: |
108+ Start-Process -NoNewWindow -FilePath "$HOME/minio.exe" -ArgumentList "--certs-dir", "$env:temp/minio-config/certs", "server", "$env:temp/data1", "$env:temp/data2", "$env:temp/data3", "$env:temp/data4"
109+ ghc --version
110+ cabal --version
111+ cabal test all -flive-test
112+
113+ stack:
114+ name: stack / ghc ${{ matrix.ghc }}
115+ runs-on: ${{ matrix.os }}
116+ strategy:
117+ matrix:
118+ stack: ["2.3.1"]
119+ ghc: ["8.8.4"]
120+ os: [ubuntu-latest]
121+
122+ steps:
123+ - uses: actions/checkout@v2
124+ if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/main'
125+
126+ - uses: actions/setup-haskell@v1.1.4
127+ name: Setup Haskell Stack
128+ with:
129+ ghc-version: ${{ matrix.ghc }}
130+ stack-version: ${{ matrix.stack }}
131+
132+ - uses: actions/cache@v2.1.3
133+ name: Cache ~/.stack
134+ with:
135+ path: ~/.stack
136+ key: ${{ runner.os }}-${{ matrix.ghc }}-stack
137+
138+ - name: Install dependencies
139+ run: |
140+ stack build --system-ghc --test --bench --no-run-tests --no-run-benchmarks --only-dependencies
141+
142+ - name: Build
143+ run: |
144+ stack build --system-ghc --test --bench --no-run-tests --no-run-benchmarks --flag minio-hs:examples
145+
146+ - name: Setup MinIO for testing (Linux)
147+ if: matrix.os == 'ubuntu-latest'
148+ run: |
149+ mkdir -p /tmp/minio /tmp/minio-config/certs
150+ cp test/cert/* /tmp/minio-config/certs/
151+ (cd /tmp/minio; wget -q https://dl.min.io/server/minio/release/linux-amd64/minio; chmod +x ./minio)
152+ sudo cp /tmp/minio-config/certs/public.crt /usr/local/share/ca-certificates/
153+ sudo update-ca-certificates
154+
155+ - name: Setup MinIO for testing (MacOS)
156+ if: matrix.os == 'macos-latest'
157+ run: |
158+ mkdir -p /tmp/minio /tmp/minio-config/certs
159+ cp test/cert/* /tmp/minio-config/certs/
160+ (cd /tmp/minio; wget -q https://dl.min.io/server/minio/release/darwin-amd64/minio; chmod +x ./minio)
161+ sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain /tmp/minio-config/certs/public.crt
162+
163+ - name: Setup MinIO for testing (Windows)
164+ if: matrix.os == 'windows-latest'
165+ run: |
166+ New-Item -ItemType Directory -Path "$env:temp/minio-config/certs/"
167+ Copy-Item -Path test\cert\* -Destination "$env:temp/minio-config/certs/"
168+ Invoke-WebRequest -Uri https://dl.minio.io/server/minio/release/windows-amd64/minio.exe -OutFile $HOME/minio.exe
169+ Import-Certificate -FilePath "$env:temp/minio-config/certs/public.crt" -CertStoreLocation Cert:\LocalMachine\Root
170+
171+ - name: Test (Non-Windows)
172+ if: matrix.os != 'windows-latest'
173+ run: |
174+ /tmp/minio/minio server --quiet --certs-dir /tmp/minio-config/certs data1 data2 data3 data4 2>&1 > minio.log &
175+ ghc --version
176+ stack --version
177+ stack test --system-ghc --flag minio-hs:live-test
178+
179+ - name: Test (Windows)
180+ if: matrix.os == 'windows-latest'
181+ run: |
182+ Start-Process -NoNewWindow -FilePath "$HOME/minio.exe" -ArgumentList "--certs-dir", "$env:temp/minio-config/certs", "server", "$env:temp/data1", "$env:temp/data2", "$env:temp/data3", "$env:temp/data4"
183+ ghc --version
184+ cabal --version
185+ stack test --system-ghc --flag minio-hs:live-test