Skip to content

Commit d20193c

Browse files
Set the NIGHTLY variable in nightly tests (#50)
* set the `NIGHTLY` variable in nightly tests * Workflow dispatch with the same behaviour as nightly job * also trigger when the PR talks about nightly
1 parent 1beae75 commit d20193c

File tree

1 file changed

+54
-32
lines changed

1 file changed

+54
-32
lines changed

.github/workflows/haskell-ci.yml

Lines changed: 54 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ on:
1111
- 'master'
1212
schedule:
1313
- cron: 0 0 * * *
14+
workflow_dispatch:
15+
inputs:
16+
nightly:
17+
description: Run with the same settings as a nightly build
18+
type: boolean
19+
default: false
1420

1521
concurrency:
1622
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -29,6 +35,14 @@ jobs:
2935
runs-on: ${{ matrix.os }}
3036

3137
steps:
38+
- name: Set NIGHTLY environment variable if the job was triggered by the scheduler
39+
if: "${{ github.event_name == 'schedule'
40+
|| contains(github.event.pull_request.title, 'nightly')
41+
|| contains(github.event.pull_request.title, 'NIGHTLY')
42+
|| github.event_name == 'workflow_dispatch' && github.event.inputs.nightly }}"
43+
run: |
44+
echo "NIGHTLY=true" >> $GITHUB_ENV
45+
3246
- uses: actions/checkout@v4
3347
- uses: haskell-actions/setup@v2
3448
with:
@@ -50,40 +64,48 @@ jobs:
5064
name: Stack
5165
runs-on: ubuntu-latest
5266
steps:
53-
- uses: actions/checkout@v4
67+
- name: Set NIGHTLY environment variable if the job was triggered by the scheduler
68+
if: "${{ github.event_name == 'schedule'
69+
|| contains(github.event.pull_request.title, 'nightly')
70+
|| contains(github.event.pull_request.title, 'NIGHTLY')
71+
|| github.event_name == 'workflow_dispatch' && github.event.inputs.nightly }}"
72+
run: |
73+
echo "NIGHTLY=true" >> $GITHUB_ENV
74+
75+
- uses: actions/checkout@v4
5476

55-
- uses: haskell-actions/setup@v2
56-
id: setup-haskell-stack
57-
name: Setup Haskell
58-
with:
59-
enable-stack: true
60-
stack-version: latest
61-
ghc-version: 9.6.7
77+
- uses: haskell-actions/setup@v2
78+
id: setup-haskell-stack
79+
name: Setup Haskell
80+
with:
81+
enable-stack: true
82+
stack-version: latest
83+
ghc-version: 9.6.7
6284

63-
- name: Cache
64-
id: cache
65-
uses: actions/cache@v4
66-
with:
67-
path: |
68-
${{ steps.setup-haskell-stack.outputs.stack-root }}
69-
.stack-work
70-
key: ${{ runner.os }}-stack-${{ github.sha }}
71-
restore-keys: ${{ runner.os }}-stack
85+
- name: Cache
86+
id: cache
87+
uses: actions/cache@v4
88+
with:
89+
path: |
90+
${{ steps.setup-haskell-stack.outputs.stack-root }}
91+
.stack-work
92+
key: ${{ runner.os }}-stack-${{ github.sha }}
93+
restore-keys: ${{ runner.os }}-stack
7294

73-
- name: Test
74-
run: stack test --coverage --flag constrained-generators:dev
95+
- name: Test
96+
run: stack test --coverage --flag constrained-generators:dev
7597

76-
- uses: actions/cache/save@v4
77-
with:
78-
path: |
79-
${{ steps.setup-haskell-stack.outputs.stack-root }}
80-
.stack-work
81-
key: ${{ runner.os }}-stack-${{ github.sha }}
98+
- uses: actions/cache/save@v4
99+
with:
100+
path: |
101+
${{ steps.setup-haskell-stack.outputs.stack-root }}
102+
.stack-work
103+
key: ${{ runner.os }}-stack-${{ github.sha }}
82104

83-
- name: Upload coverage report
84-
env:
85-
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
86-
run: |
87-
[ -n "${COVERALLS_REPO_TOKEN}" ]
88-
curl -L https://github.com/rubik/stack-hpc-coveralls/releases/download/v0.0.7.0/shc-Linux-X64.tar.bz2 | tar xj shc
89-
./shc --repo-token="$COVERALLS_REPO_TOKEN" --partial-coverage --fetch-coverage combined all
105+
- name: Upload coverage report
106+
env:
107+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
108+
run: |
109+
[ -n "${COVERALLS_REPO_TOKEN}" ]
110+
curl -L https://github.com/rubik/stack-hpc-coveralls/releases/download/v0.0.7.0/shc-Linux-X64.tar.bz2 | tar xj shc
111+
./shc --repo-token="$COVERALLS_REPO_TOKEN" --partial-coverage --fetch-coverage combined all

0 commit comments

Comments
 (0)