-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Cristhian Motoche <[email protected]> Co-authored-by: David Mazarro <[email protected]>
- Loading branch information
1 parent
0054efc
commit e80dc22
Showing
8 changed files
with
275 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# CI Workflows | ||
|
||
## Overview | ||
|
||
- [Build](build.yml) | ||
- Build and test Haskell code | ||
- Build Docker image | ||
- [Draft](draft.yml) | ||
- Create a GH draft release with a static binary | ||
- [Release](release.yml) | ||
- Upload the Docker image ghcr.io | ||
- Upload the package and docs to Hackage | ||
|
||
## 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/GHCR|End | ||
Build-->End | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# The present workflow was made based on the following references: | ||
# - https://github.com/actions/cache/blob/main/examples.md#haskell---cabal | ||
# - https://github.com/haskell/time/blob/master/.github/workflows/ci.yml | ||
# - https://github.com/stackbuilders/stache/blob/master/.github/workflows/ci.yaml | ||
# - https://markkarpov.com/post/github-actions-for-haskell-ci.html | ||
--- | ||
name: Build | ||
|
||
on: push | ||
|
||
concurrency: | ||
group: build-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
haskell: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: | ||
- macos-latest | ||
- ubuntu-latest | ||
ghc: | ||
- "9.0" | ||
- "8.10" | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Install dependencies (Linux) | ||
if: ${{ runner.os == 'Linux' }} | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install zsh | ||
- name: Install dependencies (macOS) | ||
if: ${{ runner.os == 'macOS' }} | ||
run: | | ||
brew update | ||
brew install zsh | ||
- name: Install Haskell tooling | ||
uses: haskell/actions/setup@v2 | ||
with: | ||
ghc-version: ${{ matrix.ghc }} | ||
cabal-version: "3.6" | ||
- name: Configure project | ||
run: cabal configure --enable-tests | ||
- name: Freeze dependencies | ||
run: cabal freeze | ||
- name: Cache dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cabal/package | ||
~/.cabal/store | ||
dist-newstyle | ||
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }} | ||
restore-keys: ${{ runner.os }}-${{ matrix.ghc }}- | ||
- name: Build project | ||
run: cabal build | ||
- name: Run tests | ||
run: cabal test | ||
- name: Check documentation | ||
run: ./script/haddock | ||
|
||
docker: | ||
uses: ./.github/workflows/reusable-docker.yml | ||
with: | ||
push: false |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# The present workflow was made based on the following references: | ||
# - https://evilmartians.com/chronicles/build-images-on-github-actions-with-docker-layer-caching | ||
# - https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md | ||
# - https://github.com/commercialhaskell/stack/blob/master/.github/workflows/integration-tests.yml | ||
--- | ||
name: Draft | ||
|
||
on: | ||
create: | ||
tags: | ||
- v* | ||
|
||
concurrency: | ||
group: draft-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Cache Docker layers | ||
uses: actions/cache@v3 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: ${{ runner.os }}-buildx- | ||
- name: Build Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
load: true | ||
tags: ${{ github.repository }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max | ||
- name: Copy static binary | ||
run: | | ||
docker run \ | ||
--entrypoint cp \ | ||
--volume $PWD/bin:/root/bin \ | ||
${{ github.repository }} \ | ||
/usr/local/bin/hap \ | ||
/root/bin/hap-${{ github.ref_name }}-linux-x86_64-bin | ||
- name: Create draft release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
bin/hap-* | ||
LICENSE | ||
draft: true | ||
- name: Move cache | ||
run: | | ||
rm -rf /tmp/.buildx-cache | ||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# 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: | ||
ghcr: | ||
uses: ./.github/workflows/reusable-docker.yml | ||
with: | ||
push: true | ||
|
||
hackage: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Install Haskell tooling | ||
uses: haskell/actions/setup@v2 | ||
with: | ||
ghc-version: "8.10" | ||
cabal-version: "3.6" | ||
- name: Freeze dependencies | ||
run: cabal freeze | ||
- name: Cache dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cabal/package | ||
~/.cabal/store | ||
dist-newstyle | ||
key: ${{ runner.os }}-${{ hashFiles('cabal.project.freeze') }} | ||
restore-keys: ${{ runner.os }}- | ||
- name: Generate a source distribution file | ||
run: cabal sdist | ||
- name: Upload package to Hackage | ||
run: | | ||
cabal upload --publish \ | ||
--username "${{ secrets.HACKAGE_USERNAME }}" \ | ||
--password "${{ secrets.HACKAGE_PASSWORD }}" \ | ||
dist-newstyle/sdist/hapistrano-*.tar.gz || \ | ||
echo "Already exists" | ||
- name: Build Haddock documentation | ||
run: cabal v2-haddock --haddock-for-hackage --enable-documentation | ||
- name: Upload Haddock docs to Hackage | ||
run: | | ||
cabal upload --publish \ | ||
--username "${{ secrets.HACKAGE_USERNAME }}" \ | ||
--password "${{ secrets.HACKAGE_PASSWORD }}" \ | ||
--documentation \ | ||
dist-newstyle/hapistrano-*-docs.tar.gz |
Oops, something went wrong.