-
Notifications
You must be signed in to change notification settings - Fork 4
115 lines (111 loc) · 4.59 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
name: CYX2
on: [ push, pull_request ]
jobs:
check_commit_msg:
outputs:
commit_message: ${{ steps.get_message.outputs.message }}
name: Check if the workflow has been disabled.
runs-on: ubuntu-latest
steps:
- name: Checking out sources
uses: actions/checkout@v2
- name: Get commit message
id: get_message
run: |
echo "::set-output name=message::$(git log --format=%B -n 1 ${{ github.event.after }} | tr '\n' ' ')"
echo "message=\"$(git log --format=%B -n 1 ${{ github.event.after }} | tr '\n' ' ')\"" >> $GITHUB_ENV
build:
needs: check_commit_msg
strategy:
matrix:
platform: [ ubuntu-20.04, windows-latest ]
arch: [ x64 ]
build_type: [ Release ]
include:
- platform: windows-latest
arch: x64
fail-fast: false
runs-on: ${{ matrix.platform }}
steps:
- name: Check out the source
uses: actions/checkout@v2
with:
submodules: 'recursive'
# =========================================================================================================
- name: Install MSVC - Windows
if: matrix.platform == 'windows-latest'
uses: ilammy/msvc-dev-cmd@v1
with:
toolset: 14.2
arch: ${{ matrix.arch }}
# =========================================================================================================
- name: Install Clang - Windows
if: matrix.platform == 'windows-latest'
shell: bash
run: |
curl -fsSL -o LLVM12.exe https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.0/LLVM-12.0.0-win64.exe
7z x LLVM12.exe -y -o"C:/Program Files/LLVM"
export PATH="/c/Program Files/LLVM/bin:$PATH"
# =========================================================================================================
- name: Install Compiler - Linux
if: matrix.platform == 'ubuntu-20.04'
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key 2>/dev/null | sudo apt-key add -
sudo add-apt-repository 'deb https://apt.llvm.org/focal/ llvm-toolchain-focal-12 main' -y
sudo apt-get update -q
sudo apt-get install -y clang-12 lld-12 libc++-12-dev libc++abi-12-dev clang-tools-12
# =========================================================================================================
- name: Build - Windows
shell: bash
if: matrix.platform == 'windows-latest'
run: |
mkdir build
cd build
cmake .. -G "NMake Makefiles" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
cmake --build . --parallel $(nproc)
cp -v ./*.pdb ./deployment || true
# =========================================================================================================
- name: Build - Linux
if: matrix.platform == 'ubuntu-20.04'
shell: bash
env:
CC: clang-12
CXX: clang++-12
run: |
mkdir build
cd build
cmake ..
cmake --build . --parallel $(nproc)
# =========================================================================================================
- name: Upload artifact - Windows
if: matrix.platform == 'windows-latest'
uses: actions/upload-artifact@master
with:
name: cyx2-${{ github.sha }}.win-${{ matrix.arch }}.exe
path: build/cyx2.exe
# =========================================================================================================
- name: Upload artifact - Linux
if: matrix.platform == 'ubuntu-20.04'
uses: actions/upload-artifact@master
with:
name: cyx2-${{ github.sha }}.linux-${{ matrix.arch }}
path: build/cyx2
# =========================================================================================================
- name: Create temp folder for bytecode dump
shell: bash
run: |
mkdir -p cyx2/test/tmp/{basic,other,overall,ssa}
# =========================================================================================================
- name: Run Test - Windows
if: matrix.platform == 'windows-latest'
shell: bash
run: |
cd build
./cyx2_test.exe
# =========================================================================================================
- name: Run Test - Linux
if: matrix.platform == 'ubuntu-20.04'
shell: bash
run: |
cd build
./cyx2_test