Skip to content

Commit

Permalink
Merge pull request #7 from shun-iwasawa/github_actions
Browse files Browse the repository at this point in the history
Add GitHub Actions
  • Loading branch information
shun-iwasawa authored Nov 8, 2024
2 parents ebf65e6 + 8dd9023 commit 4fe765a
Show file tree
Hide file tree
Showing 2 changed files with 134 additions and 0 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/workflow_macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: MacOS Build

on: [push, pull_request]

jobs:
macOS:
runs-on: macos-13
steps:
- uses: actions/checkout@v4

- name: Remove symlinks
run: |
# remove existing symlinks before installing [email protected] and 3.11
rm /usr/local/bin/2to3
rm /usr/local/bin/idle3
rm /usr/local/bin/pydoc3
rm /usr/local/bin/python3
rm /usr/local/bin/python3-config
rm /usr/local/bin/2to3-3.11
rm /usr/local/bin/idle3.11
rm /usr/local/bin/pydoc3.11
rm /usr/local/bin/python3.11
rm /usr/local/bin/python3.11-config
- name: Install libraries
run: |
brew update
brew install qt@5 ninja ccache
- uses: actions/cache@v4
with:
path: /Users/runner/.ccache
key: ${{ runner.os }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-

- name: Build
run: |
mkdir build
cd build
cmake ../sources -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DQTDIR='/usr/local/opt/qt@5' -DWITH_TRANSLATION=OFF
ninja
- name: Introduce Libraries and Stuff
run: |
cd build
cp -pr ../xdts_viewer_resources xdts_viewer.app/Contents/MacOS/xdts_viewer_resources
/usr/local/opt/qt@5/bin/macdeployqt xdts_viewer.app -verbose=1 -always-overwrite
- name: Modify Library Paths
run: |
cd build/xdts_viewer.app/Contents/Frameworks
for TARGETLIB in `ls ./ | grep dylib`
do
echo $TARGETLIB
for FROMPATH in `otool -L "$TARGETLIB" | grep ".dylib" | grep -v "$TARGETLIB" | grep -v "@executable_path/../Frameworks" | sed -e"s/ (.*$//"`
do
echo " $FROMPATH"
LIBNAME=`basename $FROMPATH`
if [[ -e ./$LIBNAME ]]; then
echo "updating library path of $LIBNAME in $TARGETLIB"
install_name_tool -change "$FROMPATH" "@executable_path/../Frameworks/$LIBNAME" $TARGETLIB
fi
done
done
- name: Create Artifact
run: |
cd build
/usr/local/opt/qt@5/bin/macdeployqt xdts_viewer.app -dmg -verbose=1
- uses: actions/upload-artifact@v4
with:
name: xdts_viewer-${{ runner.os }}-${{ github.sha }}
path: build/xdts_viewer.dmg
60 changes: 60 additions & 0 deletions .github/workflows/workflow_windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Windows Build

on: [push, pull_request]

jobs:
Windows:
runs-on: windows-2022
env:
QT_ROOT: ${{github.workspace}}/3rdparty/qt
QT_URL: https://github.com/shun-iwasawa/qt5/releases/download/v5.15.2_wintab/Qt5.15.2_wintab.zip
steps:
- uses: actions/checkout@v4

- uses: actions/cache@v4
with:
path: C:/vcpkg/installed
key: ${{ runner.os }}-vcpkg-${{ env.vcpkg_ref }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-vcpkg-${{ env.vcpkg_ref }}-

- name: Cache Qt
id: cache-qt
uses: actions/cache@v4
with:
path: ${{env.QT_ROOT}}
key: ${{ runner.os }}-QtCache

- name: Install Qt
run: |
# fix up paths to be forward slashes consistently
QT_ROOT=$(echo $QT_ROOT | sed 's/\\/\//g')
mkdir -p $QT_ROOT
curl --progress-bar -L -o $QT_ROOT/Qt.zip $QT_URL
7z -o$QT_ROOT x $QT_ROOT/Qt.zip -y -bd
rm -f $QT_ROOT/Qt.zip
shell: bash

- name: Build
run: |
mkdir build | Out-Null
cd build
$env:QT_PATH = '${{ env.QT_ROOT }}/Qt5.15.2_wintab/5.15.2_wintab/msvc2019_64'
cmake ../sources -G 'Visual Studio 17 2022' -Ax64 -DQTDIR="$env:QT_PATH"
cmake --build . --config Release
- name: Create Artifact
env:
VCINSTALLDIR: 'C:/Program Files (x86)/Microsoft Visual Studio/2022/Enterprise/VC'
run: |
mkdir artifact | Out-Null
cd artifact
mkdir xdts_viewer | Out-Null
cd xdts_viewer
cp -Recurse ../../xdts_viewer_resources xdts_viewer_resources
cp ../../build/Release/* .
${{ env.QT_ROOT }}/Qt5.15.2_wintab/5.15.2_wintab/msvc2019_64/bin/windeployqt.exe xdts_viewer.exe
- uses: actions/upload-artifact@v4
with:
name: xdts_viewer-${{ runner.os }}-${{ github.sha }}
path: artifact

0 comments on commit 4fe765a

Please sign in to comment.