Skip to content

Commit 6d96b9d

Browse files
authored
[#337] Implement binary releases on CI (#345)
* [#337] Implement binary releases on CI Resolves #337 * Remove Windows * Compress binaries * Use strip * Fix binary path for Windows
1 parent 398f6da commit 6d96b9d

File tree

4 files changed

+122
-4
lines changed

4 files changed

+122
-4
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ jobs:
3737

3838
- name: Freeze
3939
run: |
40-
ghc --version
4140
cabal freeze
4241
4342
- uses: actions/cache@v1
@@ -112,4 +111,4 @@ jobs:
112111
- name: Run HLint
113112
run: |
114113
curl https://raw.githubusercontent.com/kowainik/relude/v0.7.0.0/.hlint.yaml -o .hlint-relude.yaml
115-
curl -sSL https://raw.github.com/ndmitchell/hlint/master/misc/run.sh | sh -s src/ test/ -h .hlint-relude.yaml
114+
curl -sSL https://raw.github.com/ndmitchell/hlint/master/misc/run.sh | sh -s src/ test/ -h .hlint-relude.yaml

.github/workflows/release.yml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
name: Stan Release
2+
3+
on:
4+
# Trigger the workflow on the new 'v*' tag created
5+
push:
6+
tags:
7+
- "v*"
8+
9+
jobs:
10+
create_release:
11+
name: Create Github Release
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check out code
15+
uses: actions/checkout@v2
16+
17+
- name: Create Release
18+
id: create_release
19+
uses: actions/create-release@v1.1.1
20+
env:
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
with:
23+
tag_name: ${{ github.ref }}
24+
release_name: Release ${{ github.ref }}
25+
draft: true
26+
prerelease: false
27+
28+
- name: Output Release URL File
29+
run: echo "${{ steps.create_release.outputs.upload_url }}" > release_url.txt
30+
- name: Save Release URL File for publish
31+
uses: actions/upload-artifact@v1
32+
with:
33+
name: release_url
34+
path: release_url.txt
35+
36+
build_artifact:
37+
needs: [create_release]
38+
name: ${{ matrix.os }}/GHC ${{ matrix.ghc }}/${{ github.ref }}
39+
runs-on: ${{ matrix.os }}
40+
strategy:
41+
matrix:
42+
os: [ubuntu-latest, macOS-latest, windows-latest]
43+
ghc:
44+
- "8.8.3"
45+
- "8.10.1"
46+
cabal: ["3.2"]
47+
exclude:
48+
- os: windows-latest
49+
ghc: 8.8.3
50+
51+
steps:
52+
- name: Check out code
53+
uses: actions/checkout@v2
54+
55+
- name: Set tag name
56+
uses: olegtarasov/get-tag@v2
57+
id: tag
58+
with:
59+
tagRegex: "v(.*)"
60+
tagRegexGroup: 1
61+
62+
- name: Setup Haskell
63+
uses: actions/setup-haskell@v1.1.1
64+
id: setup-haskell-cabal
65+
with:
66+
ghc-version: ${{ matrix.ghc }}
67+
cabal-version: ${{ matrix.cabal }}
68+
69+
- name: Freeze
70+
run: |
71+
cabal freeze
72+
73+
- name: Cache ~/.cabal/store
74+
uses: actions/cache@v1
75+
with:
76+
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
77+
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
78+
79+
- name: Build binary
80+
run: |
81+
mkdir dist
82+
cabal install exe:stan --install-method=copy --overwrite-policy=always --installdir=dist
83+
84+
- if: matrix.os == 'windows-latest'
85+
name: Set extension to .exe on Windows
86+
run: echo "::set-env name=EXT::.exe"
87+
88+
- name: Set binary path name
89+
run: echo "::set-env name=BINARY_PATH::./dist/stan${{ env.EXT }}"
90+
91+
- name: Strip binary
92+
run: strip ${{ env.BINARY_PATH }}
93+
94+
# - name: Compress binary
95+
# uses: svenstaro/upx-action@v2
96+
# with:
97+
# file: dist/stan
98+
99+
- name: Load Release URL File from release job
100+
uses: actions/download-artifact@v1
101+
with:
102+
name: release_url
103+
104+
- name: Get Release File Name & Upload URL
105+
id: get_release_info
106+
run: |
107+
echo "::set-output name=upload_url::$(cat release_url/release_url.txt)"
108+
109+
- name: Upload Release Asset
110+
id: upload-release-asset
111+
uses: actions/upload-release-asset@v1.0.1
112+
env:
113+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114+
with:
115+
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
116+
asset_path: ${{ env.BINARY_PATH }}
117+
asset_name: stan-${{ steps.tag.outputs.tag }}-${{ runner.os }}-ghc-${{ matrix.ghc }}${{ env.EXT }}
118+
asset_content_type: application/octet-stream

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
`stan` uses [PVP Versioning][1].
44
The change log is available [on GitHub][2].
55

6-
## Unreleased
6+
## 0.0.1.0 — Jul 9, 2020
77

88
* [#320](https://github.com/kowainik/stan/issues/320):
99
Add `-b|--browse` option to the `report` command.
@@ -17,6 +17,7 @@ The change log is available [on GitHub][2].
1717
* [#323](https://github.com/kowainik/stan/issues/323):
1818
Add `--json-output` option that output the results in machine readable JSON
1919
format instead. Also all other printing is turned off then.
20+
* Minor documentation improvements.
2021

2122
## 0.0.0.0
2223

stan.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 2.4
22
name: stan
3-
version: 0.0.0.0
3+
version: 0.0.1.0
44
synopsis: Haskell STatic ANalyser
55
description:
66
Stan is a Haskell __ST__atic __AN__alysis CLI tool.

0 commit comments

Comments
 (0)