-
-
Notifications
You must be signed in to change notification settings - Fork 1
148 lines (146 loc) · 5.33 KB
/
cd-cpp.yml
File metadata and controls
148 lines (146 loc) · 5.33 KB
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
name: "CD C++: Release publication"
on:
push:
branches:
- main
tags:
- v*
- test-cd
jobs:
build:
name: ${{ matrix.os.name }} (${{ matrix.compiler.cxx }}, ${{ matrix.library-type }})
runs-on: ${{ matrix.os.value }}
strategy:
fail-fast: false
matrix:
os:
- {
name: "Windows",
value: windows-latest,
install-ninja: choco install ninja
}
- {
name: "Ubuntu",
value: ubuntu-latest,
install-ninja: sudo apt-get install -y ninja-build
}
# Commented until the concepts are supported by Apple Clang
# - {
# name: "MacOS",
# value: macos-latest,
# install-ninja: brew install ninja
# }
compiler:
- {
cc: "gcc",
cxx: "g++",
install-ubuntu: "sudo apt-get install -y gcc-10 g++-10",
alternative-cc: "sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10",
alternative-cxx: "sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10"
}
- {
cc: "clang",
cxx: "clang++",
install-ubuntu: "sudo apt-get install -y clang-11 lldb-11 lld-11",
alternative-cc: "sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-11 11",
alternative-cxx: "sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-11 11"
}
library-type: [static, shared]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
if: ${{ matrix.os.name != 'Windows' }}
with:
python-version: '3.x'
- uses: msys2/setup-msys2@v2
if: ${{ matrix.os.name == 'Windows' }}
with:
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-clang
mingw-w64-x86_64-meson
mingw-w64-x86_64-ninja
- name: Install ${{ matrix.compiler.cc }}/${{ matrix.compiler.cxx }} on Ubuntu
if: ${{ matrix.os.name == 'Ubuntu' }}
run: |
${{ matrix.compiler.install-ubuntu }}
${{ matrix.compiler.alternative-cc }}
${{ matrix.compiler.alternative-cxx }}
- name: Install Meson on Ubuntu and MacOS
if: ${{ matrix.os.name != 'Windows' }}
run: pip3 install meson
- name: Install Ninja on Ubuntu and MacOS
if: ${{ matrix.os.name != 'Windows' }}
run: ${{ matrix.os.install-ninja }}
- name: Compile on Ubuntu and MacOS
if: ${{ matrix.os.name != 'Windows' }}
env:
CC: ${{ matrix.compiler.cc }}
CXX: ${{ matrix.compiler.cxx }}
LDFLAGS: '-ldl'
run: |
meson build -Ddefault_library=${{ matrix.library-type }}
ninja -C build
- name: Compile on Windows
if: ${{ matrix.os.name == 'Windows' }}
shell: msys2 {0}
env:
CC: ${{ matrix.compiler.cc }}
CXX: ${{ matrix.compiler.cxx }}
run: |
meson build -Ddefault_library=${{ matrix.library-type }}
ninja -C build
- name: Move DLLs on Windows/Shared
if: ${{ matrix.os.name == 'Windows' && matrix.library-type == 'shared' }}
shell: msys2 {0}
run: |
cp ./build/Log/libCppUtils-Log.dll ./build/UnitTests
cp ./build/Type/libCppUtils-Type.dll ./build/UnitTests
- name: Generate Artifact on Ubuntu and MacOS
if: ${{ matrix.os.name != 'Windows' }}
run: |
zip --junk-paths CppUtils-Artifact-${{ matrix.os.name }}-${{ matrix.library-type }} \
./LICENSE \
./resources/README.txt \
./build/Language/Parser/libCppUtils-Language-Parser.a \
./build/Log/libCppUtils-Log.a \
./build/Switch/libCppUtils-Switch.a \
./build/Type/libCppUtils-Type.a
if [ ${{ matrix.library-type }} == "shared" ]; then
zip --junk-paths CppUtils-Artifact-${{ matrix.os.name }}-${{ matrix.library-type }} \
./build/Log/libCppUtils-Log.so \
./build/Type/libCppUtils-Type.so
fi
- name: Generate Artifact on Windows
if: ${{ matrix.os.name == 'Windows' }}
shell: msys2 {0}
run: |
zip --junk-paths CppUtils-Artifact-${{ matrix.os.name }}-${{ matrix.library-type }} \
./LICENSE \
./resources/README.txt \
./build/Language/Parser/libCppUtils-Language-Parser.a \
./build/Log/libCppUtils-Log.a \
./build/Switch/libCppUtils-Switch.a \
./build/Type/libCppUtils-Type.a
if [ ${{ matrix.library-type }} == "shared" ]; then
zip --junk-paths CppUtils-Artifact-${{ matrix.os.name }}-${{ matrix.library-type }} \
./build/Log/libCppUtils-Log.dll \
./build/Type/libCppUtils-Type.dll
fi
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./CppUtils-Artifact-${{ matrix.os.name }}-${{ matrix.library-type }}.zip
asset_name: CppUtils-Artifact-${{ matrix.os.name }}-${{ matrix.library-type }}.zip
asset_content_type: application/zip