aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.github/workflows/ci.yml
blob: 000e229137490a6bdf28e49113111547cc728b5f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: CI

on:
  push:
  pull_request:
  schedule:
    # Weekly, at 5:30 AM on Sunday (somewhat randomly chosen).
    - cron: '30 5 * * 0'
  workflow_dispatch:

jobs:
  build:
    strategy:
      matrix:
        platform: [x86_64, i386]
    runs-on: windows-latest
    name: 'Build: ${{ matrix.platform }}'
    env:
      platform: '${{ matrix.platform }}'
      global_env: 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'
      user_env: 'HKCU:\Environment'
    defaults:
      run:
        shell: pwsh
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Set up Stack
        uses: haskell/actions/setup@v1
        with:
          enable-stack: true
          stack-no-global: true
      # TODO: caching.
      - name: Build dependencies
        run: stack --no-terminal build --arch '${{ matrix.platform }}' --only-dependencies
      - name: Build
        run: stack --no-terminal build --arch '${{ matrix.platform }}' --copy-bins --local-bin-path ../install
      - name: Upload the binaries
        uses: actions/upload-artifact@v2
        with:
          name: 'windows-env-${{ matrix.platform }}'
          path: '${{ runner.workspace }}/install/'
      - name: Run the tests
        run: |
          $((Get-ItemProperty $env:global_env).PATH.Split(';') | Select-String -Pattern '^C:\\dumb$' -Quiet) -and $(throw "Global PATH shouldn't contain C:\dumb")
          $((Get-ItemProperty $env:user_env).PATH.Split(';')   | Select-String -Pattern '^C:\\dumb$' -Quiet) -and $(throw "User PATH shouldn't contain C:\dumb")
          ../install/addpath -y C:\dumb
          $((Get-ItemProperty $env:global_env).PATH.Split(';') | Select-String -Pattern '^C:\\dumb$' -Quiet) -and $(throw "Global PATH shouldn't contain C:\dumb")
          $((Get-ItemProperty $env:user_env).PATH.Split(';')   | Select-String -Pattern '^C:\\dumb$' -Quiet) -or $(throw "User PATH should contain C:\dumb")
          ../install/addpath -g -y C:\dumb
          $((Get-ItemProperty $env:global_env).PATH.Split(';') | Select-String -Pattern '^C:\\dumb$' -Quiet) -or $(throw "Global PATH should contain C:\dumb")
          $((Get-ItemProperty $env:user_env).PATH.Split(';')   | Select-String -Pattern '^C:\\dumb$' -Quiet) -or $(throw "User PATH should contain C:\dumb")
          ../install/delpath -g -y C:\dumb
          $((Get-ItemProperty $env:global_env).PATH.Split(';') | Select-String -Pattern '^C:\\dumb$' -Quiet) -and $(throw "Global PATH shouldn't contain C:\dumb")
          $((Get-ItemProperty $env:user_env).PATH.Split(';')   | Select-String -Pattern '^C:\\dumb$' -Quiet) -and $(throw "User PATH shouldn't contain C:\dumb")