aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/push.yml
blob: 5e1cbdb29aa233b861c4a5a51f2557e0be44d0b7 (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
name: 'push'

on:
  push:
  pull_request:

env:
  CI: true

jobs:

#
# Format
#

  fmt:
    runs-on: ubuntu-latest
    name: '馃悕 Format (black)'
    steps:

    - name: '馃О Checkout'
      uses: actions/checkout@v2

    - name: '馃悕 Setup Python'
      uses: actions/setup-python@v2
      with:
        python-version: 3.8

    - run: python -m pip install black

    - run: python -m black --check python

#
# GPL
#

  gpl:
    runs-on: ubuntu-latest
    name: '馃惂 GPL  mcode'
    steps:

    - name: '馃О Checkout'
      uses: actions/checkout@v2

    - run: TASK=buster+mcode ./dist/ci-run.sh -c --gpl --no-synth

#
# GNU/Linux
#

  lin:
    strategy:
      fail-fast: false
      max-parallel: 4
      matrix:
        include: [
          { os: 18, backend: mcode },
          { os: 20, backend: mcode },
          { os: 18, backend: llvm-5.0 },
          { os: 20, backend: llvm-10 },
          { os: 18, backend: gcc-8.3.0 },
          { os: 20, backend: gcc-9.3.0 }
        ]
    name: '馃惂 Ubuntu ${{ matrix.os }}  ${{ matrix.backend }}'
    runs-on: ubuntu-${{ matrix.os }}.04
    steps:

    - name: '馃О Checkout'
      uses: actions/checkout@v2

    - name: Build and test GHDL in containers
      run: |
        TASK=ubuntu${{ matrix.os }}+${{ matrix.backend }} ./dist/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@v2
      with:
        path: ghdl-gha-ubuntu-*.tgz

#
# MacOS
#

  osx:
    runs-on: macOS-latest
    name: '馃崕 macOS  mcode'
    steps:

    - name: '馃О Checkout'
      uses: actions/checkout@v2

    - name: '鈿欙笍 Dependencies (brew)'
      run: |
        brew update || true
        brew install p7zip
        ./dist/macosx/install-ada.sh

    - name: Build and test GHDL
      run: |
        PATH=$PWD/gnat/bin:$PATH
        ./dist/ci-run.sh -c
      env:
        TASK: macosx+mcode
        GITHUB_OS: ${{ runner.os }}

#
# Windows
#

  win:
    runs-on: windows-latest
    strategy:
      fail-fast: false
      max-parallel: 2
      matrix:
        include: [
          {installs: "MINGW32", arch: i686, pkg: "mcode"},
          #{installs: "MINGW32", arch: i686, pkg: "llvm"},  ! Not yet functional
          #{installs: "MINGW64", arch: x86_64, pkg: "mcode"}, ! mcode is not yet supported on win64
          {installs: "MINGW64", arch: x86_64, pkg: "llvm"},
        ]
    name: '馃煪 MSYS2  ${{ matrix.installs }}  ${{ matrix.pkg }}'
    env:
      MINGW_INSTALLS: ${{ matrix.installs }}
    defaults:
      run:
        shell: msys2 {0}
    steps:

    - name: '馃煪 Setup MSYS2'
      uses: msys2/setup-msys2@v2
      with:
        msystem: MSYS
        update: true
        install: >
          base-devel
          git
          mingw-w64-${{ matrix.arch }}-toolchain
          mingw-w64-${{ matrix.arch }}-python-pip

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

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

    - name: Build package
      run: |
        cd dist/msys2-${{ matrix.pkg }}
        makepkg-mingw --noconfirm --noprogressbar -sCLf

    - name: Install package
      run: pacman --noconfirm -U dist/msys2-${{ matrix.pkg }}/mingw-w64-*-any.pkg.tar.zst

    - name: '馃摛 Upload artifact: builddir'
      uses: actions/upload-artifact@v2
      with:
        name: ${{ matrix.installs }}-${{ matrix.pkg }}-builddir
        path: |
          ./dist/msys2-${{ matrix.pkg }}/src/
          ./dist/msys2-${{ matrix.pkg }}/pkg/

    - name: '馃摛 Upload artifact: package'
      uses: actions/upload-artifact@v2
      with:
        path: ./dist/msys2-${{ matrix.pkg }}/mingw-*ghdl*.pkg.tar.zst

    - name: Test package
      run: |
        pip3 install -r testsuite/requirements.txt
        GHDL=ghdl ./testsuite/testsuite.sh
      env:
        MSYSTEM: ${{ matrix.installs }}

#
# NIGHTLY
#

  nightly:
    if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
    needs: [ lin, win ]
    runs-on: ubuntu-latest
    name: '馃摝 Nightly'
    steps:

    - name: '馃摜 Download artifacts'
      uses: actions/download-artifact@v2

    - uses: eine/tip@master
      with:
        token: ${{ secrets.GITHUB_TOKEN }}
        tag: 'nightly'
        files: artifact/*

    - run: |
        curl -X POST https://api.github.com/repos/ghdl/docker/dispatches \
        -H "Content-Type: application/json" \
        -H 'Accept: application/vnd.github.everest-preview+json' \
        -H "Authorization: token ${{ secrets.GHDL_BOT }}" \
        --data '{"event_type": "ghdl"}'

#---

# TODO:
# - Cache
#  - 'gnat' directory in macOS job
#
# - Re-package a MINGW/MSYS2 package to provide a 'standalone' tarball/zipfile.
#  - https://github.com/ghdl/ghdl/issues/318#issuecomment-286246287
#
# - Add GNAT GPL 32-bit build job with mcode backend