Skip to content

Update workflow scripts to generate outputs to conform with Davenche #12

Update workflow scripts to generate outputs to conform with Davenche

Update workflow scripts to generate outputs to conform with Davenche #12

Workflow file for this run

name: 'davenche'
concurrency:
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on: [ push ]
env:
MODULE_NAME: CopperSpice
jobs:
build:
strategy:
fail-fast: false
matrix:
config:
- { group: cs-ubuntu-22.04, artifact-tag: jammy-gcc, build-type: debug }
- { group: cs-ubuntu-22.04, artifact-tag: jammy-gcc, build-type: release }
- { group: cs-windows-2022, artifact-tag: windows-cl, build-type: debug }
- { group: cs-windows-2022, artifact-tag: windows-cl, build-type: release }
runs-on: ${{ matrix.config.group }}
steps:
- name: Install Core Dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update -qq
sudo apt install -y cmake
sudo apt install -y ninja-build
sudo apt install -y libaudio-dev
sudo apt install -y libc6-dev
sudo apt install -y libfontconfig1-dev
sudo apt install -y libfreetype6-dev
sudo apt install -y libgl1-mesa-dev
sudo apt install -y libglib2.0-dev
sudo apt install -y libunwind-dev
sudo apt install -y libgstreamer-plugins-base1.0-dev
sudo apt install -y libgstreamer1.0-dev
sudo apt install -y libice-dev
sudo apt install -y libsm-dev
sudo apt install -y libx11-dev
sudo apt install -y libx11-xcb-dev
sudo apt install -y libxcb-glx0-dev
sudo apt install -y libxcb-icccm4-dev
sudo apt install -y libxcb-image0-dev
sudo apt install -y libxcb-keysyms1-dev
sudo apt install -y libxcb-randr0-dev
sudo apt install -y libxcb-render-util0-dev
sudo apt install -y libxcb-render0-dev
sudo apt install -y libxcb-shape0-dev
sudo apt install -y libxcb-shm0-dev
sudo apt install -y libxcb-sync-dev
sudo apt install -y libxcb-xfixes0-dev
sudo apt install -y libxcb-xinerama0-dev
sudo apt install -y libxcb-xkb-dev
sudo apt install -y libxcb1-dev
sudo apt install -y libxcursor-dev
sudo apt install -y libxext-dev
sudo apt install -y libxfixes-dev
sudo apt install -y libxi-dev
sudo apt install -y libxinerama-dev
sudo apt install -y libxkbcommon-dev
sudo apt install -y libxkbcommon-x11-dev
sudo apt install -y libxrandr-dev
sudo apt install -y libxrender-dev
- name: Get top commit details
uses: actions/[email protected]
id: author-date
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const commit_details = await github.git.getCommit({
owner: context.repo.owner,
repo: context.repo.repo,
commit_sha: context.sha });
return commit_details.data.author.date
- name: Setup environment
shell: bash
run: |
git config --global core.autocrlf input
echo "ARTIFACT_NAME=${{ env.MODULE_NAME }}_${{ matrix.config.artifact-tag }}_${{ matrix.config.build-type }}" >> $GITHUB_ENV
- name: Move builds to C:\ drive
if: runner.os == 'Windows'
shell: cmd
run: |
mkdir C:\${{ env.MODULE_NAME }}
cd /D C:\${{ env.MODULE_NAME }}
rd /S /Q %GITHUB_WORKSPACE%
mklink /D %GITHUB_WORKSPACE% C:\${{ env.MODULE_NAME }}
- name: Git pull
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Build
if: runner.os == 'Linux'
env:
CC: gcc-11
CXX: g++-11
run: |
env
which cmake && cmake --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 \
-DCMAKE_INSTALL_PREFIX=out/install \
-DCMAKE_POLICY_DEFAULT_CMP0091=NEW \
-DWITH_MULTIMEDIA=OFF \
-DWITH_SQL=OFF \
-DWITH_WEBKIT=OFF \
-DWITH_PSQL_PLUGIN=OFF \
-DWITH_MYSQL_PLUGIN=OFF \
-DWITH_XMLPATTERNS=OFF \
-DWITH_SCRIPT=OFF \
-DCMAKE_DISABLE_FIND_PACKAGE_OpenSSL=TRUE \
-DCMAKE_CXX_FLAGS=-Wno-register \
-S . -B out/build
else
cmake \
-G Ninja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX=out/install \
-DCMAKE_POLICY_DEFAULT_CMP0091=NEW \
-DWITH_MULTIMEDIA=OFF \
-DWITH_SQL=OFF \
-DWITH_WEBKIT=OFF \
-DWITH_PSQL_PLUGIN=OFF \
-DWITH_MYSQL_PLUGIN=OFF \
-DWITH_XMLPATTERNS=OFF \
-DWITH_SCRIPT=OFF \
-DCMAKE_DISABLE_FIND_PACKAGE_OpenSSL=TRUE \
-DCMAKE_CXX_FLAGS=-Wno-register \
-S . -B out/build
fi
cmake --build out/build -j `nproc`
cmake --install out/build
- name: Build
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"
set
where cmake && cmake --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 ^
-DCMAKE_INSTALL_PREFIX=out/install ^
-DCMAKE_POLICY_DEFAULT_CMP0091=NEW ^
-DWITH_MULTIMEDIA=OFF ^
-DWITH_SQL=OFF ^
-DWITH_WEBKIT=OFF ^
-DWITH_PSQL_PLUGIN=OFF ^
-DWITH_MYSQL_PLUGIN=OFF ^
-DWITH_XMLPATTERNS=OFF ^
-DWITH_SCRIPT=OFF ^
-DCMAKE_DISABLE_FIND_PACKAGE_OpenSSL=TRUE ^
-S . -B out/build
) else (
cmake ^
-G Ninja ^
-DCMAKE_BUILD_TYPE=RelWithDebInfo ^
-DCMAKE_INSTALL_PREFIX=out/install ^
-DCMAKE_POLICY_DEFAULT_CMP0091=NEW ^
-DWITH_MULTIMEDIA=OFF ^
-DWITH_SQL=OFF ^
-DWITH_WEBKIT=OFF ^
-DWITH_PSQL_PLUGIN=OFF ^
-DWITH_MYSQL_PLUGIN=OFF ^
-DWITH_XMLPATTERNS=OFF ^
-DWITH_SCRIPT=OFF ^
-DCMAKE_DISABLE_FIND_PACKAGE_OpenSSL=TRUE ^
-S . -B out/build
)
cmake --build out/build -j %NUMBER_OF_PROCESSORS%
if %errorlevel% neq 0 exit /b %errorlevel%
cmake --install out/build
- name: Build compressed artifacts
shell: bash
run: |
cd out
mv install ${{ env.ARTIFACT_NAME }}
tar czfp ${{ env.ARTIFACT_NAME }}.tgz ${{ env.ARTIFACT_NAME }}
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}
path: out/${{ env.ARTIFACT_NAME }}.tgz
deploy:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/Davenche'
steps:
- name: Get top commit details
uses: actions/[email protected]
id: author-date
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const commit_details = await github.git.getCommit({
owner: context.repo.owner,
repo: context.repo.repo,
commit_sha: context.sha });
return commit_details.data.author.date
- 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_JAMMY_GCC_DEBUG=${{ env.MODULE_NAME }}_jammy-gcc_debug" >> $GITHUB_ENV
echo "ARTIFACT_JAMMY_GCC_RELEASE=${{ env.MODULE_NAME }}_jammy-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 artifacts (jammy-gcc_debug)
uses: actions/download-artifact@v3
with:
name: ${{ env.ARTIFACT_JAMMY_GCC_DEBUG }}
- name: Download artifact (jammy-gcc_release)
uses: actions/download-artifact@v3
with:
name: ${{ env.ARTIFACT_JAMMY_GCC_RELEASE }}
- name: Download artifact (windows-cl_debug)
uses: actions/download-artifact@v3
with:
name: ${{ env.ARTIFACT_WINDOWS_CL_DEBUG }}
- name: Download artifact (windows-cl_release)
uses: actions/download-artifact@v3
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 (jammy-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_JAMMY_GCC_DEBUG }}.tgz
asset_name: 'jammy-gcc_debug.tgz'
asset_content_type: application/zip
- name: Upload Release Asset (jammy-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_JAMMY_GCC_RELEASE }}.tgz
asset_name: 'jammy-gcc_release.tgz'
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 }}.tgz
asset_name: 'windows-cl_debug.tgz'
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 }}.tgz
asset_name: 'windows-cl_release.tgz'
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 }}