Skip to content

Fix #29: use "/" in filepaths even under Windows #72

Fix #29: use "/" in filepaths even under Windows

Fix #29: use "/" in filepaths even under Windows #72

Workflow file for this run

name: Binaries
on:
push:
branches:
- master
tags:
- v*
pull_request:
branches:
- master
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
stack: ["2.9.3"]
ghc: ["9.2.5"]
# The GHC version has to match the one in the stack.yaml file.
env:
STACK: "stack --system-ghc"
steps:
- uses: actions/checkout@v3
- name: Setup Haskell Stack
uses: haskell/actions/setup@v2
id: setup
with:
enable-stack: true
stack-version: ${{ matrix.stack }}
ghc-version: ${{ matrix.ghc }}
- name: Restore cache
uses: actions/cache/restore@v3
id: cache
with:
path: ${{ steps.setup.outputs.stack-root }}
key: ${{ runner.os }}-stack-${{ matrix.stack }}-ghc-${{ matrix.ghc }}-${{ hashFiles('goldplate.cabal', 'stack.yaml', 'stack.yaml.lock') }}
restore-keys: ${{ runner.os }}-stack-${{ matrix.stack }}-ghc-${{ matrix.ghc }}-
- name: Build
run: ${STACK} build
- name: Save cache
uses: actions/cache/save@v3
# Reevaluate key.
env:
key: ${{ runner.os }}-stack-${{ matrix.stack }}-ghc-${{ matrix.ghc }}-${{ hashFiles('goldplate.cabal', 'stack.yaml', 'stack.yaml.lock') }}
# Will fail if we already have a cache with this key.
if: ${{ !(steps.cache.outputs.cache-hit && env.key == steps.cache.outputs.cache-matched-key) }}
with:
path: ${{ steps.setup.outputs.stack-root }}
key: ${{ env.key }}
# Should not error.
# continue-on-error: true
- name: Info about command-line tools used in test-suite
run: |
which bash
which cat
which echo
continue-on-error: true
- name: Info about command-line tools used in test-suite (via stack exec)
run: |
${STACK} exec which bash
${STACK} exec which cat
${STACK} exec which echo
continue-on-error: true
- name: Setup MSYS2 (Windows)
if: ${{ runner.os == 'Windows' }}
run: echo "C:\msys64\mingw64\bin;C:\msys64\usr\bin" >> "${GITHUB_PATH}"
- name: Info about command-line tools used in test-suite
run: |
which bash
which cat
which echo
continue-on-error: true
- name: Info about command-line tools used in test-suite (via stack exec)
run: |
${STACK} exec which bash
${STACK} exec which cat
${STACK} exec which echo
continue-on-error: true
- name: Test
run: ${STACK} test --test-arguments --diff
- name: Get goldplate version
run: |
VERSION="$(${STACK} run -- --numeric-version | tail -1)"
echo "VERSION=${VERSION}" >> "${GITHUB_ENV}"
- name: Create artifact
# if: startsWith(github.ref, 'refs/tags/v')
run: |
PLATFORM="$(uname | tr 'A-Z' 'a-z')"
BIN_DIR="$(${STACK} path --local-install-root)/bin"
EXE=$(cd "${BIN_DIR}"; ls goldplate*)
echo "PLATFORM = ${PLATFORM}"
echo "VERSION = ${VERSION}"
echo "BIN_DIR = ${BIN_DIR}"
echo "EXE = ${EXE}"
cp "${BIN_DIR}/${EXE}" .
tar -czf goldplate.tar.gz "${EXE}"
mkdir -p artifacts
mv goldplate.tar.gz "artifacts/goldplate-${VERSION}-${PLATFORM}-x86_64.tar.gz"
- uses: actions/upload-artifact@v3
# if: startsWith(github.ref, 'refs/tags/v')
with:
path: artifacts/*
name: artifacts
outputs:
version: ${{ env.VERSION }}
release:
name: Release
needs: build
runs-on: ubuntu-latest
# if: startsWith(github.ref, 'refs/tags/v')
steps:
# - name: Get the version
# id: get_version
# run: echo version="${GITHUB_REF#refs/tags/}" >> "${GITHUB_OUTPUT}"
- uses: actions/download-artifact@v3
with:
name: artifacts
- name: Display structure of downloaded files
run: ls -R
- uses: softprops/action-gh-release@v1
env:
VERSION: ${{ needs.build.outputs.version }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: |
goldplate-${{ env.VERSION }}-linux-x86_64.tar.gz
goldplate-${{ env.VERSION }}-darwin-x86_64.tar.gz
goldplate-${{ env.VERSION }}-windows-x86_64.tar.gz
generate_release_notes: true