11# modified from https://github.com/simonmichael/hledger/blob/master/.github/workflows/linux.yml
22
3- name : CI (Unix)
3+ name : CI
44
55defaults :
66 run :
1919 runs-on : ${{ matrix.os }}
2020 strategy :
2121 matrix :
22- os : [ubuntu-latest, macos-latest]
22+ os : [ubuntu-latest, macos-latest, windows-latest ]
2323 fail-fast : false
2424 steps :
2525
@@ -78,13 +78,10 @@ jobs:
7878 run : |
7979 echo PKG_CONFIG_PATH="$(brew --prefix)/opt/icu4c/lib/pkgconfig" >> "${GITHUB_ENV}"
8080
81- # - name: ⏬ Setup Haskell
82- # uses: haskell-actions/setup@v2
83- # id: setup-haskell
84- # with:
85- # ghc-version: ${{ env.GHC_VERSION }}
86- # enable-stack: true
87- # stack-version: 'latest'
81+ - name : Install the icu library (on Windows)
82+ if : runner.os == 'Windows'
83+ run : |
84+ stack exec -- pacman -S --noconfirm mingw-w64-x86_64-icu mingw-w64-x86_64-pkgconf
8885
8986 - name : 📸 Build Snapshot
9087 run : stack build --no-terminal --only-snapshot -j1
9592 - name : 🧰 Build ALS
9693 run : stack build
9794
98-
99- # - name: 🔨 Build
100- # run: stack build
101-
102- # - name: 🧪 Run tests
103- # run: stack test
104-
10595 # things to be cached
10696
10797 - name : 💾 Cache stack global package db
@@ -119,7 +109,7 @@ jobs:
119109 key : ${{ steps.stack-work.outputs.cache-primary-key }}
120110
121111
122- - name : 🔗 Bundle ICU4C DLLs (on macOS)
112+ - name : 📦 Bundle executable, DLLs and data files (on macOS)
123113 if : runner.os == 'macOS'
124114 run : | # Bundle icu4c DLLs
125115
@@ -209,8 +199,8 @@ jobs:
209199 echo " old path : $icudata_path"
210200 echo " new path : $icudata_path_new"
211201
212-
213- - name : 📦 Compress files
202+ - name : 📦 Bundle executable, DLLs and data files (on Linux and macOS)
203+ if : runner.os != 'Windows'
214204 id : zip
215205 run : |
216206 # locate the data-dir
@@ -243,18 +233,53 @@ jobs:
243233 mv zip/als-macos.zip .
244234 fi
245235
236+ - name : 📦 Bundle executable, DLLs and data files (on Windows)
237+ if : runner.os == 'Windows'
238+ shell : pwsh
239+ run : |
240+ # locate the data-dir
241+ $snapshot = (stack path --snapshot-install-root)
242+ $datadir = (ls $snapshot\share *Agda-* -Recurse -Directory).FullName
243+
244+ # locate the executable
245+ $local = (stack path --local-install-root)
246+ $executable = (ls $local\bin *als.exe* -Recurse -File).FullName
247+
248+ # make a temporary directory for compresssing
249+ mkdir zip
250+ cp -r $datadir zip/data
251+ cp $executable zip/
252+
253+ # include text-icu DLLs
254+ $mingw64bin = (stack path --extra-library-dirs).split(", ") -match "\\bin"
255+ ls $mingw64bin
256+ cp (ls $mingw64bin *libicudt*) zip/
257+ cp (ls $mingw64bin *libicuin*) zip/
258+ cp (ls $mingw64bin *libicuuc*) zip/
259+ ls zip
260+
261+ # compress
262+ cd zip
263+ Compress-Archive * als-windows.zip
264+ cd ..
265+ mv zip/als-windows.zip .
266+
267+
246268 - name : 🧪 Run tests
247269 run : stack test --ta --als-path=zip/als
248270
249- # - name: 🔨 Build and run tests
250- # run: |
251-
252- # stack test --ta --als-path=zip/als
253-
254271 # release (optional)
255272 - name : 🚢 Release Artifacts
256273 if : startsWith(github.ref, 'refs/tags/v') # so that only commits with a git tag would upload artifacts
257274 env :
258275 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
259276 run : |
260- gh release upload ${{ github.ref_name }} als-ubuntu.zip --clobber
277+ if [[ ${{ runner.os }} == "Linux" ]]; then
278+ gh release upload ${{ github.ref_name }} als-ubuntu.zip --clobber
279+ fi
280+ if [[ ${{ runner.os }} == "macOS" ]]; then
281+ gh release upload ${{ github.ref_name }} als-macos.zip --clobber
282+ fi
283+ if [[ ${{ runner.os }} == "Windows" ]]; then
284+ gh release upload ${{ github.ref_name }} als-windows.zip --clobber
285+ fi
0 commit comments