Skip to content

Commit fcab952

Browse files
committed
feat: initial release
0 parents  commit fcab952

File tree

16 files changed

+1407
-0
lines changed

16 files changed

+1407
-0
lines changed

.github/workflows/cabal-build.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
name: cabal-build
3+
on:
4+
push:
5+
branches: main
6+
pull_request:
7+
branches: main
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build:
14+
name: ${{ matrix.os }} / ghc ${{ matrix.ghc-version }}
15+
runs-on: ${{ matrix.os }}-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: [ubuntu]
20+
ghc-version:
21+
- 9.8
22+
- 9.6
23+
- 9.4
24+
25+
include:
26+
- os: windows
27+
ghc-version: 9.6
28+
29+
- os: macos
30+
ghc-version: 9.6
31+
32+
steps:
33+
- uses: actions/checkout@v3
34+
35+
- name: Set up GHC ${{ matrix.ghc-version }}
36+
uses: haskell-actions/setup@v2
37+
id: setup
38+
with:
39+
ghc-version: ${{ matrix.ghc-version }}
40+
# Defaults, added for clarity:
41+
cabal-version: latest
42+
cabal-update: true
43+
44+
- name: Configure the build
45+
run: |
46+
cabal configure --enable-tests --enable-benchmarks --disable-documentation
47+
cabal build --dry-run
48+
# The last step generates dist-newstyle/cache/plan.json for the cache key.
49+
50+
- name: Restore cached dependencies
51+
uses: actions/cache/restore@v3
52+
id: cache
53+
env:
54+
key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }}
55+
56+
with:
57+
path: ${{ steps.setup.outputs.cabal-store }}
58+
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
59+
restore-keys: ${{ env.key }}-
60+
61+
- name: Install dependencies
62+
run: cabal build all --only-dependencies
63+
64+
# Cache dependencies already here, so that we do not have to rebuild them should the subsequent steps fail.
65+
- name: Save cached dependencies
66+
uses: actions/cache/save@v3
67+
# Caches are immutable, trying to save with the same key would error.
68+
if: ${{ steps.cache.outputs.cache-primary-key != steps.cache.outputs.cache-matched-key }}
69+
with:
70+
path: ${{ steps.setup.outputs.cabal-store }}
71+
key: ${{ steps.cache.outputs.cache-primary-key }}
72+
73+
- name: Build
74+
run: cabal build all
75+
76+
- name: Run tests
77+
run: cabal test all
78+
79+
- name: Check cabal file
80+
run: cabal check
81+
continue-on-error: true
82+
83+
- name: Build documentation
84+
run: cabal haddock all
85+
...
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
name: Conventional commits
3+
4+
on:
5+
pull_request:
6+
branches:
7+
- main
8+
9+
jobs:
10+
build:
11+
name: Conventional commits
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
- uses: webiny/[email protected]
16+
...
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
name: Semantic release
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
if: false
11+
name: Semantic release
12+
environment: main
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
persist-credentials: false
18+
19+
- name: Semantic release
20+
id: semantic
21+
uses: cycjimmy/semantic-release-action@v4
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
24+
HACKAGE_TOKEN: ${{ secrets.HACKAGE_TOKEN }}
25+
26+
with:
27+
ci: ${{ env.GITHUB_REF == 'refs/head/main' }}
28+
extra_plugins: |
29+
semantic-release-mirror-version
30+
semantic-release-hackage
31+
32+
- name: Semantic release output
33+
run: |
34+
echo dry_run: ${{ env.GITHUB_REF != 'refs/head/main' }}
35+
echo published: ${{ steps.semantic.outputs.new_release_published }}
36+
echo last_release: ${{ steps.semantic.outputs.last_release_version }}
37+
echo new_version: ${{ steps.semantic.outputs.new_release_version }}
38+
echo git_head: ${{ steps.semantic.outputs.new_release_git_head }}
39+
40+
echo release_notes:
41+
echo "${{ steps.semantic.outputs.new_release_notes }}"
42+
...

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.stack-work/
2+
*~
3+
dist-newstyle/

.releaserc.mjs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/**
2+
* @type {import('semantic-release').GlobalConfig}
3+
*/
4+
export default {
5+
branches: ["main"],
6+
tagFormat: "${version}",
7+
plugins: [
8+
"@semantic-release/commit-analyzer",
9+
"@semantic-release/release-notes-generator",
10+
[
11+
"semantic-release-mirror-version",
12+
{
13+
"fileGlob": "@(package.yaml|megaparsec-time.cabal)",
14+
"placeholderRegExp": "0.0.0-dev"
15+
}
16+
],
17+
[
18+
"@semantic-release/changelog",
19+
{
20+
changelogFile: "CHANGELOG.md",
21+
changelogTitle: "Changelog"
22+
}
23+
],
24+
[
25+
"@semantic-release/git",
26+
{
27+
assets: [
28+
"CHANGELOG.md",
29+
]
30+
}
31+
],
32+
"@semantic-release/github",
33+
[
34+
"semantic-release-hackage",
35+
{
36+
"packageName": "megaparsec-time",
37+
"versionPrefix": "0.",
38+
"publishDocumentation": true
39+
}
40+
]
41+
]
42+
}

CHANGELOG.md

Whitespace-only changes.

0 commit comments

Comments
 (0)