CI: Add macos to build and update caching strategy (#194)
This commit is contained in:
parent
78a27b44bf
commit
996540bee2
109
.github/workflows/ci.yml
vendored
109
.github/workflows/ci.yml
vendored
@ -18,7 +18,6 @@ env:
|
|||||||
MINIO_ACCESS_KEY: minio
|
MINIO_ACCESS_KEY: minio
|
||||||
MINIO_SECRET_KEY: minio123
|
MINIO_SECRET_KEY: minio123
|
||||||
MINIO_LOCAL: 1
|
MINIO_LOCAL: 1
|
||||||
MINIO_SECURE: 1
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ormolu:
|
ormolu:
|
||||||
@ -35,12 +34,12 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: "Set up HLint"
|
- name: "Set up HLint"
|
||||||
uses: haskell/actions/hlint-setup@v2
|
uses: haskell-actions/hlint-setup@v2
|
||||||
with:
|
with:
|
||||||
version: "3.5"
|
version: "3.5"
|
||||||
|
|
||||||
- name: "Run HLint"
|
- name: "Run HLint"
|
||||||
uses: haskell/actions/hlint-run@v2
|
uses: haskell-actions/hlint-run@v2
|
||||||
with:
|
with:
|
||||||
path: '["src/", "test/", "examples"]'
|
path: '["src/", "test/", "examples"]'
|
||||||
fail-on: warning
|
fail-on: warning
|
||||||
@ -51,7 +50,7 @@ jobs:
|
|||||||
needs: ormolu
|
needs: ormolu
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest] # Removed macos-latest due to cert issues.
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
cabal: ["3.8", "latest"]
|
cabal: ["3.8", "latest"]
|
||||||
ghc:
|
ghc:
|
||||||
- "9.6"
|
- "9.6"
|
||||||
@ -59,49 +58,62 @@ jobs:
|
|||||||
- "9.2"
|
- "9.2"
|
||||||
- "9.0"
|
- "9.0"
|
||||||
- "8.10"
|
- "8.10"
|
||||||
# exclude:
|
exclude:
|
||||||
# - os: windows-latest
|
- os: macos-latest
|
||||||
# ghc: "9.4"
|
ghc: "8.10"
|
||||||
# cabal: "3.6"
|
- os: macos-latest
|
||||||
|
ghc: "9.0"
|
||||||
|
# Cabal 3.8 supports GHC < 9.6
|
||||||
|
- cabal: "3.8"
|
||||||
|
ghc: "9.6"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'
|
if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'
|
||||||
|
|
||||||
- uses: haskell/actions/setup@v2
|
- uses: haskell-actions/setup@v2
|
||||||
id: setup-haskell-cabal
|
id: setup
|
||||||
name: Setup Haskell
|
name: Setup Haskell
|
||||||
with:
|
with:
|
||||||
ghc-version: ${{ matrix.ghc }}
|
ghc-version: ${{ matrix.ghc }}
|
||||||
cabal-version: ${{ matrix.cabal }}
|
cabal-version: ${{ matrix.cabal }}
|
||||||
|
cabal-update: true
|
||||||
|
|
||||||
- name: Configure
|
- name: Configure
|
||||||
run: |
|
run: |
|
||||||
cabal configure --enable-tests --enable-benchmarks --test-show-details=direct -fexamples -fdev -flive-test
|
cabal configure --enable-tests --enable-benchmarks --test-show-details=direct -fexamples -fdev -flive-test
|
||||||
|
cabal build all --dry-run
|
||||||
|
# The last step generates dist-newstyle/cache/plan.json for the cache key.
|
||||||
|
|
||||||
- name: Freeze
|
- name: Restore cached dependencies
|
||||||
run: |
|
uses: actions/cache/restore@v4
|
||||||
cabal freeze
|
id: cache
|
||||||
|
env:
|
||||||
- uses: actions/cache@v3
|
key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }}
|
||||||
name: Cache ~/.cabal/packages, ~/.cabal/store and dist-newstyle
|
|
||||||
with:
|
with:
|
||||||
path: |
|
path: ${{ steps.setup.outputs.cabal-store }}
|
||||||
~/.cabal/packages
|
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
|
||||||
~/.cabal/store
|
restore-keys: ${{ env.key }}-
|
||||||
dist-newstyle
|
|
||||||
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('**/*.cabal', '**/cabal.project', '**/cabal.project.freeze') }}
|
|
||||||
restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
# If we had an exact cache hit, the dependencies will be up to date.
|
||||||
cabal build --only-dependencies
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
run: cabal build all --only-dependencies
|
||||||
|
|
||||||
|
# Cache dependencies already here, so that we do not have to rebuild them should the subsequent steps fail.
|
||||||
|
- name: Save cached dependencies
|
||||||
|
uses: actions/cache/save@v4
|
||||||
|
# If we had an exact cache hit, trying to save the cache would error because of key clash.
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
with:
|
||||||
|
path: ${{ steps.setup.outputs.cabal-store }}
|
||||||
|
key: ${{ steps.cache.outputs.cache-primary-key }}
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
cabal build
|
cabal build all
|
||||||
|
|
||||||
- name: Setup MinIO for testing (Linux)
|
- name: Setup TLS certs for MinIO for testing (Linux)
|
||||||
if: matrix.os == 'ubuntu-latest'
|
if: matrix.os == 'ubuntu-latest'
|
||||||
run: |
|
run: |
|
||||||
mkdir -p /tmp/minio /tmp/minio-config/certs
|
mkdir -p /tmp/minio /tmp/minio-config/certs
|
||||||
@ -110,13 +122,14 @@ jobs:
|
|||||||
sudo cp /tmp/minio-config/certs/public.crt /usr/local/share/ca-certificates/
|
sudo cp /tmp/minio-config/certs/public.crt /usr/local/share/ca-certificates/
|
||||||
sudo update-ca-certificates
|
sudo update-ca-certificates
|
||||||
|
|
||||||
- name: Setup MinIO for testing (MacOS)
|
## Currently disable TLS setup for MacOS due to issues in trusting it on MacOS.
|
||||||
|
- name: Setup TLS certs for MinIO for testing (MacOS)
|
||||||
if: matrix.os == 'macos-latest'
|
if: matrix.os == 'macos-latest'
|
||||||
run: |
|
run: |
|
||||||
mkdir -p /tmp/minio /tmp/minio-config/certs
|
mkdir -p /tmp/minio /tmp/minio-config/certs
|
||||||
cp test/cert/* /tmp/minio-config/certs/
|
cp test/cert/* /tmp/minio-config/certs/
|
||||||
(cd /tmp/minio; wget -q https://dl.min.io/server/minio/release/darwin-amd64/minio; chmod +x ./minio)
|
(cd /tmp/minio; wget -q https://dl.min.io/server/minio/release/darwin-amd64/minio; chmod +x ./minio)
|
||||||
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain /tmp/minio-config/certs/public.crt
|
# sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain /tmp/minio-config/certs/public.crt
|
||||||
|
|
||||||
- name: Setup MinIO for testing (Windows)
|
- name: Setup MinIO for testing (Windows)
|
||||||
if: matrix.os == 'windows-latest'
|
if: matrix.os == 'windows-latest'
|
||||||
@ -126,25 +139,42 @@ jobs:
|
|||||||
Invoke-WebRequest -Uri https://dl.minio.io/server/minio/release/windows-amd64/minio.exe -OutFile $HOME/minio.exe
|
Invoke-WebRequest -Uri https://dl.minio.io/server/minio/release/windows-amd64/minio.exe -OutFile $HOME/minio.exe
|
||||||
Import-Certificate -FilePath "$env:temp/minio-config/certs/public.crt" -CertStoreLocation Cert:\LocalMachine\Root
|
Import-Certificate -FilePath "$env:temp/minio-config/certs/public.crt" -CertStoreLocation Cert:\LocalMachine\Root
|
||||||
|
|
||||||
- name: Test (Non-Windows)
|
- name: Test (Linux)
|
||||||
if: matrix.os != 'windows-latest'
|
if: matrix.os == 'ubuntu-latest'
|
||||||
|
env:
|
||||||
|
MINIO_SECURE: 1
|
||||||
run: |
|
run: |
|
||||||
/tmp/minio/minio server --quiet --certs-dir /tmp/minio-config/certs data1 data2 data3 data4 2>&1 > minio.log &
|
/tmp/minio/minio server --quiet --certs-dir /tmp/minio-config/certs data1 data2 data3 data4 2>&1 > minio.log &
|
||||||
ghc --version
|
ghc --version
|
||||||
cabal --version
|
cabal --version
|
||||||
cabal test
|
cabal test all
|
||||||
|
|
||||||
|
- name: Test (MacOS)
|
||||||
|
if: matrix.os == 'macos-latest'
|
||||||
|
# # Leave MINIO_SECURE unset to disable TLS in tests.
|
||||||
|
# env:
|
||||||
|
# MINIO_SECURE: 1
|
||||||
|
run: |
|
||||||
|
/tmp/minio/minio server --quiet data1 data2 data3 data4 2>&1 > minio.log &
|
||||||
|
ghc --version
|
||||||
|
cabal --version
|
||||||
|
cabal test all
|
||||||
|
|
||||||
- name: Test (Windows)
|
- name: Test (Windows)
|
||||||
if: matrix.os == 'windows-latest'
|
if: matrix.os == 'windows-latest'
|
||||||
|
env:
|
||||||
|
MINIO_SECURE: 1
|
||||||
run: |
|
run: |
|
||||||
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"
|
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"
|
||||||
ghc --version
|
ghc --version
|
||||||
cabal --version
|
cabal --version
|
||||||
cabal test
|
cabal test all
|
||||||
|
|
||||||
stack:
|
stack:
|
||||||
name: stack / ghc ${{ matrix.ghc }}
|
name: stack / ghc ${{ matrix.ghc }}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
env:
|
||||||
|
MINIO_SECURE: 1
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
ghc:
|
ghc:
|
||||||
@ -159,14 +189,13 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'
|
if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'
|
||||||
|
|
||||||
- name: Install Haskell Stack
|
- uses: haskell-actions/setup@v2
|
||||||
run: |
|
with:
|
||||||
if ! which stack
|
ghc-version: ${{ matrix.ghc }}
|
||||||
then
|
enable-stack: true
|
||||||
curl -sSL https://get.haskellstack.org/ | sh
|
stack-version: "latest"
|
||||||
fi
|
|
||||||
|
|
||||||
- uses: actions/cache@v3
|
- uses: actions/cache@v4
|
||||||
name: Cache ~/.stack
|
name: Cache ~/.stack
|
||||||
with:
|
with:
|
||||||
path: ~/.stack
|
path: ~/.stack
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user