Skip to content

Commit

Permalink
[#454] Implement cross-platform GitHub Actions. (#511)
Browse files Browse the repository at this point in the history
* [#454] Upgrade GitHub Action.

* Update summoner-cli/src/Summoner/Template/GitHub.hs

Co-authored-by: hint-man[bot] <44720633+hint-man[bot]@users.noreply.github.com>

* [#454] Allow GitHub Actions for Stack only projects.

* [#454] Update stack and restore --test-show-details=direct

* [#454] Move GitHub Actions versions to variables.

* [#454] Use stack 2.5.1

* [#454] Remove unneeded newline.

* [#454] Refactor GitHub Actions excludes generation

Co-authored-by: hint-man[bot] <44720633+hint-man[bot]@users.noreply.github.com>
  • Loading branch information
gdziadkiewicz and hint-man[bot] authored Oct 23, 2020
1 parent bcf99b3 commit e632eab
Show file tree
Hide file tree
Showing 15 changed files with 268 additions and 52 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ jobs:
- "8.10.1"

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2.3.3
if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'

- uses: actions/setup-haskell@v1
- uses: actions/setup-haskell@v1.1.3
name: Setup Haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}

- uses: actions/cache@v1
- uses: actions/cache@v2.1.2
name: Cache ~/.cabal/store
with:
path: ~/.cabal/store
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ cache:

environment:
STACK_ROOT: C:\sr
STACK_VERSION: 2.1.1
STACK_VERSION: 2.5.1

matrix:
- STACK_YAML: stack.yaml
Expand Down
41 changes: 30 additions & 11 deletions summoner-cli/examples/cabal-full/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,58 @@ on:
branches: [master]

jobs:
build:
name: ghc ${{ matrix.ghc }}
runs-on: ubuntu-16.04
cabal:
name: ${{ matrix.os }} / ghc ${{ matrix.ghc }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
cabal: ["2.4"]
ghc:
- "8.4.4"
- "8.6.5"
- "8.8.4"
- "8.10.1"
exclude:
- os: macOS-latest
ghc: 8.8.4
- os: macOS-latest
ghc: 8.6.5
- os: macOS-latest
ghc: 8.4.4
- os: windows-latest
ghc: 8.8.4
- os: windows-latest
ghc: 8.6.5
- os: windows-latest
ghc: 8.4.4

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2.3.3
if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'

- uses: actions/setup-haskell@v1
- uses: actions/[email protected]
id: setup-haskell-cabal
name: Setup Haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}

- uses: actions/cache@v1
- name: Freeze
run: |
cabal v2-freeze
- uses: actions/[email protected]
name: Cache ~/.cabal/store
with:
path: ~/.cabal/store
key: ${{ runner.os }}-${{ matrix.ghc }}-cabal
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}

- name: Build
run: |
cabal v2-update
cabal v2-build --enable-tests --enable-benchmarks
cabal v2-configure --enable-tests --enable-benchmarks --test-show-details=direct
cabal v2-build all
- name: Test
run: |
cabal v2-test --enable-tests --test-show-details=direct
cabal v2-test all
5 changes: 3 additions & 2 deletions summoner-cli/examples/cabal-full/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ install:
- curl -sSL https://raw.github.com/ndmitchell/neil/master/misc/travis.sh | sh -s -- hlint .

- cabal v2-update
- cabal v2-build --enable-tests --enable-benchmarks
- cabal v2-configure --enable-tests --enable-benchmarks --test-show-details=direct
- cabal v2-build all

script:
- cabal v2-test --enable-tests --test-show-details=direct
- cabal v2-test all

notifications:
email: false
5 changes: 3 additions & 2 deletions summoner-cli/examples/cabal-full/appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ before_build:
- cabal %CABOPTS% v2-update

build_script:
- cabal %CABOPTS% v2-build --enable-tests
- cabal %CABOPTS% v2-test --enable-tests --test-show-details=direct
- cabal %CABOPTS% v2-configure --enable-tests --enable-benchmarks --test-show-details=direct
- cabal %CABOPTS% v2-build all
- cabal %CABOPTS% v2-test all
87 changes: 76 additions & 11 deletions summoner-cli/examples/full-batteries/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ on:
branches: [master]

jobs:
build:
name: ghc ${{ matrix.ghc }}
runs-on: ubuntu-16.04
cabal:
name: ${{ matrix.os }} / ghc ${{ matrix.ghc }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
cabal: ["2.4"]
ghc:
- "8.0.2"
Expand All @@ -20,28 +21,92 @@ jobs:
- "8.6.5"
- "8.8.4"
- "8.10.1"
exclude:
- os: macOS-latest
ghc: 8.8.4
- os: macOS-latest
ghc: 8.6.5
- os: macOS-latest
ghc: 8.4.4
- os: macOS-latest
ghc: 8.2.2
- os: macOS-latest
ghc: 8.0.2
- os: windows-latest
ghc: 8.8.4
- os: windows-latest
ghc: 8.6.5
- os: windows-latest
ghc: 8.4.4
- os: windows-latest
ghc: 8.2.2
- os: windows-latest
ghc: 8.0.2

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2.3.3
if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'

- uses: actions/setup-haskell@v1
- uses: actions/[email protected]
id: setup-haskell-cabal
name: Setup Haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}

- uses: actions/cache@v1
- name: Freeze
run: |
cabal v2-freeze
- uses: actions/[email protected]
name: Cache ~/.cabal/store
with:
path: ~/.cabal/store
key: ${{ runner.os }}-${{ matrix.ghc }}-cabal
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}

- name: Build
run: |
cabal v2-configure --enable-tests --enable-benchmarks --test-show-details=direct
cabal v2-build all
- name: Test
run: |
cabal v2-test all
stack:
name: stack / ghc ${{ matrix.ghc }}
runs-on: ubuntu-latest
strategy:
matrix:
stack: ["2.5.1"]
ghc:
- "8.0.2"
- "8.2.2"
- "8.4.4"
- "8.6.5"
- "8.8.4"
- "8.10.1"

steps:
- uses: actions/[email protected]
if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'

- uses: actions/[email protected]
name: Setup Haskell Stack
with:
ghc-version: ${{ matrix.ghc }}
stack-version: ${{ matrix.stack }}

- uses: actions/[email protected]
name: Cache ~/.stack
with:
path: ~/.stack
key: ${{ runner.os }}-${{ matrix.ghc }}-stack

- name: Build
run: |
cabal v2-update
cabal v2-build --enable-tests --enable-benchmarks
stack build --system-ghc --test --bench --no-run-tests --no-run-benchmarks --ghc-options=-Werror
- name: Test
run: |
cabal v2-test --enable-tests --test-show-details=direct
stack test --system-ghc
5 changes: 3 additions & 2 deletions summoner-cli/examples/full-batteries/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ install:
- |
if [ -z "$STACK_YAML" ]; then
cabal v2-update
cabal v2-build --enable-tests --enable-benchmarks
cabal v2-configure --enable-tests --enable-benchmarks --test-show-details=direct
cabal v2-build all
else
curl -sSL https://get.haskellstack.org/ | sh
stack --version
Expand All @@ -66,7 +67,7 @@ install:
script:
- |
if [ -z "$STACK_YAML" ]; then
cabal v2-test --enable-tests --test-show-details=direct
cabal v2-test all
else
stack test --system-ghc
fi
Expand Down
5 changes: 3 additions & 2 deletions summoner-cli/examples/full-batteries/appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ before_build:
- cabal %CABOPTS% v2-update

build_script:
- cabal %CABOPTS% v2-build --enable-tests
- cabal %CABOPTS% v2-test --enable-tests --test-show-details=direct
- cabal %CABOPTS% v2-configure --enable-tests --enable-benchmarks --test-show-details=direct
- cabal %CABOPTS% v2-build all
- cabal %CABOPTS% v2-test all
44 changes: 44 additions & 0 deletions summoner-cli/examples/stack-full/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CI

# Trigger the workflow on push or pull request, but only for the master branch
on:
pull_request:
push:
branches: [master]

jobs:
stack:
name: stack / ghc ${{ matrix.ghc }}
runs-on: ubuntu-latest
strategy:
matrix:
stack: ["2.5.1"]
ghc:
- "8.4.4"
- "8.6.5"
- "8.8.4"
- "8.10.1"

steps:
- uses: actions/[email protected]
if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'

- uses: actions/[email protected]
name: Setup Haskell Stack
with:
ghc-version: ${{ matrix.ghc }}
stack-version: ${{ matrix.stack }}

- uses: actions/[email protected]
name: Cache ~/.stack
with:
path: ~/.stack
key: ${{ runner.os }}-${{ matrix.ghc }}-stack

- name: Build
run: |
stack build --system-ghc --test --bench --no-run-tests --no-run-benchmarks --ghc-options=-Werror
- name: Test
run: |
stack test --system-ghc
1 change: 1 addition & 0 deletions summoner-cli/examples/stack-full/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# stack-full

[![GitHub CI](https://github.com/kowainik/stack-full/workflows/CI/badge.svg)](https://github.com/kowainik/stack-full/actions)
[![Build status](https://img.shields.io/travis/kowainik/stack-full.svg?logo=travis)](https://travis-ci.com/kowainik/stack-full)
[![Windows build status](https://ci.appveyor.com/api/projects/status/github/kowainik/stack-full?branch=master&svg=true)](https://ci.appveyor.com/project/kowainik/stack-full)
[![Hackage](https://img.shields.io/hackage/v/stack-full.svg?logo=haskell)](https://hackage.haskell.org/package/stack-full)
Expand Down
2 changes: 1 addition & 1 deletion summoner-cli/examples/stack-full/appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ branches:

environment:
STACK_ROOT: C:\sr
STACK_VERSION: 2.1.1
STACK_VERSION: 2.5.1

# Workaround a gnarly bug https://github.com/haskell/cabal/issues/5386
# See: https://www.fpcomplete.com/blog/2018/06/sed-a-debugging-story
Expand Down
5 changes: 5 additions & 0 deletions summoner-cli/src/Summoner/Default.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ This module contains some default values to use.
module Summoner.Default
( defaultGHC
, defaultCabal
, defaultStack
, defaultLicenseName
, defaultOwner
, defaultFullName
Expand Down Expand Up @@ -42,6 +43,10 @@ defaultGHC = maxBound
defaultCabal :: Text
defaultCabal = "2.4"

-- | Default version of the Stack.
defaultStack :: Text
defaultStack = "2.5.1"

defaultLicenseName :: LicenseName
defaultLicenseName = MIT

Expand Down
2 changes: 1 addition & 1 deletion summoner-cli/src/Summoner/Project.hs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ generateProjectInteractive connectMode projectName ConfigP{..} = do
(settingsGitHub && not settingsNoUpload)
(YesNoPrompt "private repository" "Create as a private repository (Requires a GitHub private repo plan)?")
cPrivate
settingsGhActions <- decisionIf (settingsCabal && settingsGitHub) (mkDefaultYesNoPrompt "GitHub Actions CI integration") cGhActions
settingsGhActions <- decisionIf settingsGitHub (mkDefaultYesNoPrompt "GitHub Actions CI integration") cGhActions
settingsTravis <- decisionIf settingsGitHub (mkDefaultYesNoPrompt "Travis CI integration") cTravis
settingsAppVeyor <- decisionIf settingsGitHub (mkDefaultYesNoPrompt "AppVeyor CI integration") cAppVey
settingsIsLib <- promptDecisionToBool cLib (mkDefaultYesNoPrompt "library target")
Expand Down
Loading

0 comments on commit e632eab

Please sign in to comment.