-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ted Jenks
committed
Jan 14, 2024
0 parents
commit cc95a81
Showing
12 changed files
with
623 additions
and
0 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,15 @@ | ||
# documentation | ||
# https://docs.github.com/fr/code-security/dependabot/dependabot-security-updates/configuring-dependabot-security-updates | ||
# https://docs.github.com/fr/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
commit-message: | ||
prefix: "github-actions" | ||
include: "scope" | ||
labels: | ||
- "CI" |
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,167 @@ | ||
# documentation | ||
# https://github.com/haskell/actions | ||
# https://kodimensional.dev/github-actions | ||
|
||
# uses | ||
# - actions/checkout (3) | ||
# https://github.com/marketplace/actions/checkout | ||
# - actions/cache (3) | ||
# https://github.com/marketplace/actions/cache | ||
# - haskell/actions/setup (2) | ||
# https://github.com/haskell/actions | ||
# - softprops/action-gh-release (1) [seems no longer maintained] | ||
# https://github.com/softprops/action-gh-release | ||
# - ncipollo/release-action (1) [possible replacement] | ||
# https://github.com/ncipollo/release-action | ||
|
||
# TODO: check and add caching if needed | ||
# TODO: automatize setting program & version | ||
# TODO: option to release snapshot versions | ||
# TODO: make one workflow for each OS ? | ||
|
||
# Requirements: | ||
# - tags activating releases should begin with v (eg: v1.0.0) [checked] | ||
# - tags should only be done on "master" commits [not checked] | ||
|
||
# Notes: | ||
# - zip is removed for linux and macOS, if needed this can be added: zip -j ${{ env.archive }}.zip ${{ env.bin_path }}/${{ env.program }} | ||
# - startsWith(github.ref, 'refs/tags/v') is not working with on:push:branches:[master] | ||
# so we use on:push:tags: but then it is not checked if the branch is master/main | ||
|
||
name: CI | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
env: | ||
lts: 20.5 | ||
program: template-haskell-project-exe | ||
version: 0.1.4.0 | ||
jobs: | ||
build: | ||
name: build-${{ matrix.ghc }}-${{ matrix.stack }}-${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
ghc: ['9.2.5'] | ||
stack: ['2.9.1'] | ||
os: [ubuntu-latest, macOS-latest, windows-latest] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: stack setup | ||
uses: haskell/actions/setup@v2 | ||
with: | ||
ghc-version: ${{ matrix.ghc }} | ||
enable-stack: true | ||
stack-version: ${{ matrix.stack }} | ||
# | ||
# caches | ||
# | ||
- name: cache ~/.stack (linux and macOS) | ||
uses: actions/cache@v3 | ||
if: startsWith(matrix.os, 'windows') != true | ||
with: | ||
path: ~/.stack | ||
key: stack-${{ matrix.ghc }}-${{ matrix.stack }}-${{ env.lts }}-${{ runner.os }} | ||
- name: cache C:\sr\snapshots (windows x86) | ||
uses: actions/cache@v3 | ||
if: startsWith(matrix.os, 'windows') | ||
with: | ||
path: C:\sr\snapshots | ||
key: stack-${{ matrix.ghc }}-${{ matrix.stack }}-${{ env.lts }}-${{ runner.os }} | ||
# | ||
# building & testing | ||
# | ||
- name: install dependencies | ||
run: | | ||
stack build --system-ghc --test --bench --no-run-tests --no-run-benchmarks --only-dependencies | ||
- name: build | ||
run: | | ||
stack build --system-ghc --test --bench --no-run-tests --no-run-benchmarks | ||
- name: test | ||
run: | | ||
stack test --system-ghc | ||
# | ||
# setting os, arch, and bin_path | ||
# | ||
- name: set variables (linux x86) | ||
if: startsWith(matrix.os, 'ubuntu') | ||
run: | | ||
echo os=linux >> $GITHUB_ENV | ||
echo arch="x86_64" >> $GITHUB_ENV | ||
echo bin_path=`stack path --system-ghc --local-install-root`/bin >> $GITHUB_ENV | ||
- name: set variables (mac x86) | ||
if: startsWith(matrix.os, 'macOS') | ||
run: | | ||
echo os=osx >> $GITHUB_ENV | ||
echo arch="x86_64" >> $GITHUB_ENV | ||
echo bin_path=`stack path --system-ghc --local-install-root`/bin >> $GITHUB_ENV | ||
- name: set variables (windows) | ||
if: startsWith(matrix.os, 'windows') | ||
run: | | ||
echo "os=windows" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | ||
echo "arch=x86_64" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | ||
$pwsh_bin_path = Join-Path (& stack path --system-ghc --local-install-root) bin | ||
echo "bin_path=$pwsh_bin_path" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | ||
shell: pwsh | ||
# | ||
# setting archive name | ||
# | ||
- name: set archive name (linux and macOS) | ||
if: startsWith(matrix.os, 'windows') != true | ||
run: | | ||
echo "archive=${{ env.program }}-${{ env.version }}-${{ env.os }}.${{ env.arch }}" >> $GITHUB_ENV | ||
- name: set archive name (windows) | ||
if: startsWith(matrix.os, 'windows') | ||
run: | | ||
$pwsh_archive = $Env:program+"-"+$Env:version+"-"+$Env:os+"."+$Env:arch | ||
echo "archive=$pwsh_archive" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | ||
shell: pwsh | ||
# | ||
# make archives | ||
# | ||
- name: make archive (linux and macOS) | ||
if: startsWith(matrix.os, 'windows') != true | ||
run: | | ||
tar czf ${{ env.archive }}.tar.gz -C ${{ env.bin_path }} ${{ env.program }} | ||
echo archive ${{ env.archive }}.tar.gz created from ${{ env.bin_path }}/${{ env.program }} | ||
echo "archive_path=${{ env.archive }}.tar.gz" >> $GITHUB_ENV | ||
echo "archive_type=application/tar+gzip" >> $GITHUB_ENV | ||
- name: make archive (windows) | ||
if: startsWith(matrix.os, 'windows') | ||
run: | | ||
$file = Join-Path $Env:bin_path ($Env:program+".exe") | ||
$pwsh_archive_path = ($Env:archive+".zip") | ||
Get-ChildItem $file | Compress-Archive -DestinationPath $pwsh_archive_path | ||
echo archive ($Env:archive+".zip") created from $file | ||
echo "archive_path=$pwsh_archive_path" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | ||
echo "archive_type=application/zip" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | ||
# | ||
# release | ||
# | ||
# OLD VERSION NOT WORKING | ||
# - name: release | ||
# uses: softprops/action-gh-release@v1 | ||
# with: | ||
# # tag_name: defaults to github.ref | ||
# # name: defaults to tag name | ||
# # token: default to ${{ secrets.GITHUB_TOKEN }} | ||
# append_body: true | ||
# files: | | ||
# ${{ env.archive_path }} | ||
# NEW VERSION | ||
- name: information | ||
run: | | ||
echo ${{ env.archive_path }} | ||
echo ${{ env.archive_type }} | ||
pwd | ||
ls -al | ||
shell: bash | ||
- name: release | ||
uses: ncipollo/release-action@v1.12.0 | ||
with: | ||
allowUpdates: true | ||
artifactErrorsFailBuild: true | ||
artifacts: ${{ env.archive_path }} | ||
artifactContentType: $${{ env.archive_type }} |
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,23 @@ | ||
dist | ||
dist-* | ||
cabal-dev | ||
*.o | ||
*.hi | ||
*.chi | ||
*.chs.h | ||
*.dyn_o | ||
*.dyn_hi | ||
.hpc | ||
.hsenv | ||
.cabal-sandbox/ | ||
cabal.sandbox.config | ||
*.prof | ||
*.aux | ||
*.hp | ||
*.eventlog | ||
.stack-work/ | ||
cabal.project.local | ||
TAGS | ||
*.tix | ||
.haskell-ghc-mod.json | ||
stack.yaml.lock |
Oops, something went wrong.