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
|
name: Build & Tests
on:
push:
paths-ignore:
- 'docs/**'
- '**.md'
- '**.ps1'
pull_request:
# Need to repeat these paths - YAML anchors aren’t supported on GHA atm
# (or any other CI service that I know of, for that matter)
paths-ignore:
- 'docs/**'
- '**.md'
- '**.ps1'
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- name: Qt 5 / Linux x86_64
os: ubuntu-latest
container: "ubuntu:16.04"
qt: 5
- name: Qt 5 / macOS x86_64
os: macos-14
arch: x86_64
container:
qt: 5
#- name: Qt 5 / macOS arm64
# os: macos-latest
# container:
# qt: 5
- name: Qt 5 / Windows x86
os: windows-2022
arch: win32_msvc2019
vcvars: x86
container:
qt: 5
- name: Qt 5 / Windows x86_64
os: windows-2022
arch: win64_msvc2019_64
vcvars: x64
container:
qt: 5
- name: Qt 6 / Linux x86_64
os: ubuntu-latest
container: "ubuntu:22.04"
qt: 6
- name: Qt 6 / macOS x86_64
os: macos-14
arch: x86_64
container:
qt: 6
#- name: Qt 6 / macOS arm64
# os: macos-latest
# container:
# qt: 6
- name: Qt 6 / Windows x86_64
os: windows-2022
arch: win64_msvc2019_64
vcvars: x64
container:
qt: 6
name: ${{matrix.name}}
runs-on: ${{matrix.os}}
env: { CONTAINER: "${{matrix.container}}", BUILD_CMD: "" }
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up container (Linux)
if: runner.os == 'Linux'
# XXX: --privileged is sort of a brute-force solution to get FUSE
# working inside Docker, however so far I haven’t been able to
# figure out precisely *which* privileges are needed.
run: |
touch "${{github.workspace}}/env"
docker run --detach --privileged --workdir /workspace --volume "${{github.workspace}}:/workspace" --name "ci_${{github.sha}}" --entrypoint "tail" "${{matrix.container}}" -f /dev/null
echo '#!/usr/bin/env bash' > "${{github.workspace}}/build-cmd"
echo 'exec docker exec --env-file <(cat "${{github.workspace}}/env") "ci_${{github.sha}}" "$@"' >> "${{github.workspace}}/build-cmd"
chmod +x "${{github.workspace}}/build-cmd"
echo 'BUILD_CMD=${{github.workspace}}/build-cmd' >> "${GITHUB_ENV}"
- name: Install dependencies
uses: ./.github/actions/install-dependencies
with:
arch: ${{matrix.arch}}
qt: ${{matrix.qt}}
- name: Set up environment
uses: ./.github/actions/setup-environment
with:
arch: ${{matrix.arch}}
vcvars: ${{matrix.vcvars}}
- name: Configure build
run: >
mkdir build; ${{runner.os == 'Linux' && '${BUILD_CMD}' || ''}}
${{runner.os == 'Linux' && matrix.qt == 6 && 'qmake6' || 'qmake'}}
-o build PREFIX=/usr CONFIG-=debug_and_release CONFIG+=GIT
VERSION=${{ env.VERSION_NUMBER }}
- name: Build Pencil2D
run: ${{runner.os != 'Windows' && '${BUILD_CMD} make -C build' || 'cd build; nmake'}}
- name: Run tests
run: ${{runner.os == 'Linux' && '${BUILD_CMD}' || ''}} env QT_QPA_PLATFORM=minimal build/tests/tests
- name: Create package
id: package
if: runner.os != 'Linux' || matrix.qt == 5
uses: ./.github/actions/create-package
with:
arch: ${{matrix.arch}}
qt: ${{matrix.qt}}
- name: Code Sign and Notarize App
if: runner.os == 'macOS'
uses: ./.github/actions/notarize-macos-app
with:
app_path: "build/${{steps.package.outputs.output-basename}}.zip"
p12_base64: ${{ secrets.P12_BASE64 }}
p12_password: ${{ secrets.P12_PASSWORD }}
apple_id: ${{ secrets.APPLE_ID }}
apple_id_password: ${{ secrets.APPLE_ID_PASSWORD }}
team_id: ${{ secrets.APPLE_TEAM_ID }}
certificate_identity: ${{ secrets.CODESIGN_CERT_IDENTITY }}
- name: Upload package
if: runner.os != 'Linux' || matrix.qt == 5
uses: actions/upload-artifact@v4
with:
name: ${{steps.package.outputs.output-basename}}
path: ${{ runner.os == 'macOS' && format('build/{0}.dmg', steps.package.outputs.output-basename) || format('build/{0}*', steps.package.outputs.output-basename) }}
- name: Generate summary
shell: bash
run: >
echo "Build will be available for download
[here](https://get.pencil2d.org/@${{github.repository_owner}}/${{github.run_id}}/${{steps.package.outputs.output-basename}})
once the run is finished." > "${GITHUB_STEP_SUMMARY}"
- name: Stop container (Linux)
if: runner.os == 'Linux'
run: docker stop "ci_${{github.sha}}"
|