1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
|
name: Build
on:
pull_request:
branches:
- "master"
- "release-*"
paths-ignore:
- 'po/xournalpp.pot'
- 'po/*.po'
env:
build-targets-json: '.github/available-build-targets.json'
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Debug
jobs:
prepare:
runs-on: ubuntu-latest
name: 'Prepare jobs'
outputs:
linux_builds: ${{ steps.parse.outputs.linux_builds }}
macos_builds: ${{ steps.parse.outputs.macos_builds }}
windows_builds: ${{ steps.parse.outputs.windows_builds }}
steps:
- uses: actions/checkout@v4
with: # Get the build targets
sparse-checkout: '${{ env.build-targets-json }}'
sparse-checkout-cone-mode: false
- name: 'Parse list of targets'
id: parse
uses: actions/github-script@v7
with:
script: |
const available_targets = require('${{ env.build-targets-json }}')
const linux_builds = []
for (const tgt in available_targets.linux_targets) {
if (available_targets.linux_targets[tgt].run_ci === 'true') {
linux_builds.push(available_targets.linux_targets[tgt])
}
}
core.setOutput('linux_builds', linux_builds)
const macos_builds = []
for (const tgt in available_targets.macos_targets) {
if (available_targets.macos_targets[tgt].run_ci === 'true') {
macos_builds.push(available_targets.macos_targets[tgt])
}
}
core.setOutput('macos_builds', macos_builds)
const windows_builds = []
for (const tgt in available_targets.windows_targets) {
if (available_targets.windows_targets[tgt].run_ci === 'true') {
windows_builds.push(available_targets.windows_targets[tgt])
}
}
core.setOutput('windows_builds', windows_builds)
ubuntu:
needs: ['prepare']
strategy:
matrix:
run: ${{fromJSON(needs.prepare.outputs.linux_builds)}}
runs-on: ${{ matrix.run.runner }}
container:
image: ${{ matrix.run.container_image }}
name: 'Test Xournal++ on ${{ matrix.run.displayed_name }}'
steps:
- uses: actions/checkout@v4
- name: 'Install dependencies'
uses: ./.github/actions/install_deps_ubuntu
with:
gcc_version: ${{ matrix.run.gcc_version }}
extra_packages: ${{ matrix.run.extra_packages }}
- name: 'Build Xournal++'
uses: ./.github/actions/build
with:
build_type: ${{env.BUILD_TYPE}}
extra_cmake_flags: ${{ matrix.run.extra_cmake_flags }}
- name: 'Build tests'
id: build-test
run: |
cmake --build . --target test-units
working-directory: ${{github.workspace}}/build
- name: 'Run tests'
if: always() && steps.build-test.outcome == 'success' # Run the test in every locale even if it failed in another
run: |
CI=true ./test/test-units
working-directory: ${{github.workspace}}/build
- name: 'Run tests FR' # fr_FR checks for missing imbue() in numerical in/out (floating point = ',' thousand separator = ' ')
if: always() && steps.build-test.outcome == 'success' # Run the test in every locale even if it failed in another
run: |
echo "fr_FR.UTF-8 UTF-8" | sudo tee /etc/locale.gen
sudo locale-gen
LC_ALL=fr_FR.UTF-8 CI=true ./test/test-units
working-directory: ${{github.workspace}}/build
- name: 'Run tests JP.utf-8' # ja_JP tests std::put_time's UTF-8 support
if: always() && steps.build-test.outcome == 'success' # Run the test in every locale even if it failed in another
run: |
echo "ja_JP.UTF-8 UTF-8" | sudo tee /etc/locale.gen
sudo locale-gen
LC_ALL=ja_JP.UTF-8 CI=true ./test/test-units
working-directory: ${{github.workspace}}/build
- name: 'Run tests JP-eucJP' # Test for non-UTF-8 locales
if: always() && steps.build-test.outcome == 'success' # Run the test in every locale even if it failed in another
run: |
echo "ja_JP.EUC-JP EUC-JP" | sudo tee /etc/locale.gen
sudo locale-gen
LC_ALL=ja_JP.eucjp CI=true ./test/test-units
working-directory: ${{github.workspace}}/build
- name: 'Run tests zh_CN.GB18030' # Test for non-UTF-8 locales
if: always() && steps.build-test.outcome == 'success' # Run the test in every locale even if it failed in another
run: |
echo "zh_CN.GB18030 GB18030" | sudo tee /etc/locale.gen
sudo locale-gen
LC_ALL=zh_CN.GB18030 CI=true ./test/test-units
working-directory: ${{github.workspace}}/build
- name: 'Run tests zh_CN.GB18030 G_FILENAME_ENCODING=GB18030' # Test for non-UTF-8 locales
if: always() && steps.build-test.outcome == 'success' # Run the test in every locale even if it failed in another
run: |
# Omit the tests that actually try to open files with utf8 paths, as the system's filename encoding does not match
G_FILENAME_ENCODING=GB18030 LC_ALL=zh_CN.gb18030 CI=true ./test/test-units --gtest_filter=-ControlLoadHandler.testLoadStoreCJK:ControlLoadHandler.testRelativePath
working-directory: ${{github.workspace}}/build
- name: 'Run gtk-integration tests'
# Todo: Port this to MacOS and Windows
run: |
sudo apt install xvfb
cmake .. -DCMAKE_INSTALL_PREFIX=install
cmake --build . --target install
cmake --build . --target test-gtk-integration
CI=true xvfb-run -a ./test/test-gtk-integration
working-directory: ${{github.workspace}}/build
Windows:
needs: ['prepare']
strategy:
matrix:
run: ${{fromJSON(needs.prepare.outputs.windows_builds)}}
runs-on: ${{ matrix.run.runner }}
name: 'Test Xournal++ on ${{ matrix.run.displayed_name }}'
steps:
- uses: actions/checkout@v4
- name: 'Install dependencies'
uses: ./.github/actions/install_deps_windows
with:
msystem: ${{ matrix.run.msystem }}
msys_package_env: ${{ matrix.run.msys_package_env }}
- name: 'Build Xournal++'
uses: ./.github/actions/build
with:
build_type: ${{env.BUILD_TYPE}}
extra_cmake_flags: ${{ matrix.run.extra_cmake_flags }}
shell: msys2 {0}
- name: 'Build tests'
shell: msys2 {0}
run: |
cmake --build . --target test-units
working-directory: ${{github.workspace}}/build
- name: 'Run tests'
shell: msys2 {0}
run: |
CI=true ./test/test-units
working-directory: ${{github.workspace}}/build
MacOS:
needs: ['prepare']
strategy:
matrix:
run: ${{fromJSON(needs.prepare.outputs.macos_builds)}}
runs-on: ${{ matrix.run.runner }}
name: 'Test Xournal++ on ${{ matrix.run.displayed_name }}'
steps:
- uses: actions/checkout@v4
- name: 'Install dependencies'
uses: ./.github/actions/install_deps_mac
with:
install_path: $HOME
- name: 'Build Xournal++'
uses: ./.github/actions/build
with:
build_type: ${{env.BUILD_TYPE}}
extra_cmake_flags: ${{ matrix.run.extra_cmake_flags }}
- name: 'Build tests'
shell: bash
run: |
cmake --build . --target test-units
working-directory: ${{github.workspace}}/build
- name: 'Run tests'
shell: bash
run: |
CI=true ./test/test-units
working-directory: ${{github.workspace}}/build
|