-
Notifications
You must be signed in to change notification settings - Fork 2
165 lines (136 loc) · 4.55 KB
/
build.yml
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
name: Build, test and deploy
on:
push:
branches: [ master ]
env:
BUILD_TYPE: Debug
QT_VERSION: 5.12.10
QT_VERSION_ALIAS: 512
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v2
- name: Install Qt
env:
QtVer: ${{env.QT_VERSION_ALIAS}}
run: |
sudo apt-add-repository -y ppa:beineri/opt-qt-${{env.QT_VERSION}}-focal
sudo apt-get update -q
sudo apt-get install -y qt${QtVer}base qt${QtVer}tools qt${QtVer}svg libgl1-mesa-dev
/opt/qt${QtVer}/bin/qt${QtVer}-env.sh
if: matrix.os == 'ubuntu-latest'
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: ${{env.QT_VERSION}}
if: matrix.os == 'windows-latest' || matrix.os == 'macos-latest'
# - name: Install Ninja
# run: sudo apt-get install -y ninja-build
# if: matrix.os == 'ubuntu-latest'
# - name: Install Ninja
# run: brew install ninja
# if: matrix.os == 'macos-latest'
# - name: Install Ninja
# run: choco install ninja
# if: matrix.os == 'windows-latest'
- name: Configure CMake
env:
COVERAGE: ${{ fromJSON('{"true":"ON", "false":"OFF"}')[matrix.os == 'ubuntu-latest'] }}
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCODE_COVERAGE=${{env.COVERAGE}}
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Test
working-directory: ${{github.workspace}}/build
env:
QT_QPA_PLATFORM: offscreen
run: ctest -C ${{env.BUILD_TYPE}}
- name: Collect coverage
run: |
sudo apt-get install -y lcov
lcov --no-external --directory . --capture --output-file coverage.info
lcov --remove coverage.info "moc_*" "*.moc" "qrc_*" "tests/*" --output-file coverage.info
lcov --list coverage.info
genhtml coverage.info --output-directory coverage-report
if: matrix.coverage == 'ON'
- uses: codecov/codecov-action@v2
with:
files: ./coverage.info
if: matrix.coverage == 'ON'
- uses: actions/upload-artifact@v2
with:
name: coverage-report
path: coverage-report/
if: matrix.coverage == 'ON'
- name: Package
run: cmake --build build --target package
- name: Prepare AppImage
run: cmake --install build --prefix=AppDir/usr --config ${{env.BUILD_TYPE}}
if: matrix.os == 'ubuntu-latest'
- uses: AppImageCrafters/build-appimage-action@master
if: matrix.os == 'ubuntu-latest'
with:
recipe: AppImageBuilder.yml
- uses: actions/upload-artifact@v2
with:
name: package-${{matrix.os}}
path: |
build/e2designer-*-Linux.sh
build/e2designer-*-win64.exe
build/e2designer-*-win64.zip
build/e2designer-*-Darwin.dmg
e2designer-*.AppImage*
if-no-files-found: error
flatpak:
runs-on: ubuntu-latest
container:
image: bilelmoussaoui/flatpak-github-actions:kde-5.15
options: --privileged
steps:
- uses: actions/checkout@v2
- uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v4
with:
manifest-path: io.github.technic.e2designer.yaml
cache-key: flatpak-builder-${{ github.sha }}
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: CMake lint
run: |
pip3 install cmakelint
cmakelint --version
cmakelint --linelength=100 CMakeLists.txt
- name: clang-format
run: |
clang-format --version
clang-format -style=file -i \
$(find . \( -path './Qt-Color-Widgets' -o -path './AppImageUpdaterBridge' -o -path './pegtl' \) -prune -o \
\( -name '*.hpp' -o -name '*.cpp' \) -print)
git diff --exit-code
upload:
name: Release and upload
needs:
- build
- flatpak
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
- name: Inspect directory
run: |
mv app-x86_64/app.flatpak app-x86_64/e2designer-latest.flatpak
ls -laR
- uses: marvinpinto/action-automatic-releases@latest
with:
files: |
package-*/build/*
package-ubuntu-latest/*.AppImage*
app-*/*.flatpak
repo_token: ${{ secrets.GITHUB_TOKEN }}
prerelease: true
automatic_release_tag: latest
title: "Latest build from master"