Skip to content

Commit

Permalink
Keep the GHC version in one place.
Browse files Browse the repository at this point in the history
  • Loading branch information
SamirTalwar committed Mar 1, 2023
1 parent b9649bb commit d90cf4f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
tags:
- "v*"

env:
GHC_VERSION: "9.2.6"

jobs:
release:
name: Release
Expand Down Expand Up @@ -38,11 +35,14 @@ jobs:
steps:
- name: Check out
uses: actions/checkout@v3
- name: Get GHC version
id: ghc-version
run: echo "ghc-version=$(cat ghc.version)" >> "$GITHUB_OUTPUT"
- name: Set up Haskell
id: haskell-setup
uses: haskell/actions/setup@v2
with:
ghc-version: ${{ env.GHC_VERSION }}
ghc-version: ${{ steps.ghc-version.outputs.ghc-version }}
enable-stack: true
stack-no-global: true
stack-setup-ghc: true
Expand Down Expand Up @@ -94,11 +94,14 @@ jobs:
with:
path: C:\Users\runneradmin\AppData\Local\Programs\stack
key: v1-windows-latest-stack-${{ hashFiles('stack.yaml') }}
- name: Get GHC version
id: ghc-version
run: echo "ghc-version=$(Get-Content ghc.version)" >> "$Env:GITHUB_OUTPUT"
- name: Set up Haskell
id: haskell-setup
uses: haskell/actions/setup@v2
with:
ghc-version: ${{ env.GHC_VERSION }}
ghc-version: ${{ steps.ghc-version.outputs.ghc-version }}
enable-stack: true
stack-no-global: true
stack-setup-ghc: true
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/verify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ on:
pull_request:
push:

env:
GHC_VERSION: "9.2.6"

jobs:
build-unix:
name: Build
Expand All @@ -19,11 +16,14 @@ jobs:
steps:
- name: Check out
uses: actions/checkout@v3
- name: Get GHC version
id: ghc-version
run: echo "ghc-version=$(cat ghc.version)" >> "$GITHUB_OUTPUT"
- name: Set up Haskell
id: haskell-setup
uses: haskell/actions/setup@v2
with:
ghc-version: ${{ env.GHC_VERSION }}
ghc-version: ${{ steps.ghc-version.outputs.ghc-version }}
enable-stack: true
stack-no-global: true
stack-setup-ghc: true
Expand Down Expand Up @@ -95,11 +95,14 @@ jobs:
with:
path: C:\Users\runneradmin\AppData\Local\Programs\stack
key: v1-windows-latest-stack-${{ hashFiles('stack.yaml') }}
- name: Get GHC version
id: ghc-version
run: echo "ghc-version=$(Get-Content ghc.version)" >> "$Env:GITHUB_OUTPUT"
- name: Set up Haskell
id: haskell-setup
uses: haskell/actions/setup@v2
with:
ghc-version: ${{ env.GHC_VERSION }}
ghc-version: ${{ steps.ghc-version.outputs.ghc-version }}
enable-stack: true
stack-no-global: true
stack-setup-ghc: true
Expand Down
9 changes: 1 addition & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,12 @@ smoke.cabal: $(CONF)
touch $@

.PHONY: update-resolver
update-resolver: update-resolver-in-stack.yaml update-ghc-version
update-resolver: update-resolver-in-stack.yaml ghc.version

.PHONY: update-resolver-in-stack.yaml
update-resolver-in-stack.yaml:
sed -i -r "s/^(resolver:) .*/\1 $$(curl -fsSI 'https://www.stackage.org/lts' | grep '^location: ' | sed 's#^location: /##' | dos2unix)/" stack.yaml

.PHONY: update-ghc-version
update-ghc-version: ghc.version update-github-workflow-ghc-version

.PHONY: update-github-workflow-ghc-version
update-github-workflow-ghc-version:
sed -i -r "s/^ GHC_VERSION: \".*\"$$/ GHC_VERSION: \"$$(cat ghc.version)\"/" .github/workflows/*.yaml

ghc.version: $(CONF)
curl -fsSL "https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/$$(yq -r '.resolver | gsub("[-\\.]"; "/")' stack.yaml).yaml" \
| yq -r '.resolver.compiler | sub("^ghc-"; "")' \
Expand Down

0 comments on commit d90cf4f

Please sign in to comment.