forked from flagarde/YAODAQ
-
Notifications
You must be signed in to change notification settings - Fork 1
155 lines (130 loc) · 3.79 KB
/
MacOS-Clang.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
name: MacOS Clang ROOT
on:
push:
pull_request:
schedule:
#Every Sunday at midnight
- cron: '0 0 * * 0'
env:
CMAKE_VERSION: 3.16.x
NINJA_VERSION: 1.10.2
BUILD_TYPE: Release
CC: clang
CXX: clang++
artifact: "macOS.tar.xz"
INSTALL_ROOT: TRUE
jobs:
# Checkout apply clang-format and upload artifact
format:
name: "Format"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Use clang-format
uses: DoozyX/[email protected]
with:
source: '.'
clangFormatVersion: 11
inplace: True
- name: Setup Python
uses: actions/setup-python@v2
- name: Install cmakelang
uses: BSFishy/pip-action@v1
with:
packages: cmakelang pyyaml jinja2
- name: Use cmake-format
run: find . \( -name '*.cmake' -o -name 'CMakeLists.txt' \) -exec cmake-format -i {} \;
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: clang-format
path: ${{ github.workspace }}
build:
needs: format
name: "Build"
runs-on: macos-latest
steps:
- uses: actions/download-artifact@v2
with:
name: clang-format
- name: Install cmake
uses: jwlawson/[email protected]
with:
cmake-version: '${{env.CMAKE_VERSION}}'
github-api-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@v3
with:
version: '${{env.NINJA_VERSION}}'
- name: Use ccache
uses: hendrikmuhs/[email protected]
- name: Install ROOT
if: env.INSTALL_ROOT == 'TRUE'
run: brew install root
- name: Test ROOT
if: env.INSTALL_ROOT == 'TRUE'
run: root --version
- name: Configure
run: cmake -S ${{ github.workspace }} -B build -D CMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Build
run: cmake --build build --config ${{ env.BUILD_TYPE }} --parallel 2
- name: Run tests
working-directory: ${{ github.workspace }}/build
run: ctest -C ${{ env.BUILD_TYPE }} -j2 -VV --output-on-failure
- name: Install Strip
run: cmake --install build --prefix instdir --strip
release:
name: "Release"
if: contains(github.ref, 'tags/v')
runs-on: ubuntu-latest
needs: build
steps:
- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Store Release url
run: |
echo "${{ steps.create_release.outputs.upload_url }}" > ./upload_url
- name: Upload
uses: actions/upload-artifact@v2
with:
path: instdir
name: ${{ env.artifact }}
publish:
name: "Publish"
if: contains(github.ref, 'tags/v')
runs-on: ubuntu-latest
needs: release
steps:
- name: Download artifact
uses: actions/download-artifact@v1
with:
name: ${{ env.artifact }}
path: ./
- name: Download URL
uses: actions/download-artifact@v1
with:
name: upload_url
path: ./
- id: set_upload_url
run: |
upload_url=`cat ./upload_url`
echo ::set-output name=upload_url::$upload_url
- name: Upload to Release
id: upload_to_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.set_upload_url.outputs.upload_url }}
asset_path: ./${{ env.artifact }}
asset_name: ${{ env.artifact }}
asset_content_type: application/x-gtar