Skip to content

[ fix ] Add dummy LSP handlers and release Agda v2.7.0.1 Language Ser… #15

[ fix ] Add dummy LSP handlers and release Agda v2.7.0.1 Language Ser…

[ fix ] Add dummy LSP handlers and release Agda v2.7.0.1 Language Ser… #15

Workflow file for this run

# modified from https://github.com/simonmichael/hledger/blob/master/.github/workflows/linux.yml
name: CI
defaults:
run:
shell: bash
on:
push:
branches: [master, ci-*, ci]
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
pull_request:
branches: [master]
jobs:
build-and-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, macos-13, windows-latest]
fail-fast: false
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v4
- name: 🏗 Install yq (Windows)
if: runner.os == 'Windows'
uses: frenck/action-setup-yq@v1
- name: 🔍 Determine Stack resolver & GHC version
run: |
STACK_RESOLVER=$(yq .resolver stack.yaml)
GHC_VERSION=$(echo $(yq .compiler stack.yaml) | cut -c 5-)
echo STACK_RESOLVER="${STACK_RESOLVER}" >> "${GITHUB_ENV}"
echo GHC_VERSION="${GHC_VERSION}" >> "${GITHUB_ENV}"
- name: 🏗 Setup Haskell
if : runner.os == 'macOS'
uses: haskell-actions/setup@v2
id: setup-haskell
with:
ghc-version: ${{ env.GHC_VERSION }}
enable-stack: true
stack-version: 'latest'
- name: 🔍 Determine Stack root
run: |
STACK_ROOT="$(stack path --stack-root)"
echo STACK_ROOT="${STACK_ROOT}" >> "${GITHUB_ENV}"
# things to be restored:
# Include STACK_RESOLVER in cache key, otherwise caches accumulate build products for different resolvers.
- name: 💾 Restore cached stack global package db
id: stack-global
uses: actions/cache/restore@v4
with:
path: ${{ env.STACK_ROOT }}
key: ${{ matrix.os }}-stack-resolver-${{ env.STACK_RESOLVER }}-global-${{ hashFiles('**.yaml') }}
restore-keys: |
${{ matrix.os }}-stack-resolver-${{ env.STACK_RESOLVER }}-global
- name: 💾 Restore cached .stack-work
id: stack-work
uses: actions/cache/restore@v4
with:
path: .stack-work
key: ${{ matrix.os }}-stack-resolver-${{ env.STACK_RESOLVER }}-work-${{ hashFiles('**.yaml') }}
restore-keys: |
${{ matrix.os }}-stack-resolver-${{ env.STACK_RESOLVER }}-work
# actions:
- name: Set PKG_CONFIG_PATH for the ICU library (on macOS)
if: runner.os == 'macOS'
run: |
echo PKG_CONFIG_PATH="$(brew --prefix)/opt/icu4c/lib/pkgconfig" >> "${GITHUB_ENV}"
- name: Install the icu library (on Windows)
if: runner.os == 'Windows'
run: |
stack exec -- pacman -S --noconfirm mingw-w64-x86_64-icu mingw-w64-x86_64-pkgconf
- name: 📸 Build Snapshot
run: stack build --no-terminal --only-snapshot -j1
- name: 🧰 Build Dependencies
run: stack build --no-terminal --only-dependencies
- name: 🧰 Build ALS
run: stack build
- name: 🧰 Build Testings
run: stack build --test --no-terminal --only-dependencies
# things to be cached
- name: 💾 Cache stack global package db
if: always() && steps.stack-global.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ${{ env.STACK_ROOT }}
key: ${{ steps.stack-global.outputs.cache-primary-key }}
- name: 💾 Cache .stack-work
if: always() && steps.stack-work.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: .stack-work
key: ${{ steps.stack-work.outputs.cache-primary-key }}
- name: 📦 Bundle executable, DLLs and data files (on macOS)
if: runner.os == 'macOS'
run: | # Bundle icu4c DLLs
# see if icu4c has been installed
if [ "$(brew list | grep icu4c)" = "" ]
then
echo "installing icu4c"
brew install icu4c
fi
# get the directory of the DDLs we want (icuuc, icui18n, icudata)
dylib_dir=$(dirname "$(brew list icu4c | grep icuuc.dylib)")
echo "dylib_dir: $dylib_dir"
# find the path of "als"
executable=$(find "$(stack path --local-install-root)"/bin -name "als")
echo "executable: $executable"
# remove the old dylib, and make a new one
rm -rf dylib
mkdir dylib
################################################################################
# icuuc
################################################################################
icuuc_id=$(otool -L "$executable" | grep icuuc | awk '{print $1}')
icuuc_id_basename=$(basename "$icuuc_id")
icuuc_path=$dylib_dir/$icuuc_id_basename
icuuc_path_new=dylib/$icuuc_id_basename
icuuc_id_new=@loader_path/dylib/$icuuc_id_basename
# copy icuuc to the new directory
cp "$icuuc_path" "$icuuc_path_new"
# change icuuc's ID referenced by ALS
install_name_tool -change "$icuuc_id" "$icuuc_id_new" "$executable"
echo "icuuc referenced by ALS"
echo " old ID : $icuuc_id"
echo " new ID : $icuuc_id_new"
echo " old path: $icuuc_path"
echo " new path: $icuuc_path_new"
################################################################################
# icui18n
################################################################################
icui18n_id=$(otool -L "$executable" | grep icui18n | awk '{print $1}')
icui18n_id_basename=$(basename "$icui18n_id")
icui18n_path=$dylib_dir/$icui18n_id_basename
icui18n_path_new=dylib/$icui18n_id_basename
icui18n_id_new=@loader_path/dylib/$icui18n_id_basename
# copy icui18n to the new directory
cp "$icui18n_path" "$icui18n_path_new"
# change icui18n's ID referenced by ALS
install_name_tool -change "$icui18n_id" "$icui18n_id_new" "$executable"
echo "icui18n referenced by ALS"
echo " old ID : $icui18n_id"
echo " new ID : $icui18n_id_new"
echo " old path: $icui18n_path"
echo " new path: $icui18n_path_new"
################################################################################
# icudata
################################################################################
# otool -L "$icui18n_id" | grep icudata | awk '{print $1}'
icudata_id=$(otool -L "$icuuc_path" | grep icudata | awk '{print $1}')
icudata_id_basename=$(basename "$icudata_id")
icudata_path=$dylib_dir/$icudata_id_basename
icudata_path_new=dylib/$icudata_id_basename
# copy icudata to the new directory
cp "$icudata_path" "$icudata_path_new"
# no need of changing the ID because supposely it's already of "@loader_path"
echo "icudata referenced by icuuc"
echo " old ID : $icudata_id"
echo " old path : $icudata_path"
echo " new path : $icudata_path_new"
- name: 📦 Bundle executable, DLLs and data files (on Linux and macOS)
if: runner.os != 'Windows'
id: zip
run: |
# locate the data-dir
datadir=$(find "$(stack path --snapshot-install-root)/share" -type d -name "Agda-*")
echo "datadir: $datadir"
# locate the executable
executable=$(find "$(stack path --local-install-root)/bin" -name "als")
echo "executable: $executable"
# make a temporary directory for compresssing
mkdir zip
cp -r "$datadir" zip/data
if [[ ${{ runner.os }} == "macOS" ]]; then
cp -r dylib zip/dylib
fi
cp "$executable" zip/
# compress
if [[ ${{ runner.os }} == "Linux" ]]; then
cd zip
zip -r als-ubuntu.zip ./*
cd ..
mv zip/als-ubuntu.zip .
fi
if [[ ${{ matrix.os }} == "macos-latest" ]]; then
cd zip
zip -r als-macos-arm64.zip ./*
cd ..
mv zip/als-macos-arm64.zip .
fi
if [[ ${{ matrix.os }} == "macos-13" ]]; then
cd zip
zip -r als-macos-x64.zip ./*
cd ..
mv zip/als-macos-x64.zip .
fi
- name: 📦 Bundle executable, DLLs and data files (on Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
# locate the data-dir
$snapshot = (stack path --snapshot-install-root)
$datadir = (ls $snapshot\share *Agda-* -Recurse -Directory).FullName
# locate the executable
$local = (stack path --local-install-root)
$executable = (ls $local\bin *als.exe* -Recurse -File).FullName
# make a temporary directory for compresssing
mkdir zip
cp -r $datadir zip/data
cp $executable zip/
# include text-icu DLLs
$mingw64bin = (stack path --extra-library-dirs).split(", ") -match "\\bin"
ls $mingw64bin
cp (ls $mingw64bin *libicudt*) zip/
cp (ls $mingw64bin *libicuin*) zip/
cp (ls $mingw64bin *libicuuc*) zip/
ls zip
# compress
cd zip
Compress-Archive * als-windows.zip
cd ..
mv zip/als-windows.zip .
- name: 🧪 Run tests
run: stack test --ta --als-path=zip/als
# release (optional)
- name: 🚢 Release Artifacts
if: startsWith(github.ref, 'refs/tags/v') # so that only commits with a git tag would upload artifacts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [[ ${{ matrix.os }} == "ubuntu-latest" ]]; then
gh release upload ${{ github.ref_name }} als-ubuntu.zip --clobber
fi
# arm64 macos
if [[ ${{ matrix.os }} == "macos-latest" ]]; then
gh release upload ${{ github.ref_name }} als-macos-arm64.zip --clobber
fi
# x64 macos
if [[ ${{ matrix.os }} == "macos-13" ]]; then
gh release upload ${{ github.ref_name }} als-macos-x64.zip --clobber
fi
if [[ ${{ matrix.os }} == "windows-latest" ]]; then
gh release upload ${{ github.ref_name }} als-windows.zip --clobber
fi