Skip to content

Commit

Permalink
Merge pull request #3 from AlpineMapsOrgDependencies/master
Browse files Browse the repository at this point in the history
compilation for clang/gcc and webassembly including ci pipeline
  • Loading branch information
SergeyMakeev authored Jan 10, 2024
2 parents 5f979f1 + 6bcda54 commit 4a7218a
Show file tree
Hide file tree
Showing 11 changed files with 719 additions and 129 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
name: CMake on multiple platforms

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "ci"
cancel-in-progress: false

jobs:
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

# Set up a matrix to run the following 3 configurations:
# 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
# 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
# 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
#
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
matrix:
os: [ubuntu-latest, windows-latest]
build_type: [Release]
c_compiler: [gcc, clang, cl]
include:
- os: windows-latest
c_compiler: cl
cpp_compiler: cl
- os: ubuntu-latest
c_compiler: gcc
cpp_compiler: g++
- os: ubuntu-latest
c_compiler: clang
cpp_compiler: clang++
exclude:
- os: windows-latest
c_compiler: gcc
- os: windows-latest
c_compiler: clang
- os: ubuntu-latest
c_compiler: cl

steps:
- uses: actions/checkout@v3

- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DENABLE_ADDRESS_SANITIZER=ON
-DENABLE_LONG_TEST_RUN=ON
-S ${{ github.workspace }}
- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}

- name: Test on Linux
if: matrix.os == 'ubuntu-latest'
working-directory: ${{ github.workspace }}
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ${{ steps.strings.outputs.build-output-dir }}/bin/GoofyTC

- name: Test on Windows
if: matrix.os == 'windows-latest'
working-directory: ${{ github.workspace }}
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ${{ steps.strings.outputs.build-output-dir }}/bin/Release/GoofyTC.exe
145 changes: 145 additions & 0 deletions .github/workflows/webassembly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
name: "webassembly"
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: mymindstorm/setup-emsdk@v13
with:
version: 3.1.37
- uses: actions/checkout@v3
- name: Install Qt native version (required by webassembly version)
uses: jurplel/install-qt-action@v3
with:
aqtversion: '==3.1.*'
version: '6.6.1'
host: linux
target: 'desktop'
arch: gcc_64
dir: '${{github.workspace}}/qt'
install-deps: 'true'

- name: Set QT_HOST_PATH
run: echo "QT_HOST_PATH=${Qt6_DIR}" >> "$GITHUB_ENV"

- name: Install Linux Dependencies
run: sudo apt-get install -y build-essential ninja-build

- name: Install Qt Webassembly version
uses: jurplel/install-qt-action@v3
with:
aqtversion: '==3.1.*'
version: '6.6.1'
host: linux
target: 'desktop'
arch: wasm_singlethread
dir: '${{github.workspace}}/qt'
install-deps: 'true'

- name: Make qt webassembly binaries executable
run: |
chmod u+x ${Qt6_DIR}/bin/*
- name: Verify emcc
run: emcc -v

- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
echo "install-dir=${{ github.workspace }}/install" >> "$GITHUB_OUTPUT"
- name: Configure CMake for short tests
env:
CMAKE_PREFIX_PATH: ${{env.Qt6_DIR}}/lib/cmake
run: >
${Qt6_DIR}/bin/qt-cmake
-G Ninja
-B ${{ steps.strings.outputs.build-output-dir }}_short
-DCMAKE_BUILD_TYPE=Release
-DAA_ENABLE_LONG_TEST_RUN=OFF
-DAA_WWW_INSTALL_DIR=${{ steps.strings.outputs.install-dir }}/short
-DFMT_INSTALL=OFF
-S ${{ github.workspace }}
- name: Build short tests
run: cmake --build ${{ steps.strings.outputs.build-output-dir }}_short --target install

- name: Configure CMake for long tests
env:
CMAKE_PREFIX_PATH: ${{env.Qt6_DIR}}/lib/cmake
run: >
${Qt6_DIR}/bin/qt-cmake
-G Ninja
-B ${{ steps.strings.outputs.build-output-dir }}_long
-DCMAKE_BUILD_TYPE=Release
-DAA_ENABLE_LONG_TEST_RUN=ON
-DAA_WWW_INSTALL_DIR=${{ steps.strings.outputs.install-dir }}/long
-DFMT_INSTALL=OFF
-S ${{ github.workspace }}
- name: Build long tests
run: cmake --build ${{ steps.strings.outputs.build-output-dir }}_long --target install

- name: Create artifact
uses: actions/upload-artifact@v4
with:
name: webassembly_tests
path: ${{ steps.strings.outputs.install-dir }}
if-no-files-found: error

- name: Create index.html
run: |
echo "<html>" >> ${{ steps.strings.outputs.install-dir }}/index.html
echo " <head>" >> ${{ steps.strings.outputs.install-dir }}/index.html
echo " <title>Goffy Tests</title>" >> ${{ steps.strings.outputs.install-dir }}/index.html
echo " </head>" >> ${{ steps.strings.outputs.install-dir }}/index.html
echo " <body>" >> ${{ steps.strings.outputs.install-dir }}/index.html
echo " <ul>" >> ${{ steps.strings.outputs.install-dir }}/index.html
echo " <li><a href="./short/GoofyTC.html">short tests (be patient)</li>" >> ${{ steps.strings.outputs.install-dir }}/index.html
echo " <li><a href="./long/GoofyTC.html">long tests (be super patient)</li>" >> ${{ steps.strings.outputs.install-dir }}/index.html
echo " </ul>" >> ${{ steps.strings.outputs.install-dir }}/index.html
echo " </body>" >> ${{ steps.strings.outputs.install-dir }}/index.html
echo "</html>" >> ${{ steps.strings.outputs.install-dir }}/index.html
echo "" >> ${{ steps.strings.outputs.install-dir }}/index.html
- name: Create Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: ${{ steps.strings.outputs.install-dir }}

deploy:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Setup Pages
uses: actions/configure-pages@v4

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

- name: Debug output
run: echo ${{ steps.deployment.outputs.page_url }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ test-results/sumary.txt
test-data/basis/basisu.exe
Images/*.psd
test-data/basis/temp/*.basis
/ThirdParty/extern/*
11 changes: 8 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
cmake_minimum_required(VERSION 3.13)
project(GoofyTC)

set(PROJECT_PATH ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT})
set(CMAKE_INSTALL_PREFIX ${PROJECT_PATH})
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake)
option(AA_ENABLE_ADDRESS_SANITIZER "compiles atb with address sanitizer enabled (only debug, works only on g++ and clang)" OFF)
option(AA_ENABLE_LONG_TEST_RUN "Switch this off to have way shorter tests" ON)

if(EMSCRIPTEN)
set(AA_WWW_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}" CACHE PATH "path to the install directory (for webassembly files, i.e., www directory)")
endif()

include(cmake/alp_add_git_repository.cmake)

add_subdirectory(Src)

Loading

0 comments on commit 4a7218a

Please sign in to comment.