Skip to content

Commit

Permalink
ci: replace push, pull workflows with main
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmichael committed Apr 25, 2022
1 parent c2bc7df commit 75f8743
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 313 deletions.
150 changes: 78 additions & 72 deletions .github/workflows/pull.yml → .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,49 @@
# Runs after notable pushes to pull requests against master.
# master is configured to require one or more status checks corresponding to
# enabled matrix plans below (shown in github UI as "build (810, ...").
# So those must pass before the pull request can be merged.
#
# Runs unit/doc/functional/haddock/bench tests and produces optimised dynamic x64 linux binaries,
# The main hledger integration test workflow.
# Builds warning free and runs unit/doc/functional/haddock/bench tests,
# using the GHC version(s) enabled below.
#
# This was our first github workflow, and may have the most detailed notes.
# Merging to master requires that this workflow's jobs ("86" at least) have passed.

name: pull request CI
name: main CI

# This workflow runs...
on:
# Scheduled workflows run on the latest commit on the default or base branch. (master)
# on master, when manually triggered
workflow_dispatch:

# on master, on this schedule:
# schedule:
# - cron: "0 07 * * 0" # sunday midnight pacific

# on these dev branches, when pushed
push:
branches: [ simon, simon2 ]

# on pull request branches against these branches, when pushed
pull_request:
branches: [ master ]
paths:
- '.github/workflows/linux.yml'
- 'stack*.yaml'
- 'hledger-lib/**'
- 'hledger/**'
- 'hledger-ui/**'
- 'hledger-web/**'
- 'bin/*.hs'
# ignore changes to example files, though currently some func tests depend on them
- 'examples/**'
- '!**.journal'
- '!**.j'
- '!**.ledger'
- '!**.csv'
# ignore changes to doc source files
- '!**.m4'
- '!**.md'
- '!**.1'
- '!**.5'
- '!**.info'
- '!**.txt'

# also allow this workflow to be triggered manually
workflow_dispatch:
# Uncomment to run it only for changes to these paths: (but that could prevent merging)
# paths:
# - '.github/workflows/pushpull.yml'
# - 'stack*.yaml'
# - 'hledger-lib/**'
# - 'hledger/**'
# - 'hledger-ui/**'
# - 'hledger-web/**'
# - 'bin/*.hs'
# - 'examples/**'
# Or to ignore certain paths:
# # examples
# - '!**.journal'
# - '!**.j'
# - '!**.ledger'
# - '!**.csv'
# # docs
# - '!**.m4'
# - '!**.md'
# - '!**.1'
# - '!**.5'
# - '!**.info'
# - '!**.txt'

jobs:
build:
Expand All @@ -49,26 +52,25 @@ jobs:
fail-fast: false
matrix:
plan: # at least the check(s) required by master should be enabled
- { ghc: "86" , stack: "stack --stack-yaml=stack8.6.yaml" }
- { ghc: "86" , stack: "stack --stack-yaml=stack8.6.yaml" } # oldest supported ghc
# - { ghc: "88" , stack: "stack --stack-yaml=stack8.8.yaml" }
# - { ghc: "810", stack: "stack --stack-yaml=stack8.10.yaml" }
# - { ghc: "90" , stack: "stack --stack-yaml=stack.yaml" }
# - { ghc: "92" , stack: "stack --stack-yaml=stack9.2.yaml" }
# - { ghc: "92" , stack: "stack --stack-yaml=stack9.2.yaml" } # newest supported ghc

steps:

- name: Check out
uses: actions/checkout@v2
# have to fetch everything for git describe for --version
with:
fetch-depth: 0
fetch-depth: 0

- name: Print debug output
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: |
echo $GITHUB_CONTEXT
# echo "$GITHUB_SHA"
# echo "$GITHUB_REF"
# echo "$GITHUB_HEAD_REF"
Expand Down Expand Up @@ -124,6 +126,9 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.stack
# XXX if stack.yaml is a symlink, this fails with
# Error: The template is not valid. .github/workflows/push.yml (Line: 103, Col: 14): hashFiles('**.yaml') failed.
# Fail to hash files under directory '/home/runner/work/hledger/hledger'
key: ${{ runner.os }}-stack-global-${{ matrix.plan.ghc }}-${{ hashFiles('**.yaml') }}
restore-keys: |
${{ runner.os }}-stack-global-${{ matrix.plan.ghc }}
Expand Down Expand Up @@ -199,27 +204,32 @@ jobs:
env:
stack: ${{ matrix.plan.stack }}
run: |
df -h
$stack setup --install-ghc
df -h
if: env.CONTINUE

- name: Install haskell deps
env:
stack: ${{ matrix.plan.stack }}
run: |
$stack build --test --bench --only-dependencies
# --no-terminal
if: env.CONTINUE

- name: Build all hledger modules warning free, optimised and minimised, run unit/doc/bench tests
# - name: Build all hledger modules warning free, optimised and minimised, run unit/doc/bench tests
# env:
# stack: ${{ matrix.plan.stack }}
# run: |
# $stack install --test --bench --force-dirty --ghc-options=-fforce-recomp --ghc-options=-Werror --ghc-options=-split-sections --no-terminal
# # build quicker when tweaking ci: $stack install --ghc-options=-Werror --ghc-options=-split-sections --no-terminal
# # -split-sections shrinks binaries by 30% on average here
# # --pedantic --no-run-benchmarks
# if: env.CONTINUE

- name: Build all hledger modules fast, warning free, run unit/doc/bench tests
env:
stack: ${{ matrix.plan.stack }}
run: |
$stack install --test --bench --force-dirty --ghc-options=-fforce-recomp --ghc-options=-Werror --ghc-options=-split-sections --no-terminal
# build quicker when tweaking ci: $stack install --ghc-options=-Werror --ghc-options=-split-sections --no-terminal
# -split-sections shrinks binaries by 30% on average here
# --pedantic --no-run-benchmarks
$stack install --fast --force-dirty --ghc-options=-fforce-recomp --ghc-options=-Werror --test --bench
# --ghc-options=-split-sections --no-terminal
if: env.CONTINUE

- name: Install shelltestrunner
Expand Down Expand Up @@ -249,32 +259,28 @@ jobs:
# --no-print-missing-docs is 600% quieter
if: env.CONTINUE

# artifacts:
# XXX unreliable, and we don't need this for every PR; disable for now

- name: Gather executables
id: exes
run: |
mkdir tmp
cd tmp
mkdir hledger
cd hledger
cp ~/.local/bin/hledger .
cp ~/.local/bin/hledger-ui .
cp ~/.local/bin/hledger-web .
# example of setting a context variable, and an attempt to make a nice artifact version suffix.
# But a constant name is easier in some ways.
# echo "::set-output name=version::$(git branch --show-current | sed 's/-.*//')-$(git rev-parse --short HEAD)"
if: env.CONTINUE

# XXX intermittent upload failures
- name: Upload executables artifact
uses: actions/upload-artifact@v2
with:
# name: hledger-ubuntu-${{ steps.exes.outputs.version }}
name: hledger-ubuntu
path: tmp/hledger
if: env.CONTINUE
# - name: Gather executables
# id: exes
# run: |
# mkdir tmp
# cd tmp
# mkdir hledger
# cd hledger
# cp ~/.local/bin/hledger .
# cp ~/.local/bin/hledger-ui .
# cp ~/.local/bin/hledger-web .
# # how to set a context variable, and an attempt to make a nice artifact version suffix:
# # echo "::set-output name=version::$(git branch --show-current | sed 's/-.*//')-$(git rev-parse --short HEAD)"
# if: env.CONTINUE

# # XXX intermittent upload failures
# - name: Upload executables artifact
# uses: actions/upload-artifact@v2
# with:
# # name: hledger-ubuntu-${{ steps.exes.outputs.version }}
# name: hledger-ubuntu
# path: tmp/hledger
# if: env.CONTINUE



Expand Down
Loading

0 comments on commit 75f8743

Please sign in to comment.