Reorganise GH workflows

This commit is contained in:
Andrea Bedini 2023-09-14 12:14:39 +08:00 committed by Andrea Bedini
parent c11fe72425
commit 1c06741cc8
4 changed files with 33 additions and 98 deletions

View File

@ -1,14 +0,0 @@
name: Check code formatting
on:
pull_request:
jobs:
build:
runs-on:
- ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v22
- run: nix develop --command fourmolu -m check .

View File

@ -1,81 +0,0 @@
name: Haskell CI
on:
push:
branches:
- main
tags:
- v*
pull_request:
jobs:
build:
runs-on:
- ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Haskell
id: setup-haskell
uses: haskell/actions/setup@v1
with:
ghc-version: '8.10.7'
- name: Cache
uses: actions/cache@v1
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: ${{ runner.os }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-
- name: Build dependencies
run: cabal build --only-dependencies
- name: Build
run: cabal build
- name: Test
run: cabal test
- name: Copy artifacts
run: |
mkdir ${{ github.workspace }}/build-artifacts
cabal install --install-method=copy --installdir=${{ github.workspace }}/build-artifacts
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: build-artifact-${{ runner.os }}
path: ${{ github.workspace }}/build-artifacts
if-no-files-found: error
create-release:
if: startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download build artifact
uses: actions/download-artifact@v3
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Tag artifacts by os (only Linux for now)
mkdir release-artifacts
for path in build-artifact-Linux/*; do
name=${path##*/}
cp $path release-artifacts/$name-Linux
done
# Strip binaries
strip release-artifacts/*
gh release create ${{ github.ref_name }} \
--repo ${{ github.repository }} --draft --generate-notes \
release-artifacts/*

View File

@ -7,6 +7,27 @@ on:
pull_request:
jobs:
format:
runs-on:
- ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: DeterminateSystems/magic-nix-cache-action@v2
- uses: cachix/cachix-action@v12
with:
name: foliage
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix develop --accept-flake-config --command fourmolu -m check .
build:
runs-on:
- ubuntu-latest

View File

@ -11,11 +11,19 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Nix
uses: cachix/install-nix-action@v19
uses: DeterminateSystems/nix-installer-action@v4
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: DeterminateSystems/magic-nix-cache-action@v2
- uses: cachix/cachix-action@v12
with:
name: foliage
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Update flake.lock
uses: DeterminateSystems/update-flake-lock@v16
with:
@ -23,5 +31,6 @@ jobs:
pr-labels: | # Labels to be set on the PR
dependencies
automated
- name: Print PR number
run: echo Opened pull request ${{ steps.update.outputs.pull-request-number }}.