From f5fa8713adef1cc2bfadb1967a86a234f5d095a0 Mon Sep 17 00:00:00 2001 From: Esteban Ibarra Date: Mon, 31 May 2021 08:57:47 -0500 Subject: [PATCH] Move to GH actions and add auth step for docker (#158) --- .github/workflows/build-and-test.yml | 67 ++++++++++++++++++++++++++++ .travis.yml | 51 --------------------- README.md | 6 +-- 3 files changed, 70 insertions(+), 54 deletions(-) create mode 100644 .github/workflows/build-and-test.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000..16d853b --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,67 @@ +name: Build and Test +on: + push: + branches: + - master + pull_request: + types: + - opened + - synchronize +jobs: + build-and-test: + strategy: + matrix: + ghc: ["8.0.2", "8.2.2", "8.4.4", "8.6.5", "8.8.3", "8.10.1"] + os: [ubuntu-latest] + include: + - os: macos-latest + ghc: "8.10.1" + - os: ubuntu-16.04 + ghc: "7.10.3" + + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - name: Install Zsh + run: | + if [ "$RUNNER_OS" == "Linux" ]; then + sudo apt-get update + sudo apt-get install zsh + else + brew update + brew install zsh + fi + - uses: haskell/actions/setup@v1 + id: setup-haskell-cabal + with: + ghc-version: ${{ matrix.ghc }} + cabal-version: "3.4" + - run: cabal update + - run: cabal freeze --enable-tests + - uses: actions/cache@v2 + with: + path: | + ${{ steps.setup-haskell-cabal.outputs.cabal-store }} + dist-newstyle + key: dependencies-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }} + restore-keys: | + dependencies-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }} + dependencies-${{ runner.os }}-${{ matrix.ghc }}- + - name: Compile dependencies + run: cabal build --only-dependencies + - name: Compile project + run: cabal build --enable-tests + - run: cabal test --enable-tests + - run: cabal haddock | grep "100%" | wc -l | grep -G "[45]" # Fixes issue with different haddock coverage with different ghc versions https://github.com/haskell/haddock/issues/123 + - run: cabal sdist + - if: matrix.ghc == '8.0.2' + name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - if: matrix.ghc == '8.0.2' + name: Dockerize + run: | + docker build . -t hapistrano + docker run --rm hapistrano --version diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9ed222b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,51 +0,0 @@ -language: c - -sudo: false - -services: - - docker - -cache: - directories: - - ~/.ghc - - ~/.cabal - -matrix: - include: - - env: CABALVER=3.0 GHCVER=7.10.3 - addons: {apt: {packages: [cabal-install-3.0,ghc-7.10.3,zsh],sources: [hvr-ghc]}} - - env: CABALVER=3.0 GHCVER=8.0.2 - addons: {apt: {packages: [cabal-install-3.0,ghc-8.0.2,zsh], sources: [hvr-ghc]}} - - env: CABALVER=3.0 GHCVER=8.2.2 - addons: {apt: {packages: [cabal-install-3.0,ghc-8.2.2,zsh], sources: [hvr-ghc]}} - - env: CABALVER=3.0 GHCVER=8.4.4 - addons: {apt: {packages: [cabal-install-3.0,ghc-8.4.4,zsh], sources: [hvr-ghc]}} - - env: CABALVER=3.0 GHCVER=8.6.5 - addons: {apt: {packages: [cabal-install-3.0,ghc-8.6.5,zsh], sources: [hvr-ghc]}} - - env: CABALVER=3.0 GHCVER=8.8.3 - addons: {apt: {packages: [cabal-install-3.0,ghc-8.8.3,zsh], sources: [hvr-ghc]}} - - env: CABALVER=3.0 GHCVER=8.10.1 - addons: {apt: {packages: [cabal-install-3.0,ghc-8.10.1,zsh], sources: [hvr-ghc]}} - - os: osx - osx_image: xcode12 - -before_install: - - if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update && brew install ghc cabal-install zsh; fi - -install: - - zsh --version - - cabal --version - - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]" - - travis_retry cabal update - -script: - - cabal build --enable-tests - - cabal test --enable-tests - - cabal sdist - - cabal haddock | grep "100%" | wc -l | grep -G "[45]" # Fixes issue with different haddock coverage with different ghc versions https://github.com/haskell/haddock/issues/123 - # There is a single Docker image, there are no variants for different versions of GHC - - if [[ "$GHCVER" == "8.0.2" ]]; then docker build . -t hapistrano; docker run --rm hapistrano --version; fi - -notifications: - email: false diff --git a/README.md b/README.md index 28a1f7e..238202e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.org/stackbuilders/hapistrano.svg?branch=master)](https://travis-ci.org/stackbuilders/hapistrano) +[![Build and Test](https://github.com/stackbuilders/hapistrano/actions/workflows/build-and-test.yml/badge.svg?branch=master)](https://github.com/stackbuilders/hapistrano/actions/workflows/build-and-test.yml) [![Hackage version](https://img.shields.io/hackage/v/hapistrano.svg)](http://hackage.haskell.org/package/hapistrano) [![Docker Hub](https://img.shields.io/docker/build/stackbuilders/hapistrano.svg?style=flat)](https://hub.docker.com/r/stackbuilders/hapistrano) @@ -15,8 +15,8 @@ * [Nix](#nix) * [License](#license) * [Contributing](#contributing) - - + + # Hapistrano Hapistrano is a deployment library for Haskell applications similar to