summaryrefslogtreecommitdiff
path: root/.github/workflows/build-windows-package.yml
blob: 30c74c0bf50b3d514400e1a2118d0b7f433c9d89 (plain)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Build Windows Package

on:
  push: # testing until merged into master
  workflow_dispatch:

jobs:
  build:
    name: Build on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [windows-2019]
        ghc: ["8.6.5"]
        cabal: ["2.4"]

    steps:
    - uses: actions/checkout@v2

    - name: Setup MSYS2
      uses: msys2/setup-msys2@v2
      with:
        install: >-
          base-devel
          gcc

    - name: Prepare dist folder
      shell: msys2 {0}
      run: |
        mkdir /c/tmp-dist

    - name: Build C runtime
      shell: msys2 {0}
      run: |
        cd src/runtime/c
        autoreconf -i
        ./configure
        make
        make install
        cp /mingw64/bin/libpgf-0.dll /c/tmp-dist
        cp /mingw64/bin/libgu-0.dll /c/tmp-dist

    - name: Build Java bindings
      shell: msys2 {0}
      run: |
        export PATH="${PATH}:/c/Program Files/Java/jdk8u275-b01/bin"
        cd src/runtime/java
        make \
          JNI_INCLUDES="-I \"/c/Program Files/Java/jdk8u275-b01/include\" -I \"/c/Program Files/Java/jdk8u275-b01/include/win32\" -I \"/mingw64/include\" -D__int64=int64_t" \
          WINDOWS_LDFLAGS="-L\"/mingw64/lib\" -no-undefined"
        make install
        cp .libs//msys-jpgf-0.dll /c/tmp-dist/jpgf.dll
        cp jpgf.jar /c/tmp-dist

    - run: $Env:Path

    - shell: msys2 {0}
      run: echo $PATH

    - name: Install Python build tools
      shell: msys2 {0}
      run: |
        pip install python-dev-tools

    - name: Build Python bindings
      shell: msys2 {0}
      env:
        EXTRA_INCLUDE_DIRS: /mingw64/include
        EXTRA_LIB_DIRS: /mingw64/lib
      run: |
        pip install python-dev-tools
        cd src/runtime/python
        python setup.py build
        python setup.py install
      # cp build/*/pgf.so /c/tmp-dist

    - name: Setup Haskell
      uses: actions/setup-haskell@v1
      id: setup-haskell-cabal
      with:
        ghc-version: ${{ matrix.ghc }}
        cabal-version: ${{ matrix.cabal }}

    - name: Install Haskell build tools
      run: |
        cabal install alex happy

    - name: Build GF
      run: |
        cabal install --only-dependencies -fserver
        cabal configure -fserver
        cabal build
        copy dist\build\gf\gf.exe C:\tmp-dist

    - name: Upload artifact
      uses: actions/upload-artifact@v2
      with:
        name: gf-${{ github.sha }}-windows
        path: C:\tmp-dist\*
        if-no-files-found: error