Skip to content

Commit

Permalink
replace travis by gh actions
Browse files Browse the repository at this point in the history
  • Loading branch information
soywod committed Dec 5, 2020
1 parent 3083f48 commit 40366c5
Show file tree
Hide file tree
Showing 6 changed files with 202 additions and 63 deletions.
191 changes: 191 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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/[email protected]
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
59 changes: 0 additions & 59 deletions .travis.yml

This file was deleted.

9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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).

Expand Down
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: unfog
version: 1.0.2
version: 1.0.3
github: "soywod/unfog"
license: BSD3
author: "soywod"
Expand Down
2 changes: 1 addition & 1 deletion src/Procedure.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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!"

0 comments on commit 40366c5

Please sign in to comment.