-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use freecad github workflow to build windows binary
- Loading branch information
Showing
10 changed files
with
637 additions
and
109 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# SPDX-License-Identifier: LGPL-2.1-or-later | ||
# *************************************************************************** | ||
# * * | ||
# * Copyright (c) 2023 0penBrain. * | ||
# * * | ||
# * This file is part of FreeCAD. * | ||
# * * | ||
# * FreeCAD is free software: you can redistribute it and/or modify it * | ||
# * under the terms of the GNU Lesser General Public License as * | ||
# * published by the Free Software Foundation, either version 2.1 of the * | ||
# * License, or (at your option) any later version. * | ||
# * * | ||
# * FreeCAD is distributed in the hope that it will be useful, but * | ||
# * WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * | ||
# * Lesser General Public License for more details. * | ||
# * * | ||
# * You should have received a copy of the GNU Lesser General Public * | ||
# * License along with FreeCAD. If not, see * | ||
# * <https://www.gnu.org/licenses/>. * | ||
# * * | ||
# *************************************************************************** | ||
|
||
# This is the master workflow for CI of I-SIMPA. | ||
# It (only) aims at properly organizing the sub-workflows. | ||
|
||
name: I-SIMPA master CI | ||
|
||
on: [workflow_dispatch, push, pull_request] | ||
|
||
concurrency: | ||
group: IS-CI-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
|
||
Prepare: | ||
uses: ./.github/workflows/sub_prepare.yml | ||
with: | ||
artifactBasename: Prepare-${{ github.run_id }} | ||
|
||
Linux: | ||
needs: [Prepare] | ||
uses: ./.github/workflows/sub_buildLinux.yml | ||
with: | ||
artifactBasename: Linux-${{ github.run_id }} | ||
|
||
Windows: | ||
needs: [Prepare] | ||
uses: ./.github/workflows/sub_buildWindows.yml | ||
with: | ||
artifactBasename: Windows-${{ github.run_id }} | ||
|
||
WrapUp: | ||
needs: [ | ||
Prepare, | ||
Linux, | ||
Windows | ||
] | ||
if: always() | ||
uses: ./.github/workflows/sub_wrapup.yml | ||
with: | ||
previousSteps: ${{ toJSON(needs) }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# SPDX-License-Identifier: LGPL-2.1-or-later | ||
# *************************************************************************** | ||
# * * | ||
# * Copyright (c) 2023 0penBrain. * | ||
# * * | ||
# * This file is part of FreeCAD. * | ||
# * * | ||
# * FreeCAD is free software: you can redistribute it and/or modify it * | ||
# * under the terms of the GNU Lesser General Public License as * | ||
# * published by the Free Software Foundation, either version 2.1 of the * | ||
# * License, or (at your option) any later version. * | ||
# * * | ||
# * FreeCAD is distributed in the hope that it will be useful, but * | ||
# * WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * | ||
# * Lesser General Public License for more details. * | ||
# * * | ||
# * You should have received a copy of the GNU Lesser General Public * | ||
# * License along with FreeCAD. If not, see * | ||
# * <https://www.gnu.org/licenses/>. * | ||
# * * | ||
# *************************************************************************** | ||
|
||
# This action aims at speeding up CI and reduce dependency to external resources | ||
# by creating a cache of Ccache needed binaries then using it for CI runs rather | ||
# than downloading every time. | ||
# | ||
# If it needs to be updated to another version, the process it to change | ||
# 'downloadpath' and 'version' inputs below then delete the existing cache | ||
# from Github interface so a new one is generated using new values. | ||
|
||
name: getCcache | ||
description: "Windows: tries to get a cached version of Ccache and create one if fails" | ||
|
||
inputs: | ||
ccachebindir: | ||
description: "Directory where ccache binaries shall be stored" | ||
required: true | ||
# Below inputs shall generally not be provided as they won't be used if a cached version exists | ||
# They are mainly used because Github do not support adding env variables in a composite action | ||
ccachedownloadpath: | ||
description: "Path where to download ccache" | ||
required: false | ||
default: https://github.com/ccache/ccache/releases/download/v4.9/ | ||
ccacheversion: | ||
description: "Ccache version to be downloaded" | ||
required: false | ||
default: ccache-4.9-windows-x86_64 | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Create destination directory | ||
shell: bash | ||
run: | | ||
mkdir -p ${{ inputs.ccachebindir }} | ||
- name: Get cached version | ||
uses: actions/cache/restore@v4 | ||
id: getCached | ||
with: | ||
path: ${{ inputs.ccachebindir }} | ||
key: ccacheforwin-${{ inputs.ccacheversion }} | ||
- name: Download ccache | ||
shell: bash | ||
if: steps.getCached.outputs.cache-hit != 'true' | ||
run: | | ||
curl -L -o ccache.zip ${{ inputs.ccachedownloadpath }}${{ inputs.ccacheversion }}.zip | ||
7z x ccache.zip -o"ccachetemp" -r -y | ||
cp -a ccachetemp/${{ inputs.ccacheversion }}/ccache.exe ${{ inputs.ccachebindir }} | ||
cp -a ccachetemp/${{ inputs.ccacheversion }}/ccache.exe ${{ inputs.ccachebindir }}/cl.exe | ||
rm ccache.zip | ||
rm -rf ccachetemp | ||
- name: Save version to cache | ||
if: steps.getCached.outputs.cache-hit != 'true' | ||
uses: actions/cache/save@v4 | ||
with: | ||
path: ${{ inputs.ccachebindir }} | ||
key: ${{ steps.getCached.outputs.cache-primary-key }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# SPDX-License-Identifier: LGPL-2.1-or-later | ||
# *************************************************************************** | ||
# * * | ||
# * Copyright (c) 2023 0penBrain. * | ||
# * * | ||
# * This file is part of FreeCAD. * | ||
# * * | ||
# * FreeCAD is free software: you can redistribute it and/or modify it * | ||
# * under the terms of the GNU Lesser General Public License as * | ||
# * published by the Free Software Foundation, either version 2.1 of the * | ||
# * License, or (at your option) any later version. * | ||
# * * | ||
# * FreeCAD is distributed in the hope that it will be useful, but * | ||
# * WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * | ||
# * Lesser General Public License for more details. * | ||
# * * | ||
# * You should have received a copy of the GNU Lesser General Public * | ||
# * License along with FreeCAD. If not, see * | ||
# * <https://www.gnu.org/licenses/>. * | ||
# * * | ||
# *************************************************************************** | ||
|
||
# This action aims at speeding up CI and reduce dependency to external resources | ||
# by creating a cache of Libpack needed files then using it for CI runs rather | ||
# than downloading every time. | ||
# | ||
# If it needs to be updated to another version, the process it to change | ||
# 'downloadpath' and 'version' inputs below then delete the existing cache | ||
# from Github interface so a new one is generated using new values. | ||
|
||
name: getLibpack | ||
description: "Windows: tries to get a cached version of Libpack and create one if fails" | ||
|
||
inputs: | ||
libpackdir: | ||
description: "Directory where libpack files shall be stored" | ||
required: true | ||
# Below inputs shall generally not be provided as they won't be used if a cached version exists | ||
# They are mainly used because Github do not support adding env variables in a composite action | ||
libpackdownloadurl: | ||
description: "URL where to download libpack" | ||
required: false | ||
default: https://github.com/FreeCAD/FreeCAD-LibPack/releases/download/3.0.0RC4/LibPack-1.0.0-v3.0.0RC4-Release.7z | ||
libpackname: | ||
description: "Libpack name (once downloaded)" | ||
required: false | ||
default: LibPack-1.0.0-v3.0.0RC4-Release | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Create destination directory | ||
shell: bash | ||
run: | | ||
mkdir -p ${{ inputs.libpackdir }} | ||
- name: Get cached version | ||
uses: actions/cache/restore@v4 | ||
id: getCached | ||
with: | ||
path: ${{ inputs.libpackdir }} | ||
key: libpackforwin-${{ inputs.libpackname }} | ||
- name: Download libpack | ||
shell: bash | ||
if: steps.getCached.outputs.cache-hit != 'true' | ||
run: | | ||
curl -L -o libpack.7z ${{ inputs.libpackdownloadurl }} | ||
7z x libpack.7z -o"libpacktemp" -r -y | ||
mv libpacktemp/${{ inputs.libpackname }}/* ${{ inputs.libpackdir }} | ||
rm -rf libpacktemp | ||
- name: Save version to cache | ||
if: steps.getCached.outputs.cache-hit != 'true' | ||
uses: actions/cache/save@v4 | ||
with: | ||
path: ${{ inputs.libpackdir }} | ||
key: ${{ steps.getCached.outputs.cache-primary-key }} |
17 changes: 15 additions & 2 deletions
17
.github/workflows/cmake.yml → .github/workflows/sub_buildLinux.yml
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
# *************************************************************************** | ||
# * Copyright (c) 2023 0penBrain * | ||
# * * | ||
# * This program is free software; you can redistribute it and/or modify * | ||
# * it under the terms of the GNU Lesser General Public License (LGPL) * | ||
# * as published by the Free Software Foundation; either version 2 of * | ||
# * the License, or (at your option) any later version. * | ||
# * for detail see the LICENCE text file. * | ||
# * * | ||
# * This program is distributed in the hope that it will be useful, * | ||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
# * GNU Library General Public License for more details. * | ||
# * * | ||
# * You should have received a copy of the GNU Library General Public * | ||
# * License along with this program; if not, write to the Free Software * | ||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * | ||
# * USA * | ||
# * * | ||
# *************************************************************************** | ||
|
||
# This is a build and test workflow for CI of I-SIMPA. | ||
# This workflow aims at building and testing I-SIMPA on Windows using MSVC. | ||
|
||
name: Build Windows | ||
on: | ||
workflow_call: | ||
inputs: | ||
artifactBasename: | ||
type: string | ||
required: true | ||
allowedToFail: | ||
default: false | ||
type: boolean | ||
required: false | ||
outputs: | ||
reportFile: | ||
value: ${{ jobs.Build.outputs.reportFile }} | ||
|
||
jobs: | ||
Build: | ||
runs-on: windows-latest | ||
continue-on-error: ${{ inputs.allowedToFail }} | ||
env: | ||
CCACHE_DIR: C:/ISIMPA/cache/ | ||
CCACHE_COMPILERCHECK: "%compiler%" # default:mtime | ||
CCACHE_MAXSIZE: 1G | ||
CCACHE_COMPRESS: true | ||
CCACHE_COMPRESSLEVEL: 1 | ||
CCACHE_NOHASHDIR: true | ||
CCACHE_DIRECT: true | ||
#CCACHE_SLOPPINESS: "pch_defines,time_macros" # Can't get PCH to work on Windows | ||
CCACHE_LOGFILE: C:/logs/ccache.log | ||
## Have to use C:\ because not enough space on workspace drive | ||
builddir: C:/ISIMPA/build/release/ | ||
libpackdir: C:/ISIMPA/libpack/ | ||
ccachebindir: C:/ISIMPA/ccache/ | ||
logdir: C:/logs/ | ||
reportdir: C:/report/ | ||
reportfilename: ${{ inputs.artifactBasename }}-report.md | ||
outputs: | ||
reportFile: ${{ steps.Init.outputs.reportFile }} | ||
|
||
steps: | ||
- name: Checking out source code | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- name: Make needed directories, files and initializations | ||
id: Init | ||
run: | | ||
mkdir ${{ env.CCACHE_DIR }} | ||
mkdir ${{ env.ccachebindir }} | ||
mkdir ${{ env.libpackdir }} | ||
mkdir ${{ env.builddir }} | ||
mkdir ${{ env.logdir }} | ||
mkdir ${{ env.reportdir }} | ||
echo "reportFile=${{ env.reportfilename }}" >> $GITHUB_OUTPUT | ||
- name: Get Ccache | ||
uses: ./.github/workflows/actions/windows/getCcache | ||
with: | ||
ccachebindir: ${{ env.ccachebindir }} | ||
- name: Get Libpack | ||
uses: ./.github/workflows/actions/windows/getLibpack | ||
with: | ||
libpackdir: ${{ env.libpackdir }} | ||
- name: Restore compiler cache | ||
uses: actions/cache@v4 | ||
with: | ||
save-always: true | ||
path: ${{ env.CCACHE_DIR }} | ||
key: ISIMPA-Windows-${{ github.ref }}-${{ github.run_id }} | ||
restore-keys: | | ||
ISIMPA-Windows-${{ github.ref }}- | ||
ISIMPA-Windows- | ||
- name: Print Ccache statistics before build, reset stats and print config | ||
run: | | ||
. $env:ccachebindir\ccache -s | ||
. $env:ccachebindir\ccache -z | ||
. $env:ccachebindir\ccache -p | ||
- name: Configuring CMake | ||
run: > | ||
cmake -B"${{ env.builddir }}" . | ||
--preset release | ||
-DCMAKE_VS_NO_COMPILE_BATCHING=ON | ||
-DCMAKE_BUILD_TYPE=Release | ||
-DISIMPA_LIBPACK_DIR="${{ env.libpackdir }}" | ||
- name: Add msbuild to PATH | ||
uses: microsoft/setup-msbuild@v2 | ||
- name: Compiling sources | ||
run: | | ||
cd $env:builddir | ||
msbuild ALL_BUILD.vcxproj /m /p:Configuration=Release /p:TrackFileAccess=false /p:CLToolPath=${{ env.ccachebindir }} | ||
- name: Print Ccache statistics after build | ||
run: | | ||
. $env:ccachebindir\ccache -s | ||
- name: Upload logs | ||
if: always() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ inputs.artifactBasename }}-Logs | ||
path: | | ||
${{ env.logdir }} |
Oops, something went wrong.