Skip to content

Merge pull request #1073 from alainmarcel/alainmarcel-patch-1 #1547

Merge pull request #1073 from alainmarcel/alainmarcel-patch-1

Merge pull request #1073 from alainmarcel/alainmarcel-patch-1 #1547

Workflow file for this run

name: 'main'
on:
push:
pull_request:
jobs:
linux-gcc:
name: ubuntu-gcc
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
vendored_dependencies: [true, false]
defaults:
run:
shell: bash
steps:
- name: Install dependencies
run: |
sudo apt-get update -qq
sudo apt install -y g++-9 build-essential pkg-config cmake
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Setup Python Packages
run: pip3 install orderedmultidict
- name: Git pull
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
if: ${{ matrix.vendored_dependencies }}
- name: Git pull
uses: actions/checkout@v3
if: ${{ !matrix.vendored_dependencies }}
# Fetch tags for CMakeLists version check
# https://github.com/actions/checkout/issues/701
- name: Git fetch tags
run: git fetch --tags origin
- name: Use ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: linux-gcc-cache
- name: Configure shell
run: |
echo 'CC=gcc-9' >> $GITHUB_ENV
echo 'CXX=g++-9' >> $GITHUB_ENV
echo 'PREFIX=/tmp/uhdm-install' >> $GITHUB_ENV
echo 'PATH=/usr/lib/ccache:'"$PATH" >> $GITHUB_ENV
- name: Install vendored dependencies
run: |
git clone --depth 1 https://github.com/google/googletest.git
cd googletest && cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=17 -DCMAKE_POSITION_INDEPENDENT_CODE=ON . && cmake --build build && sudo cmake --install build
git clone --depth 1 --branch v1.0.0 https://github.com/capnproto/capnproto.git
cd capnproto && cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=17 -DCMAKE_POSITION_INDEPENDENT_CODE=ON . && cmake --build build && sudo cmake --install build
if: ${{ !matrix.vendored_dependencies }}
- name: Configure cmake options
run: |
echo 'ADDITIONAL_CMAKE_OPTIONS=-DUHDM_USE_HOST_GTEST=ON -DUHDM_USE_HOST_CAPNP=ON' >> $GITHUB_ENV
if: ${{ !matrix.vendored_dependencies }}
- name: Ensure build/test env is setup
run: |
env
which cmake && cmake --version
which make && make --version
which python && python --version
which $CC && $CC --version
which $CXX && $CXX --version
- name: Build & Test
run: |
make release
make test
make install
make test_install
make test_install_pkgconfig
if: ${{ matrix.vendored_dependencies }}
- name: Build & Test (Shared)
run: |
make release-shared UHDM_WITH_PYTHON=ON
make test-shared UHDM_WITH_PYTHON=ON
make install-shared
make test_install
if: ${{ !matrix.vendored_dependencies }}
macos:
name: macos-gcc
runs-on: macos-12
steps:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8
architecture: x64
- name: Setup Python Packages
run: pip3 install orderedmultidict
- name: Git pull
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Use ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: macos-cache
- name: Configure shell
run: |
echo "PATH=$(brew --prefix)/opt/ccache/libexec:$PATH" >> $GITHUB_ENV
echo 'ADDITIONAL_CMAKE_OPTIONS=-DPython3_ROOT_DIR=${pythonLocation}' >> $GITHUB_ENV
- name: Build & Test
run: |
env
which cmake && cmake --version
which make && make --version
which python && python --version
which $CC && $CC --version
which $CXX && $CXX --version
make release
make test
msys2-gcc:
name: msys2-gcc
runs-on: windows-2022
defaults:
run:
shell: msys2 {0}
steps:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8
architecture: x64
- name: Setup Python Packages
shell: cmd
run: pip3 install orderedmultidict
- name: Setup Msys2
uses: msys2/setup-msys2@v2
with:
msystem: MSYS
update: true
install: make cmake ninja gcc python git
env:
MSYS2_PATH_TYPE: inherit
- name: Git pull
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Configure shell
run: |
export Py3_ROOT_DIR=`cygpath -u $pythonLocation`
echo 'CC=gcc' >> $GITHUB_ENV
echo 'CXX=g++' >> $GITHUB_ENV
echo 'PREFIX=$PWD/install' >> $GITHUB_ENV
echo 'CMAKE_GENERATOR=Ninja' >> $GITHUB_ENV
echo 'NO_TCMALLOC=On' >> $GITHUB_ENV
echo 'TEST_TMPDIR=C:\temp' >> $GITHUB_ENV
echo "Py3_ROOT_DIR=$Py3_ROOT_DIR" >> $GITHUB_ENV
echo "ADDITIONAL_CMAKE_OPTIONS=-DPython3_ROOT_DIR=$Py3_ROOT_DIR" >> $GITHUB_ENV
echo "$Py3_ROOT_DIR" >> $GITHUB_PATH
- name: Build & Test
run: |
export PATH=$Py3_ROOT_DIR:$PATH
env
where cmake && cmake --version
where make && make --version
where ninja && ninja --version
where python && python --version
where $CC && $CC --version
where $CXX && $CXX --version
make release
make test
make install
make test_install
windows-msvc:
name: windows-cl
runs-on: windows-2022
defaults:
run:
shell: cmd
steps:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8
architecture: x64
- name: Install Core Dependencies
run: |
choco install -y make
pip3 install orderedmultidict
- run: git config --global core.autocrlf input
shell: bash
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Build & Test
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
set CC=cl
set CXX=cl
set PREFIX=%GITHUB_WORKSPACE%\install
set CMAKE_GENERATOR=Ninja
set NO_TCMALLOC=On
set CPU_CORES=%NUMBER_OF_PROCESSORS%
set MAKE_DIR=C:\make\bin
set TEST_TMPDIR=C:\temp
set ADDITIONAL_CMAKE_OPTIONS=-DPython3_ROOT_DIR=%pythonLocation%
set PATH=%pythonLocation%;%MAKE_DIR%;%PATH%
set
where cmake && cmake --version
where make && make --version
where ninja && ninja --version
where python && python --version
make release
if %errorlevel% neq 0 exit /b %errorlevel%
make test
if %errorlevel% neq 0 exit /b %errorlevel%
make install
if %errorlevel% neq 0 exit /b %errorlevel%
make test_install
release-tagging:
name: Version Tagging
runs-on: ubuntu-20.04
if: ${{github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')}}
permissions:
contents: write
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Tag with CMake version if not already.
run: |
git config --local user.name "Development Bot"
git config --local user.email "uhdm-dev@chipsalliance.org"
# We want to tag whenever the cmake version changes. So extract the
# hash of when the current version was entered.
read TAG_HASH TAG_VERSION <<<$(git annotate -l CMakeLists.txt | sed 's/\(^[0-9A-Fa-f]\+\).*project(UHDM VERSION \([0-9]\+\.[0-9]\+\).*/\1 \2/p;d')
echo "UHDM Version v${TAG_VERSION} at hash ${TAG_HASH}"
# If this is the first time we see this tag: apply.
if [ -z "$(git tag -l "v${TAG_VERSION}")" ]; then
git tag -a "v${TAG_VERSION}" ${TAG_HASH} -m "Update to v${TAG_VERSION}"
git push origin "v${TAG_VERSION}"
else
echo "Tag already applied"
fi