aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/Windows-Standalone.yml
blob: d7655141a925681453b8e8bbc73d6825fbd72164 (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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: Windows Standalone

on:
  workflow_call:

jobs:


#
# Pure Windows Build (on MSYS2) - create zip (and also pre-wheel zip)
#
  Build:
    name: '🚧${{ matrix.icon }} ${{ matrix.sys }} (pure-build)'
    runs-on: windows-latest

    strategy:
      fail-fast: false
      matrix:
        include:
          - {icon: '🟪', pkg: 'mcode', sys: 'MINGW32', arch: 'i686' }
#          - {icon: '🟦', pkg: 'mcode', sys: 'MINGW64', arch: 'x86_64' } #! simulation with mcode is not yet supported on win64
          - {icon: '🟨', pkg: 'mcode', sys: 'UCRT64', arch: 'ucrt-x86_64'  } #! experimental; simulation with mcode is not yet supported on win64

    env:
      MINGW_ARCH: ${{ matrix.sys }}
    defaults:
      run:
        shell: msys2 {0}

    steps:
      - name: '${{ matrix.icon }} Setup MSYS2'
        uses: msys2/setup-msys2@v2
        with:
          msystem: ${{ matrix.sys }}
          update: true
          install: base-devel git mingw-w64-${{matrix.arch}}-gcc-ada mingw-w64-${{matrix.arch}}-zlib zip
          pacboy: >
            toolchain:p
            python-pip:p

      - name: '⚙ git config'
        run: git config --global core.autocrlf input
        shell: bash

      - name: '🧰 Checkout'
        uses: actions/checkout@v3
        with:
          # The command 'git describe' (used for version) needs the history.
          fetch-depth: 0

      - name: '🚧 Build package'
        run: |
          pip3 install pefile
          mkdir builddir
          cd builddir
          ../configure --prefix='/GHDL' LDFLAGS="-static -Wl,--stack=8388608" --enable-libghdl
          make
          mkdir -p 'GHDL'
          make install DESTDIR=.
          # No need to add dll dependencies for ghdl, as it is compiled
          # with -static
          make python-wheel
          zip pre-wheel-${{matrix.sys}}.zip -r dist-wheel setup-standalone.py
          zip ghdl-${{matrix.sys}}.zip -r GHDL

      - name: '📤 Upload artifact: pre-wheel'
        uses: actions/upload-artifact@v3
        with:
          name: ${{ matrix.sys }}-pre-wheel
          path: |
            builddir/pre-wheel-${{matrix.sys}}.zip

      - name: '📤 Upload artifact: zip pure-win'
        uses: actions/upload-artifact@v3
        with:
          name: ${{ matrix.sys }}-zip-win
          path: |
            builddir/ghdl-${{matrix.sys}}.zip


  Test:
    name: '🚦🐍🥡${{ matrix.icon }} ${{ matrix.sys }} (test sa)'
    runs-on: windows-latest

    needs:
      - Build

    strategy:
      fail-fast: false
      matrix:
        include:
          - {icon: '🟪', sys: 'MINGW32' }
#          - {icon: '🟦', sys: 'MINGW64' } #! simulation with mcode is not yet supported on win64
#          - {icon: '🟨', sys: 'UCRT64' } #! experimental; simulation with mcode is not yet supported on win64

    defaults:
      run:
        shell: pwsh

    steps:
      - name: '📥 Download artifact: package'
        uses: actions/download-artifact@v3
        with:
          path: artifact
          name: ${{ matrix.sys }}-zip-win

      - name: '⚙ Extract package'
        run: |
          dir
          unzip artifact\ghdl-${{matrix.sys}}.zip
          dir

      - name: '🛠 Set envvars'
        run: |
          $GHDL_DIR = (pwd).Path + '\GHDL\bin'
          echo "GHDL=${GHDL_DIR}\ghdl.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
          echo "$GHDL_DIR" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
          dir $GHDL_DIR


      - name: '🛠 Sanity check'
        run: |
          echo "GHDL is ${env:GHDL}"
          dir ${env:GHDL}
          & ${env:GHDL} version
          echo "sha: ${{github.sha}}"
          echo "head_ref: ${{github.head_ref}}"
          echo "ref_name: ${{github.ref_name}}"

      - name: '⚙ git config'
        run: |
           dir
           dir ${env:GHDL}
           git config --global core.autocrlf input

      - name: '🧰 Checkout'
        uses: actions/checkout@v3
        with:
          path: checkout

      - name: '${{ matrix.icon }} Setup MSYS2'
        uses: msys2/setup-msys2@v2
        with:
          msystem: ${{ matrix.sys }}
          update: true
          pacboy: >
            diffutils:p
            gcc:p

      - name: '🚦 Testsuite for ghdl'
        shell: msys2 {0}
        run: |
          set -x
          pwd
          ls -l
          echo "PATH: $PATH"
          echo "GHDL: $GHDL"
          cygghdl="$(cygpath -u $GHDL)"
          echo "cyg GHDL: $cygghdl"
          $cygghdl -v
          GHDL="$cygghdl"
          PATH="$PATH:$(dirname $cygghdl)"
          echo "PATH: $PATH"
          ghdl version
          cd checkout
          ./testsuite/testsuite.sh gna