-
Notifications
You must be signed in to change notification settings - Fork 668
153 lines (130 loc) · 6.15 KB
/
main.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
name: ownCloud CI
on:
push:
branches:
- master
- '[0-9]+'
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions: {}
defaults:
run:
shell: pwsh
jobs:
# ------------------------------------------------------------------------------------------------------------------------------------------
build:
permissions:
# actions/upload-artifact doesn't need contents: write
contents: read
strategy:
fail-fast: false
matrix:
include:
- name: windows-cl-x86_64
target: windows-cl-msvc2022-x86_64
os: windows-latest
fetch-depth: 0
container:
# TODO: align the target with the name
- name: macos-clang-x86_64
target: macos-64-clang
os: macos-latest
fetch-depth: 1
container:
- name: macos-clang-x86_64-debug
target: macos-64-clang-debug
os: macos-latest
fetch-depth: 1
container:
- name: linux-gcc-x86_64
target: linux-64-gcc
os: ubuntu-latest
container: owncloudci/appimage-build:sles15-amd64
fetch-depth: 1
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
env:
CRAFT_TARGET: ${{ matrix.target }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
container: ${{ matrix.container }}
steps:
- name: Check out source code
uses: actions/checkout@v2
with:
fetch-depth: ${{ matrix.fetch-depth }}
submodules: true
- name: Restore cache
uses: actions/cache@v2
with:
path: ~/cache
key: ${{ runner.os }}-${{ matrix.target }}
- name: Clone CraftMaster
run: git clone --depth=1 https://invent.kde.org/kde/craftmaster.git "$env:HOME/craft/CraftMaster/CraftMaster"
- name: Craft setup
run: |
New-Item -Path ~/cache -ItemType Directory -ErrorAction SilentlyContinue
& "${env:GITHUB_WORKSPACE}/.github/workflows/.craft.ps1" --setup
- name: Craft unshelve
run: |
& "${env:GITHUB_WORKSPACE}/.github/workflows/.craft.ps1" -c --unshelve "${env:GITHUB_WORKSPACE}/.craft.shelf"
- name: Prepare
run: |
New-Item -ItemType Directory "${env:GITHUB_WORKSPACE}/binaries/"
& "${env:GITHUB_WORKSPACE}/.github/workflows/.craft.ps1" -c --set forceAsserts=true owncloud/owncloud-client
if ($IsWindows) {
& "${env:GITHUB_WORKSPACE}/.github/workflows/.craft.ps1" -c dev-utils/nsis
} elseif($IsLinux) {
& "${env:GITHUB_WORKSPACE}/.github/workflows/.craft.ps1" -c dev-utils/linuxdeploy
}
- name: Install dependencies
run: |
& "${env:GITHUB_WORKSPACE}/.github/workflows/.craft.ps1" -c --install-deps owncloud/owncloud-client
- name: Build
run: |
if ("${{ matrix.target }}" -eq "macos-64-clang-debug" ) {
# https://api.kde.org/ecm/module/ECMEnableSanitizers.html
# address;leak;undefined
# clang: error: unsupported option '-fsanitize=leak' for target 'x86_64-apple-darwin21.6.0'
& "${env:GITHUB_WORKSPACE}/.github/workflows/.craft.ps1" -c --set args="-DECM_ENABLE_SANITIZERS='address;undefined'" owncloud/owncloud-client
}
if ("${{ matrix.target }}" -eq "windows-cl-msvc2022-x86_64") {
& "${env:GITHUB_WORKSPACE}/.github/workflows/.craft.ps1" -c --no-cache --src-dir "${env:GITHUB_WORKSPACE}" --configure owncloud/owncloud-client
$env:BUILD_DIR = $(& "${env:GITHUB_WORKSPACE}/.github/workflows/.craft.ps1" -c --get buildDir -q owncloud-client)
& "${env:GITHUB_WORKSPACE}/.github/workflows/.craft.ps1" -c --run pwsh "${env:GITHUB_WORKSPACE}/.github/workflows/.sonar.ps1" --build
& "${env:GITHUB_WORKSPACE}/.github/workflows/.craft.ps1" -c --no-cache --src-dir "${env:GITHUB_WORKSPACE}" --install --qmerge owncloud/owncloud-client
} else {
& "${env:GITHUB_WORKSPACE}/.github/workflows/.craft.ps1" -c --no-cache --src-dir "${env:GITHUB_WORKSPACE}" owncloud/owncloud-client
}
- name: Run tests
run: |
& "${env:GITHUB_WORKSPACE}/.github/workflows/.craft.ps1" -c --no-cache --src-dir "${env:GITHUB_WORKSPACE}" --test owncloud/owncloud-client
- name: Sonarcloud
if: ${{ matrix.target == 'windows-cl-msvc2022-x86_64' }}
run: |
$env:BUILD_DIR = $(& "${env:GITHUB_WORKSPACE}/.github/workflows/.craft.ps1" -c --get buildDir -q owncloud-client)
& "${env:GITHUB_WORKSPACE}/.github/workflows/.craft.ps1" -c --run pwsh "${env:GITHUB_WORKSPACE}/.github/workflows/.sonar.ps1" --analyze
- name: Clang tidy
if: github.event_name != 'pull_request'
run: |
& "${env:GITHUB_WORKSPACE}/.github/workflows/.craft.ps1" -c --run python3 -m pip install clang-html
& "${env:GITHUB_WORKSPACE}/.github/workflows/.craft.ps1" -c libs/llvm
$env:BUILD_DIR = $(& "${env:GITHUB_WORKSPACE}/.github/workflows/.craft.ps1" -c --get buildDir -q owncloud-client)
& "${env:GITHUB_WORKSPACE}/.github/workflows/.craft.ps1" -c --run pwsh "${env:GITHUB_WORKSPACE}/.github/workflows/.run-clang-tidy.ps1"
& "${env:GITHUB_WORKSPACE}/.github/workflows/.craft.ps1" -c --run python3 -m clang_html "${env:TMPDIR}/clang-tidy.log" -o "${env:GITHUB_WORKSPACE}/binaries/clang-tidy.html"
- name: Package
run: |
& "${env:GITHUB_WORKSPACE}/.github/workflows/.craft.ps1" -c --no-cache --src-dir "${env:GITHUB_WORKSPACE}" --package owncloud/owncloud-client
- name: Prepare artifacts
run: |
Copy-Item "$env:HOME/craft/binaries/*" "${env:GITHUB_WORKSPACE}/binaries/" -ErrorAction SilentlyContinue
& "${env:GITHUB_WORKSPACE}/.github/workflows/.craft.ps1" -c --shelve "${env:GITHUB_WORKSPACE}/.craft.shelf"
Copy-Item "${env:GITHUB_WORKSPACE}/.craft.shelf" "${env:GITHUB_WORKSPACE}/binaries/"
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.name }}
path: ${{ github.workspace }}/binaries/*