|
| 1 | +# modified from https://github.com/simonmichael/hledger/blob/master/.github/workflows/windows.yml |
| 2 | + |
| 3 | +name: CI (Windows) |
| 4 | + |
| 5 | +on: [push, pull_request] |
| 6 | + |
| 7 | +jobs: |
| 8 | + build: |
| 9 | + runs-on: windows-latest |
| 10 | + steps: |
| 11 | + |
| 12 | + - name: 📥 Checkout repository |
| 13 | + uses: actions/checkout@v2 |
| 14 | + |
| 15 | + # things to be cached/restored: |
| 16 | + |
| 17 | + - name: 💾 Cache stack global package db |
| 18 | + id: stack-global-package-db |
| 19 | + uses: actions/cache@v2 |
| 20 | + with: |
| 21 | + path: C:\Users\runneradmin\AppData\Roaming\stack\ |
| 22 | + key: ${{ runner.os }}-appdata-roaming-stack-${{ hashFiles('**.yaml') }} |
| 23 | + restore-keys: | |
| 24 | + ${{ runner.os }}-appdata-roaming-stack |
| 25 | + - name: 💾 Cache stack programs dir # ghc, ghc-included packages and their haddocks, mingw, msys2 |
| 26 | + id: stack-programs-dir |
| 27 | + uses: actions/cache@v2 |
| 28 | + with: |
| 29 | + path: C:\Users\runneradmin\AppData\Local\Programs\stack\ |
| 30 | + # which files signal a change in stack's global db ? |
| 31 | + # **.yaml includes */package.yaml and stack.yaml* (too many), and hopefully no other changing yamls |
| 32 | + key: ${{ runner.os }}-appdata-local-programs-stack-${{ hashFiles('**.yaml') }} |
| 33 | + restore-keys: | |
| 34 | + ${{ runner.os }}-appdata-local-programs-stack |
| 35 | + - name: 💾 Cache .stack-work |
| 36 | + uses: actions/cache@v2 |
| 37 | + with: |
| 38 | + path: .stack-work |
| 39 | + key: ${{ runner.os }}-stack-work-${{ hashFiles('**.yaml') }} |
| 40 | + restore-keys: | |
| 41 | + ${{ runner.os }}-stack-work |
| 42 | + - name: 💾 Cache agda-language-server/.stack-work |
| 43 | + uses: actions/cache@v2 |
| 44 | + with: |
| 45 | + path: agda-language-server/.stack-work |
| 46 | + key: ${{ runner.os }}-agda-language-server-stack-work-${{ hashFiles('agda-language-server/package.yaml') }} |
| 47 | + restore-keys: | |
| 48 | + ${{ runner.os }}-agda-language-server-stack-work |
| 49 | +
|
| 50 | + # actions |
| 51 | + |
| 52 | + - name: ⏬ Install stack |
| 53 | + #if: steps.stack-programs-dir.outputs.cache-hit != 'true' |
| 54 | + # this step is needed to get stack.exe into PATH, for now |
| 55 | + run: | |
| 56 | + curl -sL https://get.haskellstack.org/stable/windows-x86_64.zip -o stack.zip |
| 57 | + 7z x stack.zip stack.exe |
| 58 | + which stack |
| 59 | + stack --version |
| 60 | + which ./stack |
| 61 | + ./stack --version |
| 62 | + # must avoid GHC versions broken on windows such as 8.8.3 with https://gitlab.haskell.org/ghc/ghc/issues/17926 |
| 63 | + # current default stack.yaml uses GHC 8.8.4 which hopefully is ok |
| 64 | + |
| 65 | + - name: ⏬ Install GHC |
| 66 | + # if: steps.stack-programs-dir.outputs.cache-hit != 'true' |
| 67 | + # set PATH=C:\Users\runneradmin\AppData\Local\Programs\stack\local\bin;%PATH% |
| 68 | + run: | |
| 69 | + ./stack --no-terminal setup --install-ghc |
| 70 | +
|
| 71 | + - name: Install the icu library |
| 72 | + run: | |
| 73 | + ./stack exec -- pacman -S --noconfirm "mingw-w64-x86_64-icu" |
| 74 | +
|
| 75 | + - name: 📸 Build Snapshot |
| 76 | + run: | |
| 77 | + ./stack build --no-terminal --only-snapshot -j1 |
| 78 | +
|
| 79 | + - name: 🧰 Build Dependencies |
| 80 | + run: | |
| 81 | + ./stack build --no-terminal --only-dependencies |
| 82 | +
|
| 83 | + - name: 🔨 Build and run tests |
| 84 | + run: | |
| 85 | + ./stack test |
| 86 | +
|
| 87 | + # artifacts: |
| 88 | + |
| 89 | + - name: 📦 Compress executable and data files |
| 90 | + run: | |
| 91 | + # locate the data-dir |
| 92 | + $snapshot = (stack path --snapshot-install-root) |
| 93 | + $datadir = (ls $snapshot\share *Agda-* -Recurse -Directory).FullName |
| 94 | +
|
| 95 | + # locate the executable |
| 96 | + $local = (stack path --local-install-root) |
| 97 | + $executable = (ls $local\bin *als.exe* -Recurse -File).FullName |
| 98 | +
|
| 99 | + # make a temporary directory for compresssing |
| 100 | + mkdir zip |
| 101 | + cp -r $datadir zip/data |
| 102 | + cp $executable zip/ |
| 103 | +
|
| 104 | + # compress |
| 105 | + cd zip |
| 106 | + Compress-Archive * als-windows.zip |
| 107 | + cd .. |
| 108 | + mv zip/als-windows.zip . |
| 109 | + |
| 110 | + - name: 🚢 Release Artifacts |
| 111 | + uses: softprops/action-gh-release@v1 |
| 112 | + if: startsWith(github.ref, 'refs/tags/') # so that only commits with a git tag would upload artifacts |
| 113 | + with: |
| 114 | + files: als-windows.zip |
| 115 | + draft: true |
| 116 | + prerelease: true |
| 117 | + env: |
| 118 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments