-
Notifications
You must be signed in to change notification settings - Fork 29
156 lines (152 loc) · 5.31 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
name: Build
on:
push:
branches:
- master
tags:
- "*.*.*"
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-20.04, target: linux, platform: linux-x64 }
- { os: ubuntu-20.04, target: linux, platform: linux-aarch64 }
- { os: macos-latest, target: darwin, platform: darwin-x64 }
- { os: macos-latest, target: darwin, platform: darwin-arm64 }
- { os: windows-latest, target: windows, platform: win32-x64 }
steps:
- uses: actions/setup-node@v3
with:
node-version: '20'
- uses: actions/checkout@v3
with:
ref: refs/heads/master
- name: Prepare Linux-64
if: ${{ matrix.target == 'linux' && matrix.platform == 'linux-x64' }}
run: |
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y gcc-11 g++-11
echo "CC=gcc-11" >> $GITHUB_ENV
echo "CXX=g++-11" >> $GITHUB_ENV
- name: Prepare Linux-aarch64
if: ${{ matrix.target == 'linux' && matrix.platform == 'linux-aarch64' }}
run: |
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y gcc-10-aarch64-linux-gnu g++-10-aarch64-linux-gnu
echo "CC=aarch64-linux-gnu-gcc-10" >> $GITHUB_ENV
echo "CXX=aarch64-linux-gnu-g++-10" >> $GITHUB_ENV
- name: Build-Windows
if: startsWith(matrix.os, 'windows')
run: |
mkdir build
cd build
cmake .. -DCMAKE_USER_MAKE_RULES_OVERRIDE="${{ github.workspace }}/cmake/flags_override.cmake" -DBUILD_GMOCK=OFF -DINSTALL_GTEST=OFF
cmake --build . --config Release
ctest -V -C Release
cmake --install . --config Release --prefix ${{ github.workspace }}/artifact/
- name: Build-Linux-x64
if: ${{ matrix.platform == 'linux-x64' }}
run: |
mkdir build
cd build
cmake .. -DBUILD_GMOCK=OFF -DINSTALL_GTEST=OFF -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
ctest -V -C Release
cmake --install . --config Release --prefix ${{ github.workspace }}/artifact/
- name: Build-Linux-aarch64
if: ${{ matrix.platform == 'linux-aarch64' }}
run: |
mkdir build
cd build
cmake .. -DBUILD_GMOCK=OFF -DINSTALL_GTEST=OFF -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
cmake --install . --config Release --prefix ${{ github.workspace }}/artifact/
- name: Build-macosx
if: startsWith(matrix.os, 'macos')
run: |
mkdir build
cd build
if [[ "${{ matrix.platform }}" = darwin-arm64 ]]; then
cmake .. -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DBUILD_GMOCK=OFF -DINSTALL_GTEST=OFF -DCMAKE_BUILD_TYPE=Release
else
cmake .. -DBUILD_GMOCK=OFF -DINSTALL_GTEST=OFF -DCMAKE_BUILD_TYPE=Release
fi
cmake --build . --config Release
ctest -V -C Release
cmake --install . --config Release --prefix ${{ github.workspace }}/artifact/
- name: Upload
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.platform }}
path: ${{ github.workspace }}/artifact/
release:
name: Upload Release
needs: [build]
runs-on: [ubuntu-latest]
steps:
- name: Download
uses: actions/download-artifact@v3
- name: Display structure of downloaded files
run: ls -R
- name: zip win32-x64
uses: TheDoctor0/zip-release@v0.2.1
with:
filename: win32-x64.zip
path: win32-x64
- name: zip linux-x64
uses: TheDoctor0/zip-release@v0.2.1
with:
filename: linux-x64.zip
path: linux-x64
- name: tar linux-64
run: |
chmod 777 linux-x64/bin/CodeFormat
chmod 777 linux-x64/bin/CodeFormatServer
tar -czvf linux-x64.tar.gz linux-x64
- name: tar linux-aarch64
run: |
chmod 777 linux-aarch64/bin/CodeFormat
chmod 777 linux-aarch64/bin/CodeFormatServer
tar -czvf linux-aarch64.tar.gz linux-aarch64
- name: zip darwin-x64
uses: TheDoctor0/zip-release@v0.2.1
with:
filename: darwin-x64.zip
path: darwin-x64
- name: zip darwin-arm64
uses: TheDoctor0/zip-release@v0.2.1
with:
filename: darwin-arm64.zip
path: darwin-arm64
- name: tar darwin-arm64
run: |
chmod 777 darwin-arm64/bin/CodeFormat
chmod 777 darwin-arm64/bin/CodeFormatServer
tar -czvf darwin-arm64.tar.gz darwin-arm64
- name: tar darwin-x64
run: |
chmod 777 darwin-x64/bin/CodeFormat
chmod 777 darwin-x64/bin/CodeFormatServer
tar -czvf darwin-x64.tar.gz darwin-x64
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
name: CodeFormat
draft: false
generate_release_notes: true
files: |
linux-x64.zip
linux-x64.tar.gz
linux-aarch64.tar.gz
darwin-x64.zip
darwin-arm64.zip
win32-x64.zip
darwin-x64.tar.gz
darwin-arm64.tar.gz
token: ${{ secrets.RELEASE }}