aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/Test.yml
blob: faa27fbc1ebeee5613985a8271f1faec12b48efe (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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
name: Test

on:
  push:
  pull_request:
  workflow_dispatch:

env:
  CI: true
  DOCKER_BUILDKIT: 1

jobs:

# Convention for the names:
# lin, osx, win, msys2: build package for the platform
# *-test: test on the platform

#
# Generate and upload doc
#
  gnatdoc:
    name: '📚 gnatdoc'
    runs-on: ubuntu-latest

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

      - name: '📚 Run gnatdoc'
        run: |
          docker run --rm -i -v $(pwd):/src -w /src ghdl/debug:base <<'EOF'
          #!/usr/bin/env sh
          ./configure --enable-werror && make && make install
          gnatdoc -P./ghdl
          EOF

      - name: '📤 Upload artifact: gnatdoc'
        uses: actions/upload-artifact@v3
        with:
          name: gnatdoc
          path: gnatdoc

#
# Upload Build The Doc
#
  doc:
    needs: gnatdoc
    name: '📓 Docs'
    runs-on: ubuntu-latest

    steps:

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

      - name: '⛴ Build ghdl/doc'
        run: |
          docker build -t ghdl/doc . -f- <<-EOF
          FROM ghdl/build:doc
          COPY . /opt/ghdl
          RUN cd /opt/ghdl && ./configure --enable-werror && make && make install
          EOF

      - name: '📥 Download artifact: gnatdoc'
        uses: actions/download-artifact@v3
        with:
          name: gnatdoc
          path: public/gnatdoc

      - name: '📓 BuildTheDocs (BTD)'
        uses: buildthedocs/btd@v0
        with:
          token: ${{ github.token }}
          skip-deploy: ${{ github.event_name == 'pull_request' }}

      #- run: nroff -man doc/_build/man/ghdl.1

      - name: '📤 Upload artifact: HTML, LaTeX and man'
        uses: actions/upload-artifact@v3
        with:
          name: doc
          path: |
            doc/_build/html
            doc/_build/latex
            doc/_build/man

#
# pyGHDL Bindings, Formatting and pure wheel
#
  pyGHDL:
    name: '🐍 pyGHDL'
    runs-on: ubuntu-latest

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

      - name: '🐍 Setup Python'
        uses: actions/setup-python@v4
        with:
          python-version: '3.10'

      - name: '🔧 Install dependencies'
        run: |
          sudo apt update -qq
          sudo apt install -y gnat
          python -m pip install --disable-pip-version-check black wheel pyTooling

      - name: '🚧 Update Python bindings'
        run: ./scripts/update_py_bindings.sh

      - name: '🚦 Check if Python bindings changed'
        run: |
          git diff --stat
          echo "NOTE: Bindings can be updated by executing ./scripts/update_py_bindings.sh (see previous step)"
          git diff --exit-code

      - name: '🚦 Check if python follows code formatting standards'
        run: python -m black --check pyGHDL

      - name: 🔨 Build Python package (source distribution)
        run: python setup.py sdist

      - name: 🔨 Build Python package (binary distribution - wheel)
        run: python setup.py bdist_wheel

      - name: '📤 Upload artifact: pyGHDL'
        uses: actions/upload-artifact@v3
        with:
          name: pyGHDL
          path: dist/
          if-no-files-found: error

#
# GPL
#

  gpl:
    if: false
    name: '🚧🚦🐧 GPL mcode'
    runs-on: ubuntu-latest

    steps:

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

      - run: TASK=bullseye+mcode ./scripts/ci-run.sh -c --gplcompat

#
# Build for GNU/Linux
#
  lin:
    name: '🚧🚦🐧 Ubuntu ${{ matrix.os }} ${{ matrix.backend }}'
    runs-on: ubuntu-${{ matrix.os }}.04

    strategy:
      fail-fast: false
      matrix:
        include:
          - { os: 20, backend: mcode }
          - { os: 22, backend: mcode }
          - { os: 20, backend: llvm-10 }
          - { os: 22, backend: llvm-14 }
          - { os: 20, backend: gcc-9.3.0 }
          - { os: 22, backend: gcc-12.1.0 }

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

      - name: '🛳 Build and test GHDL in containers'
        run: |
          TASK=ubuntu${{ matrix.os }}+${{ matrix.backend }} ./scripts/ci-run.sh -c
          mv ghdl-*-ubuntu${{ matrix.os }}-*.tgz ghdl-gha-ubuntu-${{ matrix.os }}.04-$(echo ${{ matrix.backend }} | sed 's#-.*##g').tgz

      - name: '📤 Upload artifact: package'
        uses: actions/upload-artifact@v3
        with:
          name: ubuntu${{ matrix.os }}-${{ matrix.backend }}
          path: ghdl-gha-ubuntu-*.tgz
          if-no-files-found: error

#
# Build for MacOS
#
  osx:
    name: '🚧🚦🍎 macOS ${{ matrix.os }} ${{ matrix.backend }}'
    runs-on: 'macOS-${{ matrix.os }}'

    strategy:
      fail-fast: false
      matrix:
        os:
        - '11'
#        - '12' # issue1897 fails.  Maybe test 11 build on 12.
        backend:
          - mcode
          - llvm

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

      - name: '💾 Cache gnat'
        id: cache-gnat
        uses: actions/cache@v3
        with:
          path: gnat
          key: ${{ runner.os }}-gnat

      # Although we cache this, we let the script run to check if the cache is valid (without conditions)
      - name: '⚙ Dependencies (brew)'
        run: ./scripts/macosx/install-ada.sh

      - name: '🚧 Build and 🚦 Test GHDL'
        run: |
          PATH=$PWD/gnat/bin:$PATH:/usr/local/Cellar/llvm@14/14.0.6/bin/
          ./scripts/ci-run.sh -c
          mv ghdl-*.tgz ghdl-macos-${{ matrix.os }}-${{ matrix.backend }}.tgz
        env:
          TASK: macosx+${{ matrix.backend }}
          GITHUB_OS: ${{ runner.os }}
          MACOSX_DEPLOYMENT_TARGET: '10.14'

      - name: '📤 Upload artifact: package'
        uses: actions/upload-artifact@v3
        with:
          name: macos${{ matrix.os }}-${{ matrix.backend }}
          path: ghdl-macos-${{ matrix.os }}-${{ matrix.backend }}.tgz
          if-no-files-found: error


  Windows-MSYS2:
    uses: ./.github/workflows/Windows-MSYS2.yml

  Windows-Standalone:
    uses: ./.github/workflows/Windows-Standalone.yml

  Windows-pyGHDL:
    needs: Windows-Standalone
    uses: ./.github/workflows/Windows-pyGHDL.yml


#
# Release
#
  Release:
    name: '📦 Release'
    runs-on: ubuntu-latest

    needs:
      - doc
      - lin
      - osx
      - Windows-MSYS2
      - Windows-Standalone
      - Windows-pyGHDL

    if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || contains(github.ref, 'refs/tags/'))

    steps:

      - name: '📥 Download artifacts'
        uses: actions/download-artifact@v3
        with:
          path: artifacts

      # Tagged: create a pre-release or a release (semver)
      # Untagged: update the assets of pre-release 'nightly'
      - uses: pyTooling/Actions/releaser@r0
        with:
          token: ${{ github.token }}
          tag: 'nightly'
          snapshots: false
          files: |
            **/*.zst
            **/*.tgz
            **/ghdl-*.zip
            **/man/ghdl.1


  Coverage:
    needs: Windows-MSYS2
    uses: ./.github/workflows/Coverage.yml
    secrets: inherit