diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..4ab0ac4 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,91 @@ +name: build + +on: + push: + branches: + - '*' + tags: + - '[0-9]*' + - 'v[0-9]*' + pull_request: + branches: + - '*' + workflow_dispatch: + +jobs: + build: + strategy: + matrix: + include: + - name: win32 + display-name: Windows 32-bit + runs-on: windows-2019 + platform: x86 + release-arch: Win32 + os-type: Windows + build-type: Release + vcpkg-triplet: x86-windows-static + vcpkg-commit-id: 5cf60186a241e84e8232641ee973395d4fde90e1 + - name: win64 + display-name: Windows 64-bit + runs-on: windows-2019 + platform: x64 + release-arch: x64 + os-type: Windows + build-type: Release + vcpkg-triplet: x64-windows-static + vcpkg-commit-id: 5cf60186a241e84e8232641ee973395d4fde90e1 + - name: linux64 + display-name: Linux 64-bit + runs-on: ubuntu-20.04 + platform: x64 + release-arch: Linux64 + os-type: Linux + build-type: Release + fail-fast: false + name: Compile for ${{ matrix.display-name }} + runs-on: ${{ matrix.runs-on }} + env: + name: ${{ matrix.name }} + display_name: ${{ matrix.display-name }} + platform: ${{ matrix.platform }} + release_arch: ${{ matrix.release-arch }} + build_type: ${{ matrix.build-type }} + num_jobs: 2 + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Install dependencies (Linux) + if: ${{ matrix.os-type == 'Linux' }} + run: sudo apt-get -y install libboost-dev libgl-dev + - name: Install dependencies (Windows) + if: ${{ matrix.os-type == 'Windows' }} + uses: lukka/run-vcpkg@v7 + with: + vcpkgTriplet: ${{ matrix.vcpkg-triplet }} + vcpkgArguments: cairo + vcpkgGitCommitId: ${{ matrix.vcpkg-commit-id }} + - name: Create Build Directory + working-directory: ${{ runner.workspace }} + run: cmake -E make_directory build + - name: Configure CMake (Windows) + if: ${{ matrix.os-type == 'Windows' }} + working-directory: ${{ runner.workspace }}/build + run: cmake "${Env:GITHUB_WORKSPACE}" -G"Visual Studio 16 2019" -A"${Env:release_arch}" -DCMAKE_BUILD_TYPE="${Env:build_type}" -DCMAKE_CXX_STANDARD=17 -DCMAKE_TOOLCHAIN_FILE="${Env:RUNVCPKG_VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET="${Env:RUNVCPKG_VCPKG_TRIPLET}" + - name: Configure CMake (Linux) + if: ${{ matrix.os-type == 'Linux' }} + working-directory: ${{ runner.workspace }}/build + run: cmake "${GITHUB_WORKSPACE}" -DCMAKE_BUILD_TYPE="${build_type}" -DCMAKE_CXX_STANDARD=17 + - name: Build (Windows) + if: ${{ matrix.os-type == 'Windows' }} + working-directory: ${{ runner.workspace }}/build + run: cmake --build . --config "${Env:build_type}" -j "${Env:num_jobs}" + - name: Build (Linux) + if: ${{ matrix.os-type == 'Linux' }} + working-directory: ${{ runner.workspace }}/build + run: cmake --build . --config "${build_type}" -j "${num_jobs}" + - uses: actions/upload-artifact@v2 + with: + name: String-machine for ${{ matrix.display-name }} + path: "${{runner.workspace}}/build/bin/*"