Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to GitHub actions #31

Merged
merged 3 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# CI Workflows

## Overview

- [Build](build.yml)
- Build and test Haskell code
- [Draft](draft.yml)
- Create a GH draft release with a static binary
- [Release](release.yml)
- Upload the package and docs to Hackage (release candidate)

## Events

```mermaid
graph LR;
event[GH Event]-->|on push|Build;
event-->|tag created|Draft;
Draft-->|create draft release|End;
event-->|release published|Release;
Release-->|upload artifacts to Hackage (release candidate)|End;
Build-->End;
```

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Alex0jk It seems this diagram has some kind of error. It cannot be rendered. Can you double check that please?

44 changes: 44 additions & 0 deletions .github/workflows/draft.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Release package to Github

on:
push:
tags:
- 'v*'

jobs:
build-binary:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- uses: addnab/docker-run-action@v3
with:
image: utdemir/ghc-musl:v24-ghc922
options: -v ${{ github.workspace }}:/mnt
run: |
cd /mnt
sh build.static.sh

- name: Change owner before compression
run: sudo chown $USER:$USER atomic-write

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Alex0jk atomic-write doesn't provide an executable. It's just a library. We don't need any step related to uploading a binary to a GH release.


- name: Compress binary
uses: svenstaro/upx-action@v2
with:
file: atomic-write
args: --best --lzma
strip: true

- name: Rename binary file
run: cp atomic-write atomic-write-${{ github.ref_name }}-linux-x86_64-bin

- name: Create release with package assets
uses: softprops/action-gh-release@v1
with:
body_path: CHANGELOG.md
files: |
atomic-write-${{ github.ref_name }}-linux-x86_64-bin
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# The present workflow was made based on the following references:
# - https://github.com/tfausak/strive/blob/main/.github/workflows/ci.yaml
# - https://hackage.haskell.org/upload
---
name: Release

on:
release:
types:
- published

concurrency:
group: release-${{ github.ref }}
cancel-in-progress: true

jobs:
cabal-upload:
uses: stackbuilders/reusable-workflows/.github/workflows/cabal-upload.yml@main
with:
ghc_version: "8.10"
cabal_version: "3.6"
ignore_uploaded_package: true
secrets:
HACKAGE_USERNAME: ${{ secrets.HACKAGE_USERNAME }}
HACKAGE_PASSWORD: ${{ secrets.HACKAGE_PASSWORD }}
2 changes: 1 addition & 1 deletion atomic-write.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ test-suite atomic-write-test
, text
, bytestring >= 0.10.4
, hspec

build-tools: hspec-discover >= 2.0 && < 3.0

default-language: Haskell2010
Expand Down