Bump docker/metadata-action from 3.3.0 to 5.0.0 (#79) #180
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# run CMake build on Windows and Linux | |
name: CMake Build Multi-Platform | |
on: | |
push: | |
branches: [ "development", "main", "release" ] | |
pull_request: | |
branches: [ "development", "main", "release" ] | |
permissions: | |
contents: write | |
env: | |
VCPKG_ROOT: ${{ github.workspace }}/vcpkg | |
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite' | |
# support for GH dependency graph vcpkg integration | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
VCPKG_FEATURE_FLAGS: dependencygraph | |
ARTIFACTS_DIR: ${{ github.workspace }}/artifacts | |
ARTIFACTS_DIR_WIN: ${{ github.workspace }}\artifacts | |
jobs: | |
build: | |
name: CMake-Multi-Platform-Build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable. | |
fail-fast: false | |
matrix: | |
include: | |
# Windows x64 Release | |
- os: windows-2022 | |
preset: x64-release | |
# Linux x64 Release | |
- os: ubuntu-22.04 | |
preset: linux-release | |
# MacOS x64 Release | |
- os: macos-12 | |
preset: macos-release | |
# Linux mingw x64 Release | |
# - os: ubuntu-22.04 | |
# preset: linux-mingw-w64-release | |
# # Linux Python Release | |
# - os: ubuntu-22.04 | |
# preset: python-linux-release | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
# add problem matchers by compiler | |
- name: Add Problem Matchers | |
uses: ammaraskar/msvc-problem-matcher@13149ebc00eaa00eadcd81b204d7159cca5de4fd # master | |
if: matrix.os == 'windows-2022' | |
- name: Add Problem Matchers | |
uses: ammaraskar/gcc-problem-matcher@d1fed1fac9e94d30e23b5a82dba4e2963e71d2e7 # master | |
if: matrix.os != 'windows-2022' | |
- name: Install vcpkg Dependencies | |
run: | | |
sudo apt update | |
sudo apt install -y -q --no-install-recommends build-essential tar curl zip unzip | |
if: matrix.os == 'ubuntu-22.04' | |
# | |
# os != windows-2022 (i.e. Linux, MacOS) | |
# | |
- name: Install vcpkg | |
run: | | |
git clone https://github.com/Microsoft/vcpkg.git ${{env.VCPKG_ROOT}} | |
"${{env.VCPKG_ROOT}}/bootstrap-vcpkg.sh" | |
# (Windows comes w/ vcpkg installed as part of VS) | |
if: matrix.os != 'windows-2022' | |
- name: Install Ninja | |
uses: seanmiddleditch/gha-setup-ninja@8b297075da4cd2a5f1fd21fe011b499edf06e9d2 # master | |
if: matrix.os != 'windows-2022' | |
# Export vcpkg Cache Variables | |
- name : Export vcpkg Cache Variables | |
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 | |
with: | |
script: | | |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); | |
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); | |
# # | |
# # preset == linux-mingw-w64-release | |
# # | |
# - name: Install mingw-w64 | |
# run: | | |
# sudo apt-get update | |
# sudo apt-get install -y --no-install-recommends mingw-w64 | |
# if: matrix.preset == 'linux-mingw-w64-release' | |
# | |
# os == windows-2022 | |
# | |
- name: Setup VC Tools | |
uses: ilammy/msvc-dev-cmd@7315a94840631165970262a99c72cfb48a65d25d # v1.12.0 | |
if: matrix.os == 'windows-2022' | |
- name: Patch vcpkg | |
run: scripts/patch-vcpkg-install.ps1 | |
if: matrix.os == 'windows-2022' | |
# # | |
# # preset == python-x64-release | |
# # | |
# - name: Generate SWIG Bindings | |
# run: | | |
# sudo apt-get update | |
# sudo apt-get install -y --no-install-recommends swig | |
# chmod +x ./scripts/generate-python-module.sh | |
# ./scripts/generate-python-module.sh | |
# if: matrix.preset == 'python-linux-release' | |
- name: Manual vcpkg Install (Non-Windows) | |
run: "\"${{env.VCPKG_ROOT}}/vcpkg\" install" | |
if: matrix.preset != 'linux-mingw-w64-release' && matrix.os != 'windows-2022' | |
- name: Manual vcpkg Install (Windows) | |
run: "& \"${{env.VCPKG_ROOT}}/vcpkg\" install --triplet x64-windows" | |
if: matrix.os == 'windows-2022' | |
# - name: Manual vcpkg Install (mingw-w64) | |
# run: "\"${{env.VCPKG_ROOT}}/vcpkg\" install --triplet x64-mingw-static" | |
# if: matrix.preset == 'linux-mingw-w64-release' | |
# | |
# CMake Build - All platforms | |
# | |
- name: CMake Configure | |
run: cmake --preset ${{matrix.preset}} | |
- name: CMake Build | |
run: cmake --build --preset ${{matrix.preset}} | |
- name: CMake Test | |
run: ctest --preset ${{matrix.preset}} -V | |
# | |
# Artifacts | |
# | |
- name: Compress Artifacts (Linux) | |
if: matrix.os == 'ubuntu-22.04' | |
run: | | |
mkdir ${{env.ARTIFACTS_DIR}} | |
cp ./out/build/${{matrix.preset}}/OdbDesignLib/*.so ${{env.ARTIFACTS_DIR}} | |
cp ./out/build/${{matrix.preset}}/Utils/*.so ${{env.ARTIFACTS_DIR}} | |
cp ./out/build/${{matrix.preset}}/OdbDesignServer/OdbDesignServer ${{env.ARTIFACTS_DIR}} | |
cd ${{env.ARTIFACTS_DIR}} | |
zip -r ./artifacts-${{matrix.os}}.zip ./*.so ./OdbDesignServer | |
- name: Compress Artifacts (MacOS) | |
if: matrix.os == 'macos-12' | |
run: | | |
mkdir ${{env.ARTIFACTS_DIR}} | |
cp ./out/build/${{matrix.preset}}/OdbDesignLib/*.dylib ${{env.ARTIFACTS_DIR}} | |
cp ./out/build/${{matrix.preset}}/Utils/*.dylib ${{env.ARTIFACTS_DIR}} | |
cp ./out/build/${{matrix.preset}}/OdbDesignServer/OdbDesignServer ${{env.ARTIFACTS_DIR}} | |
cd ${{env.ARTIFACTS_DIR}} | |
zip -r ./artifacts-${{matrix.os}}.zip ./*.dylib ./OdbDesignServer | |
- name: Compress Artifacts (Windows) | |
if: matrix.os == 'windows-2022' | |
run: | | |
New-Item -ItemType Directory -Force -Path ${{env.ARTIFACTS_DIR_WIN}} -Verbose | |
Copy-Item -Path ".\out\build\${{matrix.preset}}\*.dll" -Destination ${{env.ARTIFACTS_DIR_WIN}} -Force -Verbose | |
Copy-Item -Path ".\out\build\${{matrix.preset}}\OdbDesignServer.exe" -Destination ${{env.ARTIFACTS_DIR_WIN}} -Force -Verbose | |
Compress-Archive -Path "${{env.ARTIFACTS_DIR_WIN}}\*.dll","${{env.ARTIFACTS_DIR_WIN}}\*.exe" -DestinationPath "${{env.ARTIFACTS_DIR_WIN}}\artifacts-${{matrix.os}}.zip" -Verbose -Force | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 | |
with: | |
name: ${{ matrix.os }}-artifacts | |
path: ${{ env.ARTIFACTS_DIR }}/artifacts-${{matrix.os}}.zip | |
retention-days: 1 | |
release: | |
# only on pushes to the release branch | |
name: Create Release | |
needs: build | |
if: ${{ (github.ref_name == 'release') && github.event_name == 'push' }} | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
# download the artifacts | |
- name: "Download artifacts" | |
uses: "actions/download-artifact@cbed621e49e4c01b044d60f6c80ea4ed6328b281 # v2.1.1" | |
with: | |
path: ${{ github.workspace }}/artifacts | |
- name: Create Release Variables | |
run: | | |
export RELEASE_VERSION="${{vars.RELEASE_VERSION_PREFIX}}.${{github.run_number}}" | |
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV | |
export RELEASE_TAG="v${RELEASE_VERSION}" | |
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV | |
export RELEASE_NAME="OdbDesign ${RELEASE_TAG}" | |
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV | |
- name: Rename Artifacts | |
run: | | |
mv ${{ github.workspace }}/artifacts/ubuntu-22.04-artifacts/artifacts-ubuntu-22.04.zip ${{ github.workspace }}/artifacts/OdbDesign-Linux-x64.zip | |
mv ${{ github.workspace }}/artifacts/windows-2022-artifacts/artifacts-windows-2022.zip ${{ github.workspace }}/artifacts/OdbDesign-Windows-x64.zip | |
mv ${{ github.workspace }}/artifacts/macos-12-artifacts/artifacts-macos-12.zip ${{ github.workspace }}/artifacts/OdbDesign-MacOS-x64.zip | |
# create a release | |
- name: "Create GitHub Release" | |
uses: "actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1" | |
with: | |
github-token: "${{ secrets.GITHUB_TOKEN }}" | |
script: | | |
try { | |
const createResponse = await github.rest.repos.createRelease({ | |
generate_release_notes: true, | |
name: process.env.RELEASE_NAME, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
tag_name: process.env.RELEASE_TAG, | |
body: require('fs').readFileSync('${{ github.workspace }}/release/release-body.md', 'utf8'), | |
target_commitish: '${{ github.ref_name }}' | |
}); | |
const filenames = [ | |
'OdbDesign-Linux-x64.zip', | |
'OdbDesign-Windows-x64.zip', | |
'OdbDesign-MacOS-x64.zip' | |
]; | |
for (const filename of filenames) { | |
const artifactsPath = '${{ github.workspace }}/artifacts'; | |
const filePath = artifactsPath +'/' + filename; | |
const uploadResponse = await github.rest.repos.uploadReleaseAsset({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
release_id: createResponse.data.id, | |
name: filename, | |
data: require('fs').readFileSync(filePath), | |
headers: { | |
'content-type': 'application/zip', | |
'content-length': require('fs').statSync(filePath).size | |
} | |
}); | |
} | |
} catch (error) { | |
core.setFailed(error.message); | |
} |