-
Notifications
You must be signed in to change notification settings - Fork 2
129 lines (110 loc) · 4.57 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
name: Build
on:
push:
paths:
- xmake.lua
- src/**
- patch/**
- .github/workflows/build.yml
pull_request:
paths:
- xmake.lua
- src/**
- patch/**
- .github/workflows/build.yml
workflow_dispatch:
env:
LLVM_VERSION: 15
LIBNODE_VERSION: 22.12.0
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-2022]
name: Build with ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/cache@v4
with:
path: |
~/AppData/Local/.xmake
key: xmake-${{ hashFiles('xmake.lua') }}
restore-keys: |
xmake-
- uses: xmake-io/github-action-setup-xmake@v1
# with:
# xmake-version: branch@master
- name: Set up Clang(Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update -y -q
sudo apt-get install -y -q lsb-release wget software-properties-common gnupg
sudo wget https://apt.llvm.org/llvm.sh
sudo chmod +x llvm.sh
sudo ./llvm.sh ${{env.LLVM_VERSION}}
sudo apt-get install -y -q libc++-${{env.LLVM_VERSION}}-dev libc++abi-${{env.LLVM_VERSION}}-dev
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang-${{env.LLVM_VERSION}} 100
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-${{env.LLVM_VERSION}} 100
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${{env.LLVM_VERSION}} 100
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${{env.LLVM_VERSION}} 100
sudo update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-${{env.LLVM_VERSION}} 100
sudo update-alternatives --install /usr/bin/ld ld /usr/bin/ld.lld-${{env.LLVM_VERSION}} 100
- run: |
xmake repo -u
- run: |
xmake f -a x64 -m release -v -y
- run: |
xmake -v -y
- uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}-${{ matrix.os }}-x64-${{ github.sha }}
path: |
bin/
pack:
needs: build
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-2022]
name: Pack with ${{ matrix.os }}
runs-on: ubuntu-22.04
steps:
- uses: actions/download-artifact@v4
with:
name: ${{ github.event.repository.name }}-${{ matrix.os }}-x64-${{ github.sha }}
path: bin/
- name: Download depends
run: |
curl -o bin-linux.zip -L https://github.com/IceBlcokMC/node/releases/download/v${{env.LIBNODE_VERSION}}/bin-linux.zip
curl -o bin-windows.zip -L https://github.com/IceBlcokMC/node/releases/download/v${{env.LIBNODE_VERSION}}/bin-windows.zip
curl -o node_modules.zip -L https://github.com/IceBlcokMC/node/releases/download/v${{env.LIBNODE_VERSION}}/node_modules.zip
- name: Unzip depends
run: |
mkdir deps
mkdir deps/node_modules
unzip -a -q bin-linux.zip -d deps/
unzip -a -q bin-windows.zip -d deps/
unzip -a -q node_modules.zip -d deps/node_modules/
- name: Pack
run: |
mkdir full
mkdir full/plugins
cp -r bin/* full/plugins/
cp -a deps/node_modules/. full/plugins/js_engine/node_modules/
if [ "${{ matrix.os}}" == "windows-2022" ]; then
cp deps/libnode.dll full/
cp deps/node.exe full/
else
cp deps/libnode.so.127 full/
cp deps/node full/
fi
- uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}-${{ matrix.os }}-full-x64-${{ github.sha }}
include-hidden-files: true
path: |
full/