From 40366c5d1cb026b02ec00221dd3250412cba369f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20DOUIN?= Date: Fri, 4 Dec 2020 12:55:28 +0100 Subject: [PATCH] replace travis by gh actions --- .github/workflows/ci.yaml | 191 ++++++++++++++++++++++++++++++++++++++ .travis.yml | 59 ------------ CHANGELOG.md | 9 +- README.md | 2 +- package.yaml | 2 +- src/Procedure.hs | 2 +- 6 files changed, 202 insertions(+), 63 deletions(-) create mode 100644 .github/workflows/ci.yaml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..e3bd59b --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,191 @@ +name: CI + +on: + push: + tags: + - v* + +jobs: + unix: + strategy: + matrix: + os: + - ubuntu-latest + - macos-latest + runs-on: ${{matrix.os}} + steps: + - name: Check out + uses: actions/checkout@v2 + + - name: Cache ~/.stack folder + uses: actions/cache@v2 + with: + path: ~/.stack + key: stack-global-${{hashFiles('**.yaml')}} + restore-keys: stack-global + + - name: Cache ~/.local/bin folder + uses: actions/cache@v2 + with: + path: ~/.local/bin + key: stack-local-bin-${{hashFiles('**.yaml')}} + restore-keys: stack-local-bin + + - name: Cache .stack-work folder + uses: actions/cache@v2 + with: + path: .stack-work + key: stack-work-${{hashFiles('**.yaml')}} + restore-keys: | + stack-work + + - name: Setup Haskell + uses: actions/setup-haskell@v1.1.4 + with: + enable-stack: true + stack-version: 'latest' + ghc-version: 8.10.2 + + - name: Configure stack + run: | + mkdir -p ~/.stack ~/.local/bin + echo 'allow-newer: true' > ~/.stack/config.yaml + + - name: Build unfog + run: stack install + + - name: Compress executable + run: | + mv ~/.local/bin/unfog . + tar czf unfog.tar.gz unfog + + - name: Upload linux artifact + if: matrix.os == 'ubuntu-latest' + uses: actions/upload-artifact@v2 + with: + name: unfog-linux.tar.gz + path: unfog.tar.gz + + - name: Upload macos artifact + if: matrix.os == 'macos-latest' + uses: actions/upload-artifact@v2 + with: + name: unfog-macos.tar.gz + path: unfog.tar.gz + + windows: + runs-on: windows-latest + steps: + - name: Check out + uses: actions/checkout@v2 + + - name: Cache ~/.stack folder + uses: actions/cache@v2 + with: + path: C:\Users\runneradmin\AppData\Roaming\stack\ + key: stack-appdata-roaming-${{hashFiles('**.yaml')}} + restore-keys: stack-appdata-roaming + + - name: Cache ~/.local/bin folder + uses: actions/cache@v2 + with: + path: C:\Users\runneradmin\AppData\Local\Programs\stack\ + key: stack-appdata-local-${{hashFiles('**.yaml')}} + restore-keys: stack-appdata-local + + - name: Cache sr folder + uses: actions/cache@v2 + with: + path: C:\sr\ + key: stack-sr-${{hashFiles('**.yaml')}} + restore-keys: stack-sr + + - name: Cache .stack-work folder + uses: actions/cache@v2 + with: + path: .stack-work + key: stack-work-${{hashFiles('**.yaml')}} + restore-keys: | + stack-work + + - name: Setup Haskell + uses: actions/setup-haskell@v1.1.4 + with: + enable-stack: true + stack-version: 'latest' + ghc-version: 8.10.2 + + - name: Configure stack + run: | + if(!(Test-Path -path 'C:\sr\')) { mkdir C:\sr\ } + echo 'allow-newer: true' > C:\sr\config.yaml + + - name: Build unfog + run: stack install + + - name: Compress executable + run: | + copy C:\Users\runneradmin\AppData\Roaming\local\bin\unfog.exe . + 7z a unfog.zip unfog.exe + + - name: Upload windows artifact + uses: actions/upload-artifact@v2 + with: + name: unfog-windows.zip + path: unfog.zip + + release: + runs-on: ubuntu-latest + needs: + - unix + - windows + steps: + - name: Create release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + with: + tag_name: ${{github.ref}} + release_name: ${{github.ref}} + draft: false + prerelease: false + + - uses: actions/download-artifact@v2 + with: + name: unfog-linux.tar.gz + - name: Upload linux artifact to release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + with: + upload_url: ${{steps.create_release.outputs.upload_url}} + asset_path: unfog.tar.gz + asset_name: unfog-linux.tar.gz + asset_content_type: application/tar+gzip + + - uses: actions/download-artifact@v2 + with: + name: unfog-macos.tar.gz + - name: Upload macos artifact to release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + with: + upload_url: ${{steps.create_release.outputs.upload_url}} + asset_path: unfog.tar.gz + asset_name: unfog-macos.tar.gz + asset_content_type: application/tar+gzip + + - uses: actions/download-artifact@v2 + with: + name: unfog-windows.zip + - name: Upload windows artifact to release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + with: + upload_url: ${{steps.create_release.outputs.upload_url}} + asset_path: unfog.zip + asset_name: unfog-windows.zip + asset_content_type: application/zip diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a4ecef3..0000000 --- a/.travis.yml +++ /dev/null @@ -1,59 +0,0 @@ -language: shell -os: linux -if: tag IS present - -before_install: - - mkdir -p ${STACK_BIN} - - export PATH=${STACK_BIN}:$PATH - - travis_retry curl -sSL https://get.haskellstack.org/ | sh - - "echo 'allow-newer: true' > ${STACK_HOME}/config.yaml" - -script: - - stack test - - stack install - -jobs: - include: - - os: linux - env: - - STACK_HOME=${HOME}/.stack - - STACK_BIN=${HOME}/.local/bin - cache: - directories: - - ${STACK_HOME} - before_deploy: - - tar czf "${STACK_BIN}/unfog-${TRAVIS_OS_NAME}.tar.gz" -C "${STACK_BIN}" unfog - deploy: &deploy_base - provider: releases - token: ${GITHUB_TOKEN} - file: ${STACK_BIN}/unfog-${TRAVIS_OS_NAME}.tar.gz - draft: false - name: ${TRAVIS_TAG} - on: - tags: true - - - os: osx - env: - - STACK_HOME=${HOME}/.stack - - STACK_BIN=${HOME}/.local/bin - cache: - directories: - - ${STACK_HOME} - before_deploy: - - tar czf "${STACK_BIN}/unfog-${TRAVIS_OS_NAME}.tar.gz" -C "${STACK_BIN}" unfog - deploy: - <<: *deploy_base - - - os: windows - env: - - STACK_HOME=${HOME}/AppData/Roaming/stack - - STACK_BIN=${HOME}/AppData/Roaming/local/bin - cache: - directories: - - ${STACK_HOME} - - ${HOME}/AppData/Local/Programs/stack - before_deploy: - - mv "${STACK_BIN}/unfog" "${STACK_BIN}/unfog.exe" - - tar czf "${STACK_BIN}/unfog-${TRAVIS_OS_NAME}.tar.gz" -C "${STACK_BIN}" unfog.exe - deploy: - <<: *deploy_base diff --git a/CHANGELOG.md b/CHANGELOG.md index 87670df..2ef826c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.0.3] - 2020-12-04 + +### Changed + +- Replace Travis CI by GitHub Actions + ## [1.0.2] - 2020-12-04 ### Added @@ -232,7 +238,8 @@ First release :tada: - Linux binaries -[unreleased]: https://github.com/soywod/unfog/compare/v1.0.2...HEAD +[unreleased]: https://github.com/soywod/unfog/compare/v1.0.3...HEAD +[1.0.3]: https://github.com/soywod/unfog/compare/v1.0.2...v1.0.3 [1.0.2]: https://github.com/soywod/unfog/compare/v1.0.1...v1.0.2 [1.0.1]: https://github.com/soywod/unfog/compare/v1.0.0...v1.0.1 [1.0.0]: https://github.com/soywod/unfog/compare/v0.4.5...v1.0.0 diff --git a/README.md b/README.md index 722397b..983aa93 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ⏱ Unfog [![Build Status](https://travis-ci.org/soywod/unfog.svg?branch=v1.0.2)](https://travis-ci.org/soywod/unfog) +# ⏱ Unfog [![gh-actions](https://github.com/soywod/unfog/workflows/CI/badge.svg)](https://github.com/soywod/unfog/actions?query=workflow%3ACI) Minimalist task & time manager, written in [Haskell](https://www.haskell.org). diff --git a/package.yaml b/package.yaml index 9cb4b82..5304035 100644 --- a/package.yaml +++ b/package.yaml @@ -1,5 +1,5 @@ name: unfog -version: 1.0.2 +version: 1.0.3 github: "soywod/unfog" license: BSD3 author: "soywod" diff --git a/src/Procedure.hs b/src/Procedure.hs index 76ea393..c2df145 100644 --- a/src/Procedure.hs +++ b/src/Procedure.hs @@ -14,6 +14,6 @@ data Procedure deriving (Show, Read) handle :: Arg.Procedure -> IO () -handle (Arg.ShowVersion jsonOpt) = send (parseResponseType jsonOpt) (VersionResponse "1.0.2") +handle (Arg.ShowVersion jsonOpt) = send (parseResponseType jsonOpt) (VersionResponse "1.0.3") handle Arg.Upgrade = void $ system "curl -sSL https://raw.githubusercontent.com/soywod/unfog/master/bin/install.sh | bash" handle Arg.ClearCache = State.clearCache >> putStrLn "Cache cleared!"