Skip to content

Bump CI for GHC 9.6 to GHC 9.6.6 #205

Bump CI for GHC 9.6 to GHC 9.6.6

Bump CI for GHC 9.6 to GHC 9.6.6 #205

Workflow file for this run

name: Build by Stack
on:
push:
branches:
- master
- ci*
tags:
- v*
pull_request:
branches:
- master
- ci*
workflow_dispatch:
# For making a release, we need write permissions.
# TODO: if we split out a release job from the build job, we could make permissions more fine-grained.
permissions:
contents: write
jobs:
## Release preparation
##########################################################################
# From: https://github.com/RobLoach/node-raylib/blob/aca2956e9ed283e5e91b1c8f08fafd943b5d6344/.github/workflows/release.yml
create_release:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
# outputs:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- uses: actions/checkout@v4
# - name: Create release
# id: create_release
# uses: actions/create-release@v1
# with:
# draft: false
# prerelease: false
# release_name: fix-whitespace ${{ github.ref }}
# tag_name: ${{ github.ref }}
# # body: fix-whitespace binary release created from ${{ github.ref }}
# env:
# GITHUB_TOKEN: ${{ github.token }}
- name: Source tarball creation
run: |
cabal sdist
DIST_TGZ_PATH=$(cabal sdist | tail -1)
DIST_TGZ_NAME=$(basename "${DIST_TGZ_PATH}")
echo "DIST_TGZ_PATH=${DIST_TGZ_PATH}" >> "${GITHUB_ENV}"
echo "DIST_TGZ_NAME=${DIST_TGZ_NAME}" >> "${GITHUB_ENV}"
# - name: Source tarball release
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ github.token }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: ${{ env.DIST_TGZ_PATH }}
# asset_name: ${{ env.DIST_TGZ_NAME }}
# asset_content_type: application/octet-stream
- name: Create release, upload source tarball
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
gh release create ${{ github.ref }} "${{ env.DIST_TGZ_PATH }}#${{ env.DIST_TGZ_NAME }}" --title "fix-whitespace ${{ github.ref }}" --generate-notes
build:
# Run this job even if the previous was skipped.
if: ${{ !failure() }}
runs-on: ${{ matrix.os }}
needs: create_release
strategy:
matrix:
os: [ubuntu-latest]
ghc-ver: ['9.10', '9.8', '9.6', '9.4', '9.2.8', '9.0.2', '8.10.7', '8.8.4', '8.6.5', '8.4.4']
include:
- os: windows-latest
ghc-ver: '9.10'
- os: macos-latest
ghc-ver: '9.10'
fail-fast: false
env:
ARGS: "--stack-yaml stack-${{ matrix.ghc-ver }}.yaml --no-terminal --system-ghc"
# Needed for Windows to make piping (... >> ...) and evaluation ( $(...) ) work.
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- uses: haskell-actions/setup@v2
id: setup
with:
ghc-version: ${{ matrix.ghc-ver }}
stack-version: 'latest'
enable-stack: true
- name: Restore cache dependencies
uses: actions/cache/restore@v4
id: cache
env:
key: ${{ runner.os }}-stack-${{ steps.setup.outputs.stack-version }}-ghc-${{ steps.setup.outputs.ghc-version }}
with:
path: ${{ steps.setup.outputs.stack-root }}
# # A unique cache is used for each stack.yaml.
# key: ${{ env.key }}-${{ hashFiles(format('stack-{0}.yaml', matrix.ghc-ver)) }}
# Use simpler key scheme as we should not run out of cache due to the low frequency of PRs.
key: ${{ env.key }}-commit-${{ github.sha }}
# Let us restore caches from the same GHC version, at the risk of accumulating some cruft from older resolvers.
restore-keys: ${{ env.key }}-
- name: Install dependencies
# if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: |
stack build ${ARGS} --only-dependencies
- name: Build fix-whitespace
run: |
stack build ${ARGS}
- name: Check the whitespace issue
run: |
stack exec ${ARGS} -- fix-whitespace --check
- name: Cache dependencies
uses: actions/cache/save@v4
if: always() && steps.cache.outputs.cache-hit != 'true'
with:
path: ${{ steps.setup.outputs.stack-root }}
key: ${{ steps.cache.outputs.cache-primary-key }}
- name: Get fix-whitespace version
run: |
FIXW_EXE=$(stack path --local-install-root ${ARGS})/bin/fix-whitespace
FIXW_VERSION=$("${FIXW_EXE}" --version)
# Save env variables for the next steps
echo "FIXW_EXE=${FIXW_EXE}" >> "${GITHUB_ENV}"
echo "FIXW_VERSION=${FIXW_VERSION}" >> "${GITHUB_ENV}"
## Release
########################################################################
# - name: Source tarball creation
# # Conditional to ensure this deployment is only run once per action.
# if: >-
# startsWith(github.ref, 'refs/tags/v')
# && matrix.ghc-ver == '9.10'
# run: |
# DIST_TGZ=$(cabal sdist | tail -1)
# echo "DIST_TGZ=${DIST_TGZ}" >> "${GITHUB_ENV}"
# - name: Source tarball release
# if: >-
# startsWith(github.ref, 'refs/tags/v')
# && matrix.ghc-ver == '9.10'
# # uses: softprops/action-gh-release@v1
# # with:
# # draft: true
# # prerelease: true
# # files: |
# # ${{ env.DIST_TGZ }}
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ github.token }}
# with:
# upload_url: ${{ needs.create_release.outputs.upload_url }}
# asset_path: ${{ env.DIST_TGZ }}
# asset_name: ${{ env.DIST_TGZ }}
# asset_content_type: application/octet-stream
- name: Linux release preparation
if: >-
startsWith(github.ref, 'refs/tags/v')
&& runner.os == 'Linux'
&& matrix.ghc-ver == '9.10'
run: |
FIXW_BIN=fix-whitespace-${FIXW_VERSION}-linux.binary
cp -p "${FIXW_EXE}" "${FIXW_BIN}"
# Save env variables for the next step
echo "FIXW_BIN=${FIXW_BIN}" >> "${GITHUB_ENV}"
# - name: Linux release
# if: >-
# startsWith(github.ref, 'refs/tags/v')
# && runner.os == 'Linux'
# && matrix.ghc-ver == '9.10'
# # uses: softprops/action-gh-release@v1
# # with:
# # draft: true
# # prerelease: true
# # files: |
# # ${{ env.FIXW_BIN }}
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ github.token }}
# with:
# upload_url: ${{ needs.create_release.outputs.upload_url }}
# asset_path: ${{ env.FIXW_BIN }}
# asset_name: ${{ env.FIXW_BIN }}
# asset_content_type: application/octet-stream
- name: Mac release preparation
if: >-
startsWith(github.ref, 'refs/tags/v')
&& runner.os == 'macOS'
run: |
FIXW_BIN=fix-whitespace-${FIXW_VERSION}-mac.binary
# Raw Mac binary
cp -p "${FIXW_EXE}" "${FIXW_BIN}"
# Save env variables for the next step
echo "FIXW_BIN=${FIXW_BIN}" >> "${GITHUB_ENV}"
# - name: Mac release
# if: >-
# startsWith(github.ref, 'refs/tags/v')
# && runner.os == 'macOS'
# # uses: softprops/action-gh-release@v1
# # with:
# # draft: true
# # prerelease: true
# # files: |
# # ${{ env.FIXW_BIN }}
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ github.token }}
# with:
# upload_url: ${{ needs.create_release.outputs.upload_url }}
# asset_path: ${{ env.FIXW_BIN }}
# asset_name: ${{ env.FIXW_BIN }}
# asset_content_type: application/octet-stream
- name: Windows release preparation
if: >-
startsWith(github.ref, 'refs/tags/v')
&& runner.os == 'Windows'
shell: bash
run: |
FIXW_BIN=fix-whitespace-${FIXW_VERSION}.exe
cp -p "${FIXW_EXE}.exe" "${FIXW_BIN}"
# Save env variables for the next step
echo "FIXW_BIN=${FIXW_BIN}" >> "${GITHUB_ENV}"
# - name: Windows release
# if: >-
# startsWith(github.ref, 'refs/tags/v')
# && runner.os == 'Windows'
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ github.token }}
# with:
# upload_url: ${{ needs.create_release.outputs.upload_url }}
# asset_path: ${{ env.FIXW_BIN }}
# asset_name: ${{ env.FIXW_BIN }}
# asset_content_type: application/octet-stream
# # uses: softprops/action-gh-release@v1
# # with:
# # draft: true
# # prerelease: true
# # files: |
# # ${{ env.FIXW_VER_EXE }}
# - name: Upload binary
# if: >-
# startsWith(github.ref, 'refs/tags/v')
# && (matrix.ghc-ver == '9.10' || runner.os != 'Linux')
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ github.token }}
# with:
# upload_url: ${{ needs.create_release.outputs.upload_url }}
# asset_path: ${{ env.FIXW_BIN }}
# asset_name: ${{ env.FIXW_BIN }}
# asset_content_type: application/octet-stream
- name: Upload binary
if: >-
startsWith(github.ref, 'refs/tags/v')
&& (matrix.ghc-ver == '9.10' || runner.os != 'Linux')
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
gh release upload ${{ github.ref }} "${{ env.FIXW_BIN }}" --clobber