Fix tests #110
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
on: | |
push: | |
branches: | |
- distribute | |
- windows | |
name: Build Windows x86_64 | |
jobs: | |
build-packages: | |
name: Build Windows Libraries | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
# First, check if the specific cache exists, so we don't waste ~3m of build | |
# time restoring the 1.5GB cache for no reason. | |
- uses: actions/cache@v3 | |
id: cache | |
with: | |
lookup-only: true | |
path: | | |
~\AppData\Local\Programs\stack | |
.stack-work | |
C:\sr | |
key: ${{ runner.os }}-${{ hashFiles('stack.yaml.lock') }} | |
# If it doesn't exist, setup our cache action, while also trying to restore | |
# a prior broader matching cache if it exists (saves a lot of time if just | |
# modifying a few packages). | |
- uses: actions/cache@v3 | |
if: steps.cache.outputs.cache-hit != 'true' | |
with: | |
path: | | |
~\AppData\Local\Programs\stack | |
.stack-work | |
C:\sr | |
key: ${{ runner.os }}-${{ hashFiles('stack.yaml.lock') }} | |
restore-keys: | | |
${{ runner.os }}- | |
# Now setup Haskell, given we're comitted to actually doing a lib build | |
- uses: haskell-actions/setup@v2 | |
if: steps.cache.outputs.cache-hit != 'true' | |
with: | |
enable-stack: true | |
stack-no-global: true | |
stack-version: 'latest' | |
# Install just our dependencies, this can take ~30m from scratch and is the | |
# most part valuable to cache. | |
- name: Install Dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: stack build --only-dependencies --ghc-options '-optl"-Wl,-Bstatic,-lstdc++,-lgcc_s,-lwinpthread,-Bdynamic"' | |
# The install step is split to a separate job, so that if the we were building | |
# from scratch and just spent 30 minutes building all the libraries, but then | |
# the actual compile failed, we wouldn't throw away all that hard work without | |
# caching it first. On a clean compile this means we'll save+restore the cache | |
# unecessarily once (+~3m), but over all subsequent runs with a cache hit the | |
# whole lib step will be skipped almost immediately so its worth it. | |
install: | |
name: Build Windows Executable | |
runs-on: windows-latest | |
needs: build-packages | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: haskell-actions/setup@v2 | |
with: | |
enable-stack: true | |
stack-no-global: true | |
stack-version: 'latest' | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~\AppData\Local\Programs\stack | |
.stack-work | |
C:\sr | |
key: ${{ runner.os }}-${{ hashFiles('stack.yaml.lock') }} | |
restore-keys: | | |
${{ runner.os }}- | |
# Use a retry action because inexplicably sometimes stack install stalls | |
# indefinitely after the `compiling Main` step, but then succeeds immediately | |
# with a second stack install. 🤷🏻♂️ | |
- uses: nick-fields/retry@v3 | |
with: | |
timeout_minutes: 5 | |
max_attempts: 4 | |
shell: bash # otherwise defaults to powershell on windows | |
# https://gitlab.haskell.org/ghc/ghc/-/issues/20878 | |
# https://gitlab.haskell.org/ghc/ghc/-/issues/20010#note_359766 | |
command: stack install --ghc-options '-optl"-Wl,-Bstatic,-lstdc++,-lgcc_s,-lwinpthread,-Bdynamic"' | |
- name: Copy binary files, dlls & check | |
run: | | |
mkdir lamdera | |
cp ~/AppData/Roaming/local/bin/lamdera.exe lamdera/lamdera.exe | |
cp distribution/dlls/* lamdera/ | |
./lamdera/lamdera.exe --version-full | |
- name: Create distribution zip | |
uses: vimtor/action-zip@v1 | |
with: | |
files: lamdera/ | |
recursive: false | |
dest: lamdera.zip | |
- name: Archive lamdera.zip artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: lamdera-next.zip | |
path: lamdera.zip | |
upload: | |
needs: install | |
name: Upload lamdera-next.zip to SFTP | |
runs-on: lamdera-community-linux-x86_64 | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: lamdera-next.zip | |
- name: Install SSH key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.GH_USER_SCP_KEY }} | |
name: id_ed25519 | |
known_hosts: ${{ secrets.KNOWN_HOSTS }} | |
if_key_exists: replace | |
- run: | | |
pwd | |
ls -alh | |
echo "put lamdera.zip next/lamdera-next-windows-x86_64.zip" | sftp -i ~/.ssh/id_ed25519 -P 22 [email protected] |