Skip to content

Commit

Permalink
Pin stack version in CI (#3465)
Browse files Browse the repository at this point in the history
* Pin stack version in CI

* Revert back to old hpack version

* Pin ubuntu version

* Swap all powershell to bash

* Set shell on all 'defaults' blocks
  • Loading branch information
ChrisPenner authored Sep 28, 2022
1 parent 6969939 commit 0635366
Show file tree
Hide file tree
Showing 24 changed files with 143 additions and 58 deletions.
33 changes: 32 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: CI

defaults:
run:
shell: bash

on:
# Build on every pull request (and new PR commit)
pull_request:
Expand All @@ -19,6 +23,7 @@ jobs:
defaults:
run:
working-directory: unison
shell: bash
strategy:
# Run each build to completion, regardless of if any have failed
fail-fast: false
Expand Down Expand Up @@ -89,6 +94,32 @@ jobs:
key: stack-work-3_${{matrix.os}}-${{github.sha}}
restore-keys: stack-work-3_${{matrix.os}}

# Install stack by downloading the binary from GitHub.
# The installation process differs by OS.
- name: install stack (Linux)
if: runner.os == 'Linux'
working-directory: ${{ github.workspace }}
run: |
mkdir stack && cd stack
curl -L https://github.com/commercialhaskell/stack/releases/download/v2.7.5/stack-2.7.5-linux-x86_64.tar.gz | tar -xz
echo "$PWD/stack-"* >> $GITHUB_PATH
- name: install stack (macOS)
working-directory: ${{ github.workspace }}
if: runner.os == 'macOS'
run: |
mkdir stack && cd stack
curl -L https://github.com/commercialhaskell/stack/releases/download/v2.7.5/stack-2.7.5-osx-x86_64.tar.gz | tar -xz
echo "$PWD/stack-"* >> $GITHUB_PATH
- name: install stack (windows)
working-directory: ${{ github.workspace }}
if: runner.os == 'Windows'
run: |
mkdir stack && cd stack
curl -L https://github.com/commercialhaskell/stack/releases/download/v2.7.5/stack-2.7.5-windows-x86_64.tar.gz | tar -xz
echo "$PWD/stack-"* >> $GITHUB_PATH
# One of the transcripts fails if the user's git name hasn't been set.
- name: set git user info
run: |
Expand All @@ -102,14 +133,14 @@ jobs:
# Build deps, then build local code. Splitting it into two steps just allows us to see how much time each step
# takes.
- name: build dependencies
shell: bash
# Run up to 5 times in a row before giving up.
# It's very unlikely that our build-dependencies step will fail on most builds,
# so if it fails its almost certainly due to a race condition on the Windows
# file-system API that stack runs into. Since any successful packages are
# cached within a single build, it should get further along on each re-start
# and should hopefully finish!
run: |
stack --version
tries=1
if [[ ${{matrix.os}} = "windows-"* ]]; then
tries=5
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/haddocks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Haddocks
defaults:
run:
working-directory: unison
shell: bash

on:
push:
Expand Down Expand Up @@ -57,6 +58,13 @@ jobs:
stack-work-2_Linux-haddocks
stack-work-2_Linux
- name: install stack (Linux)
working-directory: ${{ github.workspace }}
run: |
mkdir stack && cd stack
curl -L https://github.com/commercialhaskell/stack/releases/download/v2.7.5/stack-2.7.5-linux-x86_64.tar.gz | tar -xz
echo "$PWD/stack-"* >> $GITHUB_PATH
# One of the transcripts fails if the user's git name hasn't been set.
- name: set git user info
working-directory: unison
Expand Down
44 changes: 34 additions & 10 deletions .github/workflows/pre-release.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: "pre-release"

defaults:
run:
shell: bash

on:
workflow_run:
workflows: ["CI"]
Expand All @@ -10,11 +14,18 @@ jobs:
build_linux:

name: "build_linux"
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2

- name: install stack (Linux)
working-directory: ${{ github.workspace }}
run: |
mkdir stack && cd stack
curl -L https://github.com/commercialhaskell/stack/releases/download/v2.7.5/stack-2.7.5-linux-x86_64.tar.gz | tar -xz
echo "$PWD/stack-"* >> $GITHUB_PATH
# One of the transcripts fails if the user's git name hasn't been set.
- name: set git user info
run: |
Expand Down Expand Up @@ -46,6 +57,12 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: install stack (macOS)
working-directory: ${{ github.workspace }}
run: |
mkdir stack && cd stack
curl -L https://github.com/commercialhaskell/stack/releases/download/v2.7.5/stack-2.7.5-osx-x86_64.tar.gz | tar -xz
echo "$PWD/stack-"* >> $GITHUB_PATH
# One of the transcripts fails if the user's git name hasn't been set.
- name: set git user info
Expand Down Expand Up @@ -81,19 +98,26 @@ jobs:

steps:
- uses: actions/checkout@v2

- name: install stack (windows)
working-directory: ${{ github.workspace }}
if: runner.os == 'Windows'
run: |
mkdir stack && cd stack
curl -L https://github.com/commercialhaskell/stack/releases/download/v2.7.5/stack-2.7.5-windows-x86_64.tar.gz | tar -xz
echo "$PWD/stack-"* >> $GITHUB_PATH
- name: build
run: stack --no-terminal build --flag unison-parser-typechecker:optimized

- name: fetch latest codebase-ui and package with ucm
# Powershell
run: |
mkdir -p tmp\ui
mkdir -p release\ui
$UCM = stack exec -- where unison
cp $UCM .\release\ucm.exe
Invoke-WebRequest -Uri https://github.com/unisonweb/codebase-ui/releases/download/latest/unisonLocal.zip -OutFile tmp\unisonLocal.zip
Expand-Archive -Path tmp\unisonLocal.zip -DestinationPath release\ui
Compress-Archive -Path .\release\* -DestinationPath ucm-windows.zip
mkdir -p /tmp/ucm/ui
UCM="$(stack path | awk '/local-install-root/{print $2}')/bin/unison"
cp "$UCM" /tmp/ucm/ucm
wget -O /tmp/unisonLocal.zip https://github.com/unisonweb/unison-local-ui/releases/download/latest/unisonLocal.zip
tar.exe -xf /tmp/unisonLocal.zip --directory /tmp/ucm/ui
tar.exe -a -c -f ucm-windows.zip /tmp/ucm
- name: Upload windows artifact
uses: actions/upload-artifact@v2
Expand All @@ -104,7 +128,7 @@ jobs:

release:
name: "create_release"
runs-on: "ubuntu-latest"
runs-on: ubuntu-20.04
needs:
- build_linux
- build_macos
Expand Down
54 changes: 38 additions & 16 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: "release"

defaults:
run:
shell: bash

on:
workflow_dispatch:
inputs:
Expand All @@ -16,7 +20,7 @@ on:
jobs:
release:
name: "create_release"
runs-on: ubuntu-22.04
runs-on: ubuntu-20.04
needs:
- build_linux
- build_macos
Expand Down Expand Up @@ -52,7 +56,7 @@ jobs:
build_linux:

name: "build_linux"
runs-on: ubuntu-22.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -69,11 +73,11 @@ jobs:
# recent branch cache.
# Then it will save a new cache at this commit sha, which should be used by
# the next build on this branch.
key: stack-0_ubuntu-22.04-${{hashFiles('stack.yaml')}}-${{github.sha}}
key: stack-0_ubuntu-20.04-${{hashFiles('stack.yaml')}}-${{github.sha}}
# Fall-back to use the most recent cache for the stack.yaml, or failing that the OS
restore-keys: |
stack-0_ubuntu-22.04-${{hashFiles('stack.yaml')}}
stack-0_ubuntu-22.04
stack-0_ubuntu-20.04-${{hashFiles('stack.yaml')}}
stack-0_ubuntu-20.04
# Cache each local package's ~/.stack-work for fast incremental builds in CI.
- uses: actions/cache@v3
Expand All @@ -87,8 +91,15 @@ jobs:
# recent branch cache.
# Then it will save a new cache at this commit sha, which should be used by
# the next build on this branch.
key: stack-work-3_ubuntu-22.04-${{github.sha}}
restore-keys: stack-work-3_ubuntu-22.04
key: stack-work-3_ubuntu-20.04-${{github.sha}}
restore-keys: stack-work-3_ubuntu-20.04

- name: install stack (Linux)
working-directory: ${{ github.workspace }}
run: |
mkdir stack && cd stack
curl -L https://github.com/commercialhaskell/stack/releases/download/v2.7.5/stack-2.7.5-linux-x86_64.tar.gz | tar -xz
echo "$PWD/stack-"* >> $GITHUB_PATH
- name: build
run: stack --no-terminal build --flag unison-parser-typechecker:optimized
Expand Down Expand Up @@ -149,6 +160,13 @@ jobs:
key: stack-work-3_macOS-11.0-${{github.sha}}
restore-keys: stack-work-3_macOS-11.0

- name: install stack (macOS)
working-directory: ${{ github.workspace }}
run: |
mkdir stack && cd stack
curl -L https://github.com/commercialhaskell/stack/releases/download/v2.7.5/stack-2.7.5-osx-x86_64.tar.gz | tar -xz
echo "$PWD/stack-"* >> $GITHUB_PATH
- name: remove ~/.stack/setup-exe-cache on macOS
run: rm -rf ~/.stack/setup-exe-cache

Expand Down Expand Up @@ -212,8 +230,14 @@ jobs:
key: stack-work-3_windows-2019-${{github.sha}}
restore-keys: stack-work-3_windows-2019

- name: install stack (windows)
working-directory: ${{ github.workspace }}
run: |
mkdir stack && cd stack
curl -L https://github.com/commercialhaskell/stack/releases/download/v2.7.5/stack-2.7.5-windows-x86_64.tar.gz | tar -xz
echo "$PWD/stack-"* >> $GITHUB_PATH
- name: build
shell: bash
run: |
# Windows will crash on build intermittently because the filesystem
# sucks at managing concurrent file access;
Expand All @@ -224,15 +248,13 @@ jobs:
done
- name: fetch latest Unison Local UI and package with ucm
# Powershell
run: |
mkdir -p tmp\ui
mkdir -p release\ui
$UCM = stack exec -- where unison
cp $UCM .\release\ucm.exe
Invoke-WebRequest -Uri https://github.com/unisonweb/unison-local-ui/releases/download/latest/unisonLocal.zip -OutFile tmp\unisonLocal.zip
Expand-Archive -Path tmp\unisonLocal.zip -DestinationPath release\ui
Compress-Archive -Path .\release\* -DestinationPath ucm-windows.zip
mkdir -p /tmp/ucm/ui
UCM="$(stack path | awk '/local-install-root/{print $2}')/bin/unison"
cp "$UCM" /tmp/ucm/ucm
wget -O /tmp/unisonLocal.zip https://github.com/unisonweb/unison-local-ui/releases/download/latest/unisonLocal.zip
tar.exe -xf /tmp/unisonLocal.zip --directory /tmp/ucm/ui
tar.exe -a -c -f ucm-windows.zip /tmp/ucm
- name: Upload windows artifact
uses: actions/upload-artifact@v2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.35.0.
-- This file has been generated from package.yaml by hpack version 0.34.4.
--
-- see: https://github.com/sol/hpack

Expand Down
2 changes: 1 addition & 1 deletion codebase2/codebase-sqlite/unison-codebase-sqlite.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.35.0.
-- This file has been generated from package.yaml by hpack version 0.34.4.
--
-- see: https://github.com/sol/hpack

Expand Down
2 changes: 1 addition & 1 deletion codebase2/codebase-sync/unison-codebase-sync.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.35.0.
-- This file has been generated from package.yaml by hpack version 0.34.4.
--
-- see: https://github.com/sol/hpack

Expand Down
2 changes: 1 addition & 1 deletion codebase2/codebase/unison-codebase.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.35.0.
-- This file has been generated from package.yaml by hpack version 0.34.4.
--
-- see: https://github.com/sol/hpack

Expand Down
2 changes: 1 addition & 1 deletion codebase2/core/unison-core.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.35.0.
-- This file has been generated from package.yaml by hpack version 0.34.4.
--
-- see: https://github.com/sol/hpack

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.35.0.
-- This file has been generated from package.yaml by hpack version 0.34.4.
--
-- see: https://github.com/sol/hpack

Expand Down
2 changes: 1 addition & 1 deletion codebase2/util-term/unison-util-term.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.35.0.
-- This file has been generated from package.yaml by hpack version 0.34.4.
--
-- see: https://github.com/sol/hpack

Expand Down
2 changes: 1 addition & 1 deletion codebase2/util/unison-util.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.35.0.
-- This file has been generated from package.yaml by hpack version 0.34.4.
--
-- see: https://github.com/sol/hpack

Expand Down
2 changes: 1 addition & 1 deletion lib/unison-prelude/unison-prelude.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.35.0.
-- This file has been generated from package.yaml by hpack version 0.34.4.
--
-- see: https://github.com/sol/hpack

Expand Down
8 changes: 4 additions & 4 deletions lib/unison-pretty-printer/unison-pretty-printer.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.35.0.
-- This file has been generated from package.yaml by hpack version 0.34.4.
--
-- see: https://github.com/sol/hpack

Expand Down Expand Up @@ -68,9 +68,9 @@ library
, unison-core1
, unison-prelude
, unliftio
default-language: Haskell2010
if flag(optimized)
ghc-options: -funbox-strict-fields -O2
default-language: Haskell2010

executable prettyprintdemo
main-is: Main.hs
Expand Down Expand Up @@ -103,9 +103,9 @@ executable prettyprintdemo
, safe
, text
, unison-pretty-printer
default-language: Haskell2010
if flag(optimized)
ghc-options: -funbox-strict-fields -O2
default-language: Haskell2010

test-suite pretty-printer-tests
type: exitcode-stdio-1.0
Expand Down Expand Up @@ -145,6 +145,6 @@ test-suite pretty-printer-tests
, easytest
, raw-strings-qq
, unison-pretty-printer
default-language: Haskell2010
if flag(optimized)
ghc-options: -funbox-strict-fields -O2
default-language: Haskell2010
Loading

0 comments on commit 0635366

Please sign in to comment.