Skip to content

Implement directives #512

Implement directives

Implement directives #512

Workflow file for this run

name: 'main'
concurrency:
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
workflow_dispatch:
env:
MODULE_NAME: Surelog
PYTHON3_VERSION: 3.8.6
JAVA_VERSION: 11
SURELOG_WITH_TCMALLOC: Off
jobs:
build:
name: "Build | ${{ matrix.config.artifact-tag }} | ${{ matrix.config.build-type }}"
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- { os: ubuntu-20.04, artifact-tag: focal-gcc, build-type: debug }
- { os: ubuntu-20.04, artifact-tag: focal-gcc, build-type: release }
- { os: windows-2022, artifact-tag: windows-cl, build-type: debug }
- { os: windows-2022, artifact-tag: windows-cl, build-type: release }
env:
artifact-name: Surelog_${{ matrix.config.artifact-tag }}_${{ matrix.config.build-type }}_${{ github.run_number }}
steps:
- name: Install Core Dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update -qq
sudo apt install -y g++-9
sudo apt install -y default-jre
sudo apt install -y cmake
sudo apt install -y build-essential
sudo apt install -y uuid-dev
sudo apt install -y ninja-build
- name: Setup Python
uses: actions/[email protected]
with:
python-version: ${{ env.PYTHON3_VERSION }}
architecture: 'x64'
- name: Install Core Dependencies
if: runner.os == 'Windows'
shell: cmd
run: |
choco install -y python3 --version=${{ env.PYTHON3_VERSION }} --installargs="/quiet Include_debug=1 TargetDir=%pythonLocation%"
vcpkg install zlib zlib:x64-windows
- name: Setup Python Packages
run: |
pip3 install orderedmultidict
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ env.JAVA_VERSION }}
java-package: jre
architecture: x64
- name: Move builds to C:\ drive
if: runner.os == 'Windows'
shell: cmd
run: |
mkdir C:\Surelog
cd /D C:\Surelog
rd /S /Q %GITHUB_WORKSPACE%
mklink /D %GITHUB_WORKSPACE% C:\Surelog
- name: Git Pull
uses: actions/[email protected]
with:
submodules: recursive
fetch-depth: 0
- name: Build on Linux
if: runner.os == 'Linux'
shell: bash
env:
CC: gcc-9
CXX: g++-9
run: |
env
which cmake && cmake --version
which java && java -version
which python && python --version
which ninja && ninja --version
which $CC && $CC --version
which $CXX && $CXX --version
if [[ "${{ matrix.config.build-type }}" == "debug" ]]; then
cmake -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DPython3_ROOT_DIR=$pythonLocation \
-DWITH_STATIC_CRT=0 \
-DCMAKE_INSTALL_PREFIX=out/install \
-S . -B out/build
else
cmake -G Ninja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DPython3_ROOT_DIR=$pythonLocation \
-DWITH_STATIC_CRT=0 \
-DCMAKE_INSTALL_PREFIX=out/install \
-S . -B out/build
fi
cmake --build out/build -j `nproc`
cmake --install out/build
- name: Build on Windows
if: runner.os == 'Windows'
shell: cmd
env:
CC: cl
CXX: cl
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
if %errorlevel% neq 0 exit /b %errorlevel%
set PATH=%JAVA_HOME%\bin;%PATH%
set
where cmake && cmake --version
where java && java -version
where python && python --version
where ninja && ninja --version
where %CC% && %CC%
where %CXX% && %CXX%
if "${{ matrix.config.build-type }}" EQU "debug" (
cmake -G Ninja^
-DCMAKE_BUILD_TYPE=Debug^
-DPython3_ROOT_DIR=%pythonLocation%^
-DWITH_STATIC_CRT=0^
-DCMAKE_INSTALL_PREFIX=out/install^
-S . -B out/build
) else (
cmake -G Ninja^
-DCMAKE_BUILD_TYPE=RelWithDebInfo^
-DPython3_ROOT_DIR=%pythonLocation%^
-DWITH_STATIC_CRT=0^
-DCMAKE_INSTALL_PREFIX=out/install^
-DCMAKE_TOOLCHAIN_FILE=%VCPKG_INSTALLATION_ROOT%/scripts/buildsystems/vcpkg.cmake.^
-S . -B out/build
)
if %errorlevel% neq 0 exit /b %errorlevel%
cmake --build out/build -j %NUMBER_OF_PROCESSORS%
if %errorlevel% neq 0 exit /b %errorlevel%
cmake --install out/build
- name: Build compressed artifacts
if: always()
shell: bash
run: |
cp deploy/CMakeLists.txt out/install/.
cd out
mv install/lib install/${{ matrix.config.artifact-tag }}_${{ matrix.config.build-type }}
mkdir install/lib
mv install/${{ matrix.config.artifact-tag }}_${{ matrix.config.build-type }} install/lib/.
mv install/bin install/${{ matrix.config.artifact-tag }}_${{ matrix.config.build-type }}
mkdir install/bin
mv install/${{ matrix.config.artifact-tag }}_${{ matrix.config.build-type }} install/bin/.
mv install ${{ env.artifact-name }}
tar czfp ${{ env.artifact-name }}.tar.gz ${{ env.artifact-name }}
- name: Archive artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: ${{ env.artifact-name }}
path: out/${{ env.artifact-name }}.tar.gz
#######################################################################################################################
test:
name: "Test | ${{ matrix.config.artifact-tag }} | ${{ matrix.shard }}"
needs: build
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
num_shards: [6]
shard: [0, 1, 2, 3, 4, 5]
config:
- { os: ubuntu-20.04, artifact-tag: focal-gcc, build-type: release }
- { os: windows-2022, artifact-tag: windows-cl, build-type: release }
env:
build-artifact-name: Surelog_${{ matrix.config.artifact-tag }}_${{ matrix.config.build-type }}_${{ github.run_number }}
regression-artifact-name: Surelog_regression_${{ matrix.config.artifact-tag }}_${{ matrix.config.build-type }}_${{ github.run_number }}_${{ matrix.shard }}
steps:
- name: Setup Python
uses: actions/[email protected]
with:
python-version: ${{ env.PYTHON3_VERSION }}
architecture: 'x64'
- name: Setup Python Packages
run: |
pip3 install orderedmultidict
pip3 install psutil
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.build-artifact-name }}
- name: Extract artifact
shell: bash
run: |
# This has to be a separate step and run under bash since tar on Windows
# still doesn't support symlink and the root repository folder is a symlink.
tar xzfp ${{ env.build-artifact-name }}.tar.gz
mv ${{ env.build-artifact-name }} build
rm ${{ env.build-artifact-name }}.tar.gz
- name: Run regression
if: runner.os == 'Linux'
shell: bash
timeout-minutes: 120
run: |
python3 scripts/regression.py run \
--build-dirpath build/bin/${{ matrix.config.artifact-tag }}_${{ matrix.config.build-type }} \
--surelog-filepath surelog \
--uhdm-lint-filepath uhdm-lint \
--roundtrip-filepath roundtrip \
--output-dirpath ../../regression \
--jobs $(nproc) \
--show-diffs \
--num_shards=${{ matrix.num_shards }} \
--shard=${{ matrix.shard }}
git status
- name: Run regression
if: runner.os == 'Windows'
shell: cmd
timeout-minutes: 120
run: |
python3 scripts/regression.py run^
--build-dirpath build/bin/${{ matrix.config.artifact-tag }}_${{ matrix.config.build-type }}^
--surelog-filepath surelog.exe^
--uhdm-lint-filepath uhdm-lint.exe^
--roundtrip-filepath roundtrip.exe^
--output-dirpath ../../regression^
--jobs %NUMBER_OF_PROCESSORS%^
--show-diffs^
--num_shards=${{ matrix.num_shards }}^
--shard=${{ matrix.shard }}
if %errorlevel% neq 0 exit /b %errorlevel%
git status
- name: Prepare regression artifacts
if: always()
run: |
ls -l build
cd build
ls -l regression
mv regression ${{ env.regression-artifact-name }}
find ${{ env.regression-artifact-name }} -name "*.tar.gz" | tar czfp ${{ env.regression-artifact-name }}.tar.gz -T -
- name: Archive artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: ${{ env.regression-artifact-name }}
path: build/${{ env.regression-artifact-name }}.tar.gz
#######################################################################################################################
#
# deploy:
# name: "Deploy | ${{ matrix.config.artifact-tag }} | ${{ matrix.config.artifact-tag }}"
# if: github.ref == 'refs/heads/master'
#
# needs: test
# runs-on: ubuntu-latest
#
# strategy:
# fail-fast: false
# matrix:
# config:
# - { os: ubuntu-20.04, artifact-tag: focal-gcc, build-type: debug }
# - { os: ubuntu-20.04, artifact-tag: focal-gcc, build-type: release }
# - { os: windows-2022, artifact-tag: windows-cl, build-type: debug }
# - { os: windows-2022, artifact-tag: windows-cl, build-type: release }
#
# env:
# artifact-name: Surelog_${{ matrix.config.artifact-tag }}_${{ matrix.config.build-type }}_${{ github.run_number }}
#
# steps:
# - name: Setup environment
# run: |
# export COMMITTED_AT=$(date -d ${{ steps.author-date.outputs.result }} +'%Y.%m.%d_%H.%M.%S')
# echo "COMMITTED_AT=$COMMITTED_AT" >> $GITHUB_ENV
# echo "ARTIFACT_BIONIC_GCC_DEBUG=${{ env.MODULE_NAME }}-bionic-gcc-debug" >> $GITHUB_ENV
# echo "ARTIFACT_BIONIC_GCC_RELEASE=${{ env.MODULE_NAME }}-bionic-gcc-release" >> $GITHUB_ENV
# echo "ARTIFACT_WINDOWS_CL_DEBUG=${{ env.MODULE_NAME }}-windows-cl-debug" >> $GITHUB_ENV
# echo "ARTIFACT_WINDOWS_CL_RELEASE=${{ env.MODULE_NAME }}-windows-cl-release" >> $GITHUB_ENV
#
# - name: Download artifact (bionic-gcc-debug)
# uses: actions/download-artifact@v2
# with:
# name: ${{ env.ARTIFACT_BIONIC_GCC_DEBUG }}
#
# - name: Download artifact (bionic-gcc-release)
# uses: actions/download-artifact@v2
# with:
# name: ${{ env.ARTIFACT_BIONIC_GCC_RELEASE }}
#
# - name: Download artifact (windows-cl-debug)
# uses: actions/download-artifact@v2
# with:
# name: ${{ env.ARTIFACT_WINDOWS_CL_DEBUG }}
#
# - name: Download artifact (windows-cl-release)
# uses: actions/download-artifact@v2
# with:
# name: ${{ env.ARTIFACT_WINDOWS_CL_RELEASE }}
#
# - name: List directory contents
# run: ls -R
#
# - name: Create Release
# id: create_release
# uses: actions/create-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: ${{ env.COMMITTED_AT }}
# release_name: ${{ env.MODULE_NAME }}
# draft: false
# prerelease: false
#
# - name: Upload Release Asset (bionic-gcc-debug)
# uses: actions/[email protected]
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: ${{ env.ARTIFACT_BIONIC_GCC_DEBUG }}.tar.gz
# asset_name: 'bionic-gcc-debug.tar.gz'
# asset_content_type: application/zip
#
# - name: Upload Release Asset (bionic-gcc-release)
# uses: actions/[email protected]
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: ${{ env.ARTIFACT_BIONIC_GCC_RELEASE }}.tar.gz
# asset_name: 'bionic-gcc-release.tar.gz'
# asset_content_type: application/zip
#
# - name: Upload Release Asset (windows-cl-debug)
# uses: actions/[email protected]
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: ${{ env.ARTIFACT_WINDOWS_CL_DEBUG }}.tar.gz
# asset_name: 'windows-cl-debug.tar.gz'
# asset_content_type: application/zip
#
# - name: Upload Release Asset (windows-cl-release)
# uses: actions/[email protected]
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: ${{ env.ARTIFACT_WINDOWS_CL_RELEASE }}.tar.gz
# asset_name: 'windows-cl-release.tar.gz'
# asset_content_type: application/zip
#
# - name: Delete some old releases
# uses: dev-drprasad/[email protected]
# with:
# keep_latest: 5
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}