From c52f2811fe8eb2a657f1467d0798067a15deb395 Mon Sep 17 00:00:00 2001 From: Aditya Manthramurthy Date: Mon, 22 Mar 2021 09:36:01 -0700 Subject: [PATCH] Use single CI file based on kowainik (#162) * Use single CI file based on kowainik --- .github/workflows/ci.yml | 185 ++++++++++++++++++++++++++++ .github/workflows/haskell-cabal.yml | 122 ------------------ .github/workflows/haskell-stack.yml | 108 ---------------- .travis.yml | 61 --------- 4 files changed, 185 insertions(+), 291 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/haskell-cabal.yml delete mode 100644 .github/workflows/haskell-stack.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e58ad89 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,185 @@ +name: CI + +# Trigger the workflow on push or pull request, but only for the main branch +on: + pull_request: + push: + branches: [master] + +# Env vars for tests +env: + MINIO_ACCESS_KEY: minio + MINIO_SECRET_KEY: minio123 + MINIO_LOCAL: 1 + MINIO_SECURE: 1 + +jobs: + cabal: + name: ${{ matrix.os }} / ghc ${{ matrix.ghc }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macOS-latest, windows-latest] + cabal: ["3.2"] + ghc: + - "8.4.4" + - "8.6.5" + - "8.8.4" + - "8.10.2" + exclude: + - os: macOS-latest + ghc: 8.8.4 + - os: macOS-latest + ghc: 8.6.5 + - os: windows-latest + ghc: 8.10.2 + - os: windows-latest + ghc: 8.6.5 + + steps: + - uses: actions/checkout@v2 + if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/main' + + - uses: actions/setup-haskell@v1.1.4 + id: setup-haskell-cabal + name: Setup Haskell + with: + ghc-version: ${{ matrix.ghc }} + cabal-version: ${{ matrix.cabal }} + + - name: Configure + run: | + cabal configure --enable-tests --enable-benchmarks --test-show-details=direct -fexamples -flive-test + + - name: Freeze + run: | + cabal freeze + + - uses: actions/cache@v2.1.3 + name: Cache ~/.cabal/store + with: + path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }} + key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }} + + - name: Install dependencies + run: | + cabal build all --only-dependencies -fexamples -flive-test + + - name: Build + run: | + cabal build all -fexamples + + - name: Setup MinIO for testing (Linux) + if: matrix.os == 'ubuntu-latest' + run: | + mkdir -p /tmp/minio /tmp/minio-config/certs + cp test/cert/* /tmp/minio-config/certs/ + (cd /tmp/minio; wget -q https://dl.min.io/server/minio/release/linux-amd64/minio; chmod +x ./minio) + sudo cp /tmp/minio-config/certs/public.crt /usr/local/share/ca-certificates/ + sudo update-ca-certificates + + - name: Setup MinIO for testing (MacOS) + if: matrix.os == 'macos-latest' + run: | + mkdir -p /tmp/minio /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) + 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) + if: matrix.os == 'windows-latest' + run: | + New-Item -ItemType Directory -Path "$env:temp/minio-config/certs/" + Copy-Item -Path test\cert\* -Destination "$env:temp/minio-config/certs/" + 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 + + - name: Test (Non-Windows) + if: matrix.os != 'windows-latest' + run: | + /tmp/minio/minio server --quiet --certs-dir /tmp/minio-config/certs data1 data2 data3 data4 2>&1 > minio.log & + ghc --version + cabal --version + cabal test all -flive-test + + - name: Test (Windows) + if: matrix.os == 'windows-latest' + 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" + ghc --version + cabal --version + cabal test all -flive-test + + stack: + name: stack / ghc ${{ matrix.ghc }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + stack: ["2.3.1"] + ghc: ["8.8.4"] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v2 + if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/main' + + - uses: actions/setup-haskell@v1.1.4 + name: Setup Haskell Stack + with: + ghc-version: ${{ matrix.ghc }} + stack-version: ${{ matrix.stack }} + + - uses: actions/cache@v2.1.3 + name: Cache ~/.stack + with: + path: ~/.stack + key: ${{ runner.os }}-${{ matrix.ghc }}-stack + + - name: Install dependencies + run: | + stack build --system-ghc --test --bench --no-run-tests --no-run-benchmarks --only-dependencies + + - name: Build + run: | + stack build --system-ghc --test --bench --no-run-tests --no-run-benchmarks --flag minio-hs:examples + + - name: Setup MinIO for testing (Linux) + if: matrix.os == 'ubuntu-latest' + run: | + mkdir -p /tmp/minio /tmp/minio-config/certs + cp test/cert/* /tmp/minio-config/certs/ + (cd /tmp/minio; wget -q https://dl.min.io/server/minio/release/linux-amd64/minio; chmod +x ./minio) + sudo cp /tmp/minio-config/certs/public.crt /usr/local/share/ca-certificates/ + sudo update-ca-certificates + + - name: Setup MinIO for testing (MacOS) + if: matrix.os == 'macos-latest' + run: | + mkdir -p /tmp/minio /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) + 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) + if: matrix.os == 'windows-latest' + run: | + New-Item -ItemType Directory -Path "$env:temp/minio-config/certs/" + Copy-Item -Path test\cert\* -Destination "$env:temp/minio-config/certs/" + 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 + + - name: Test (Non-Windows) + if: matrix.os != 'windows-latest' + run: | + /tmp/minio/minio server --quiet --certs-dir /tmp/minio-config/certs data1 data2 data3 data4 2>&1 > minio.log & + ghc --version + stack --version + stack test --system-ghc --flag minio-hs:live-test + + - name: Test (Windows) + if: matrix.os == 'windows-latest' + 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" + ghc --version + cabal --version + stack test --system-ghc --flag minio-hs:live-test diff --git a/.github/workflows/haskell-cabal.yml b/.github/workflows/haskell-cabal.yml deleted file mode 100644 index afd98cf..0000000 --- a/.github/workflows/haskell-cabal.yml +++ /dev/null @@ -1,122 +0,0 @@ -name: Haskell CI (Cabal) - -on: - schedule: - # Run every weekday - - cron: '0 0 * * 1-5' - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - cabal-build: - - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - ghc: ['8.4', '8.6', '8.8', '8.10'] - cabal: ['3.2'] - os: [ubuntu-latest, macOS-latest] - experimental: [false] - include: - - ghc: '8.6' - cabal: '3.2' - os: windows-latest - experimental: false - - ghc: '8.10' - cabal: '3.2' - os: windows-latest - experimental: false - - # Appears to be buggy to build in windows with ghc 8.4 and 8.8 - - ghc: '8.4' - cabal: '3.2' - os: windows-latest - experimental: true - - ghc: '8.8' - cabal: '3.2' - os: windows-latest - experimental: true - - steps: - - uses: actions/checkout@v2 - - uses: haskell/actions/setup@v1 - with: - ghc-version: ${{ matrix.ghc }} - cabal-version: ${{ matrix.cabal }} - - - name: Cache - uses: actions/cache@v2 - env: - cache-name: cabal-cache-${{ matrix.ghc }}-${{ matrix.cabal }} - with: - path: | - ~/.cabal - ~/.stack - %appdata%\cabal - %LOCALAPPDATA%\Programs\stack - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/stack.yaml') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/stack.yaml') }} - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Before install (Linux) - if: matrix.os == 'ubuntu-latest' - run: | - mkdir -p /tmp/minio /tmp/minio-config/certs - cp test/cert/* /tmp/minio-config/certs/ - (cd /tmp/minio; wget -q https://dl.min.io/server/minio/release/linux-amd64/minio; chmod +x ./minio) - sudo cp /tmp/minio-config/certs/public.crt /usr/local/share/ca-certificates/ - sudo update-ca-certificates - - - name: Before install (MacOS) - if: matrix.os == 'macos-latest' - run: | - mkdir -p /tmp/minio /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) - sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain /tmp/minio-config/certs/public.crt - - - name: Before install (Windows) - if: matrix.os == 'windows-latest' - run: | - New-Item -ItemType Directory -Path "$env:temp/minio-config/certs/" - Copy-Item -Path test\cert\* -Destination "$env:temp/minio-config/certs/" - 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 - - - name: Install dependencies, build and test (Non-Windows) - if: matrix.os != 'windows-latest' - env: - MINIO_ACCESS_KEY: minio - MINIO_SECRET_KEY: minio123 - MINIO_LOCAL: 1 - MINIO_SECURE: 1 - continue-on-error: ${{ matrix.experimental }} - run: | - /tmp/minio/minio server --quiet --certs-dir /tmp/minio-config/certs data1 data2 data3 data4 2>&1 > minio.log & - ghc --version - cabal --version - cabal new-update - cabal new-build --enable-tests --enable-benchmarks -fexamples - cabal new-test --enable-tests -flive-test - - - name: Install dependencies, build and test (Windows) - if: matrix.os == 'windows-latest' - env: - MINIO_ACCESS_KEY: minio - MINIO_SECRET_KEY: minio123 - MINIO_LOCAL: 1 - MINIO_SECURE: 1 - continue-on-error: ${{ matrix.experimental }} - 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" - ghc --version - cabal --version - cabal new-update - cabal new-build --enable-tests --enable-benchmarks -fexamples - cabal new-test --enable-tests -flive-test diff --git a/.github/workflows/haskell-stack.yml b/.github/workflows/haskell-stack.yml deleted file mode 100644 index 9496b6e..0000000 --- a/.github/workflows/haskell-stack.yml +++ /dev/null @@ -1,108 +0,0 @@ -name: Haskell CI (Stack) - -on: - schedule: - # Run every weekday - - cron: '0 0 * * 1-5' - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - stack-build: - - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - ghc: ['8.8'] - cabal: ['3.2'] - os: [ubuntu-latest, macOS-latest] - experimental: [false] - include: - # Appears to be buggy to build in windows with ghc 8.8 - - ghc: '8.8' - cabal: '3.2' - os: windows-latest - experimental: true - - steps: - - uses: actions/checkout@v2 - - uses: haskell/actions/setup@v1 - with: - ghc-version: ${{ matrix.ghc }} - cabal-version: ${{ matrix.cabal }} - enable-stack: true - - - name: Cache - uses: actions/cache@v2 - env: - cache-name: stack-cache-${{ matrix.ghc }}-${{ matrix.cabal }} - with: - path: | - ~/.cabal - ~/.stack - %appdata%\cabal - %LOCALAPPDATA%\Programs\stack - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/stack.yaml') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/stack.yaml') }} - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Before install (Linux) - if: matrix.os == 'ubuntu-latest' - run: | - mkdir -p /tmp/minio /tmp/minio-config/certs - cp test/cert/* /tmp/minio-config/certs/ - (cd /tmp/minio; wget -q https://dl.min.io/server/minio/release/linux-amd64/minio; chmod +x ./minio) - sudo cp /tmp/minio-config/certs/public.crt /usr/local/share/ca-certificates/ - sudo update-ca-certificates - - - name: Before install (MacOS) - if: matrix.os == 'macos-latest' - run: | - mkdir -p /tmp/minio /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) - sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain /tmp/minio-config/certs/public.crt - - - name: Before install (Windows) - if: matrix.os == 'windows-latest' - run: | - New-Item -ItemType Directory -Path "$env:temp/minio-config/certs/" - Copy-Item -Path test\cert\* -Destination "$env:temp/minio-config/certs/" - 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 - - - name: Install dependencies, build and test (Non-Windows) - if: matrix.os != 'windows-latest' - env: - MINIO_ACCESS_KEY: minio - MINIO_SECRET_KEY: minio123 - MINIO_LOCAL: 1 - MINIO_SECURE: 1 - continue-on-error: ${{ matrix.experimental }} - run: | - /tmp/minio/minio server --quiet --certs-dir /tmp/minio-config/certs data1 data2 data3 data4 2>&1 > minio.log & - ghc --version - stack --version - stack build --system-ghc --test --bench --no-run-tests --no-run-benchmarks --flag minio-hs:examples - stack test --system-ghc --flag minio-hs:live-test - - - name: Install dependencies, build and test (Windows) - if: matrix.os == 'windows-latest' - env: - MINIO_ACCESS_KEY: minio - MINIO_SECRET_KEY: minio123 - MINIO_LOCAL: 1 - MINIO_SECURE: 1 - continue-on-error: ${{ matrix.experimental }} - 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" - ghc --version - stack --version - stack build --system-ghc --test --bench --no-run-tests --no-run-benchmarks --flag minio-hs:examples - stack test --system-ghc --flag minio-hs:live-test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 02e87f7..0000000 --- a/.travis.yml +++ /dev/null @@ -1,61 +0,0 @@ -sudo: true -language: haskell - -git: - depth: 5 - -cabal: "3.0" - -cache: - directories: - - "$HOME/.cabal/store" - - "$HOME/.stack" - - "$TRAVIS_BUILD_DIR/.stack-work" - -matrix: - include: - - # Cabal - - ghc: 8.4.4 - - ghc: 8.6.5 - - ghc: 8.8.3 - - # Stack - - ghc: 8.6.5 - env: STACK_YAML="$TRAVIS_BUILD_DIR/stack.yaml" - -before_install: - - sudo apt-get install devscripts - - mkdir /tmp/minio /tmp/certs - - (cd /tmp/minio; wget https://dl.min.io/server/minio/release/linux-amd64/minio; chmod +x ./minio) - - (cd /tmp/certs; openssl req -newkey rsa:2048 -nodes -keyout private.key -x509 -days 36500 -out public.crt -subj "/C=US/ST=NRW/L=Earth/O=CompanyName/OU=IT/CN=localhost/emailAddress=email@example.com") - - sudo cp /tmp/certs/public.crt /usr/local/share/ca-certificates/ - - sudo update-ca-certificates - - MINIO_ACCESS_KEY=minio MINIO_SECRET_KEY=minio123 /tmp/minio/minio server --quiet --certs-dir /tmp/certs data 2>&1 > minio.log & - -install: - - | - if [ -z "$STACK_YAML" ]; then - ghc --version - cabal --version - cabal new-update - cabal new-build --enable-tests --enable-benchmarks -fexamples - else - # install stack - curl -sSL https://get.haskellstack.org/ | sh - - # build project with stack - stack --version - stack build --system-ghc --test --bench --no-run-tests --no-run-benchmarks --flag minio-hs:examples - fi - -script: - - | - if [ -z "$STACK_YAML" ]; then - MINIO_LOCAL=1 MINIO_SECURE=1 cabal new-test --enable-tests -flive-test - else - MINIO_LOCAL=1 MINIO_SECURE=1 stack test --system-ghc --flag minio-hs:live-test - fi - -notifications: - email: false