aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/Test.yml
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows/Test.yml')
-rw-r--r--.github/workflows/Test.yml427
1 files changed, 427 insertions, 0 deletions
diff --git a/.github/workflows/Test.yml b/.github/workflows/Test.yml
new file mode 100644
index 000000000..5fdf20dca
--- /dev/null
+++ b/.github/workflows/Test.yml
@@ -0,0 +1,427 @@
+name: Test
+
+on:
+ push:
+ pull_request:
+ workflow_dispatch:
+
+env:
+ CI: true
+ DOCKER_BUILDKIT: 1
+
+jobs:
+
+#
+# Doc
+#
+
+ doc:
+ runs-on: ubuntu-latest
+ name: '馃摀 Docs'
+ steps:
+
+ - name: '馃О Checkout'
+ uses: actions/checkout@v2
+
+ - name: Build ghdl/doc
+ run: |
+ docker build -t ghdl/doc . -f- <<-EOF
+ FROM ghdl/build:buster-mcode
+ ENV PYTHONPATH=/opt/ghdl/pyGHDL
+ RUN apt update -qq && apt install -y python3-pip gnat-gps graphviz \
+ && ln -s /usr/bin/pip3 /usr/bin/pip
+ COPY . /opt/ghdl
+ RUN cd /opt/ghdl && ./configure && make && make install
+ EOF
+
+ - name: Run gnatdoc
+ run: |
+ cat > run.sh <<-EOF
+ #!/usr/bin/env sh
+ gnatdoc -P./ghdl
+ mkdir /src/public
+ mv gnatdoc /src/public/gnatdoc
+ EOF
+ chmod +x run.sh
+ docker run --rm -v $(pwd):/src -w /opt/ghdl ghdl/doc /src/run.sh
+
+ - name: '馃摀 BuildTheDocs (BTD)'
+ if: github.event_name != 'pull_request'
+ uses: buildthedocs/btd@v0
+ with:
+ token: ${{ github.token }}
+
+ #- run: nroff -man doc/_build/man/ghdl.1
+
+ - name: '馃摛 Upload artifact: HTML and LaTeX'
+ if: github.event_name != 'pull_request'
+ uses: actions/upload-artifact@v2
+ with:
+ name: doc
+ path: |
+ doc/_build/html
+ doc/_build/latex
+ doc/_build/man
+
+ - name: '馃摛 Upload artifact: ghdl.1'
+ if: github.event_name != 'pull_request'
+ uses: actions/upload-artifact@v2
+ with:
+ path: doc/_build/man/ghdl.1
+
+#
+# pyGHDL
+#
+
+ fmt:
+ runs-on: ubuntu-latest
+ name: '馃悕 pyGHDL'
+ steps:
+
+ - name: '馃О Checkout'
+ uses: actions/checkout@v2
+
+ - name: '馃悕 Setup Python'
+ uses: actions/setup-python@v2
+ with:
+ python-version: 3.8
+
+ - name: Install dependencies
+ run: |
+ sudo apt update -qq
+ sudo apt install -y gnat
+
+ - name: Update Python bindings
+ run: ./scripts/update_py_bindings.sh
+
+ - name: Check if Python bindings changed
+ run: git diff --quiet || git status
+
+# - run: python -m pip install black
+#
+# - run: python -m black --check pyGHDL
+
+#
+# GPL
+#
+
+ gpl:
+ runs-on: ubuntu-latest
+ name: '馃惂 GPL 路 mcode'
+ steps:
+
+ - name: '馃О Checkout'
+ uses: actions/checkout@v2
+
+ - run: TASK=buster+mcode ./scripts/ci-run.sh -c --gplcompat
+
+#
+# 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 }} ./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@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: ./scripts/macosx/install-ada.sh
+
+ - name: Build and test GHDL
+ run: |
+ PATH=$PWD/gnat/bin:$PATH
+ ./scripts/ci-run.sh -c
+ mv ghdl-*.tgz ghdl-osx-mcode.tgz
+ env:
+ TASK: macosx+mcode
+ GITHUB_OS: ${{ runner.os }}
+
+ - name: '馃摛 Upload artifact: package'
+ uses: actions/upload-artifact@v2
+ with:
+ path: ghdl-osx-mcode.tgz
+
+#
+# Windows Build
+#
+
+ win-build:
+ runs-on: windows-latest
+ strategy:
+ fail-fast: false
+ max-parallel: 2
+ matrix:
+ include: [
+ {icon: '馃煢', installs: 'MINGW32', arch: i686, pkg: 'mcode' },
+ #{icon: '馃煢', installs: "MINGW32", arch: i686, pkg: "llvm" }, ! Not yet functional
+ #{icon: '馃煪', installs: "MINGW64", arch: x86_64, pkg: "mcode" }, ! mcode is not yet supported on win64
+ {icon: '馃煪', installs: 'MINGW64', arch: x86_64, pkg: 'llvm' },
+ ]
+ name: '${{ matrix.icon }} Build 路 ${{ matrix.installs }} 路 ${{ matrix.pkg }}'
+ env:
+ MINGW_INSTALLS: ${{ matrix.installs }}
+ defaults:
+ run:
+ shell: msys2 {0}
+ steps:
+
+ - name: '${{ matrix.icon }} Setup MSYS2'
+ uses: msys2/setup-msys2@v2
+ with:
+ msystem: MSYS
+ update: true
+ install: >
+ base-devel
+ git
+ mingw-w64-${{ matrix.arch }}-toolchain
+
+ - 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 scripts/msys2-${{ matrix.pkg }}
+ makepkg-mingw --noconfirm --noprogressbar -sCLf
+
+ - name: '馃摛 Upload artifact: builddir'
+ uses: actions/upload-artifact@v2
+ with:
+ name: ${{ matrix.installs }}-${{ matrix.pkg }}-builddir
+ path: |
+ scripts/msys2-${{ matrix.pkg }}/src/
+ scripts/msys2-${{ matrix.pkg }}/pkg/
+
+ - name: '馃摛 Upload artifact: package'
+ uses: actions/upload-artifact@v2
+ with:
+ path: scripts/msys2-${{ matrix.pkg }}/mingw-*ghdl*.pkg.tar.zst
+
+#
+# Windows Test
+#
+
+ win-test:
+ needs: win-build
+ runs-on: windows-latest
+ strategy:
+ fail-fast: false
+ max-parallel: 8
+ matrix:
+ sys: [
+ {icon: '馃煢', installs: 'MINGW32', arch: i686, pkg: 'mcode' },
+ #{icon: '馃煢', installs: "MINGW32", arch: i686, pkg: "llvm" }, ! Not yet functional
+ #{icon: '馃煪', installs: "MINGW64", arch: x86_64, pkg: "mcode" }, ! mcode is not yet supported on win64
+ {icon: '馃煪', installs: 'MINGW64', arch: x86_64, pkg: 'llvm' },
+ ]
+ suite: [
+ 'sanity pyunit vpi',
+ 'gna',
+ 'vests',
+ 'synth',
+ ]
+ name: '${{ matrix.sys.icon }} Test 路 ${{ matrix.sys.installs }} 路 ${{ matrix.sys.pkg }} 路 ${{ matrix.suite }}'
+ defaults:
+ run:
+ shell: msys2 {0}
+ steps:
+
+ - name: '${{ matrix.sys.icon }} Setup MSYS2'
+ uses: msys2/setup-msys2@v2
+ with:
+ msystem: ${{ matrix.sys.installs }}
+ update: true
+ install: >
+ mingw-w64-${{ matrix.sys.arch }}-diffutils
+ mingw-w64-${{ matrix.sys.arch }}-gcc
+ mingw-w64-${{ matrix.sys.arch }}-python-pip
+
+ - run: git config --global core.autocrlf input
+ shell: bash
+
+ - name: '馃О Checkout'
+ uses: actions/checkout@v2
+
+ - name: '馃摜 Download artifact: package'
+ uses: actions/download-artifact@v2
+
+ - name: Install package and Python dependencies
+ run: |
+ pacman --noconfirm -U artifact/mingw-w64-${{ matrix.sys.arch }}-ghdl-${{ matrix.sys.pkg }}-*.zst
+ pip3 install -r testsuite/requirements.txt
+
+ - name: Test package
+ run: GHDL=ghdl ./testsuite/testsuite.sh ${{ matrix.suite }}
+
+#
+# Release
+#
+
+ Release:
+ if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || contains(github.ref, 'refs/tags/'))
+ needs: [ doc, lin, osx, win-test ]
+ runs-on: ubuntu-latest
+ name: '馃摝 Release'
+ steps:
+
+ - name: '馃摜 Download artifacts'
+ if: "!contains(github.ref, 'refs/tags/')"
+ uses: actions/download-artifact@v2
+
+ # Do not upload assets to tagged releases
+ - name: Set list of files for uploading
+ id: files
+ run: |
+ case '${{ github.ref }}' in
+ 'refs/tags/'*) _list='none' ;;
+ *) _list='artifact/*' ;;
+ esac
+ echo "::set-output name=list::${_list}"
+
+ # Tagged: create a pre-release or a release (semver)
+ # Untagged: update the assets of pre-release 'nightly'
+ - uses: eine/tip@master
+ with:
+ token: ${{ secrets.GITHUB_TOKEN }}
+ tag: 'nightly'
+ files: ${{ steps.files.outputs.list }}
+
+ - 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"}'
+
+#
+# Coverage (MINGW64)
+#
+
+ coverage:
+ needs: win-build
+ runs-on: windows-latest
+ name: '馃搱 Coverage'
+ defaults:
+ run:
+ shell: msys2 {0}
+ steps:
+
+ - name: '馃煪 Setup MSYS2'
+ uses: msys2/setup-msys2@v2
+ with:
+ msystem: MINGW64
+ update: true
+ install: mingw-w64-x86_64-python-pip
+
+ - run: git config --global core.autocrlf input
+ shell: bash
+
+ - name: '馃О Checkout'
+ uses: actions/checkout@v2
+
+ - name: '馃摜 Download artifact: package'
+ uses: actions/download-artifact@v2
+
+ - name: Install package and Python dependencies
+ run: |
+ pacman --noconfirm -U artifact/mingw-w64-x86_64-ghdl-llvm-*.zst
+ pip3 install -r testsuite/requirements.txt
+
+ - name: Run tests to generate coverage report
+ run: |
+ PYTHONPATH=$(pwd) python3 -m pytest -rA --cov=.. --cov-config=.coveragerc testsuite/pyunit
+
+ - name: Generate XML coverage report
+ if: always()
+ run: coverage xml
+
+ - name: '馃摛 Upload artifact: coverage report'
+ if: always()
+ uses: actions/upload-artifact@v2
+ with:
+ name: coverage
+ path: coverage.xml
+
+#
+# Coverage Publish (Ubuntu)
+#
+
+ coverage-publish:
+ needs: coverage
+ if: always() && github.repository == 'ghdl/ghdl' && github.event_name != 'pull_request'
+ runs-on: ubuntu-latest
+ name: '馃摦 Publish coverage report'
+ steps:
+
+ - name: '馃О Checkout'
+ uses: actions/checkout@v2
+
+ - name: '馃摜 Download artifact: coverage report'
+ uses: actions/download-artifact@v2
+ with:
+ name: coverage
+
+ - name: CodeCov
+ uses: codecov/codecov-action@v1
+ with:
+ file: coverage.xml
+ flags: unittests
+
+ - name: Codacy
+ uses: codacy/codacy-coverage-reporter-action@master
+ with:
+ project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
+ coverage-reports: coverage.xml
+
+#---
+
+# 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