forked from EmmyLuaLs/emmylua-analyzer-rust
-
Notifications
You must be signed in to change notification settings - Fork 0
190 lines (188 loc) · 8.57 KB
/
build.yml
File metadata and controls
190 lines (188 loc) · 8.57 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
name: Rust
on:
push:
branches:
- main
tags:
- "*"
pull_request:
branches:
- main
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-20.04, target: x86_64-unknown-linux-gnu, platform: linux-x64, cross: general }
- { os: ubuntu-22.04, target: x86_64-unknown-linux-gnu, platform: linux-x64, cross: zigbuild, glibc: 2.17 }
- { os: ubuntu-22.04, target: aarch64-unknown-linux-gnu, platform: linux-arm64, cross: zigbuild, glibc: 2.17 }
- { os: ubuntu-22.04, target: riscv64gc-unknown-linux-gnu, platform: linux-riscv64,cross: cross }
- { os: ubuntu-20.04, target: x86_64-unknown-linux-musl, platform: linux-musl, cross: cross }
- { os: macos-latest, target: x86_64-apple-darwin, platform: darwin-x64, cross: general }
- { os: macos-latest, target: aarch64-apple-darwin, platform: darwin-arm64, cross: general }
- { os: windows-latest, target: x86_64-pc-windows-msvc, platform: win32-x64, cross: general }
- { os: windows-latest, target: i686-pc-windows-msvc, platform: win32-ia32, cross: general }
- { os: windows-latest, target: aarch64-pc-windows-msvc, platform: win32-arm64, cross: general }
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Build - General
if: ${{ matrix.cross == 'general' }}
run: |
rustup target add ${{ matrix.target }}
cargo build --release --target ${{ matrix.target }} -p emmylua_ls
- name: Build - cross
if: ${{ matrix.cross == 'cross' }}
run: |
cargo install cross
cross build --release --target ${{ matrix.target }} -p emmylua_ls
- name: Build -zigbuild
if: ${{ matrix.cross == 'zigbuild' }}
run: |
rustup target add ${{ matrix.target }}
cargo install --locked cargo-zigbuild
pip3 install ziglang
cargo zigbuild --release --target ${{ matrix.target }}.${{ matrix.glibc }} -p emmylua_ls
- name: package-uninx
if: ${{ matrix.os != 'windows-latest' }}
run: |
python publish/workflow_copy_files.py . ${{ github.workspace }}/artifact
mkdir -p ${{ github.workspace }}/artifact/
cp ${{ github.workspace }}/target/${{ matrix.target }}/release/emmylua_ls ${{ github.workspace }}/artifact/
- name: package-windows
if: ${{ matrix.os == 'windows-latest' }}
run: |
python publish/workflow_copy_files.py . "${{ github.workspace }}/artifact"
Copy-Item -Path ${{ github.workspace }}\target\${{ matrix.target }}\release\emmylua_ls.exe -Destination ${{ github.workspace }}\artifact\
shell: pwsh
- name: Upload
if: ${{ matrix.cross != 'zigbuild' }}
uses: actions/upload-artifact@v4
with:
name: emmylua_ls-${{ matrix.platform }}
path: ${{ github.workspace }}/artifact/
- name: Upload zigbuild
if: ${{ matrix.cross == 'zigbuild' }}
uses: actions/upload-artifact@v4
with:
name: emmylua_ls-${{ matrix.platform }}-glibc.${{ matrix.glibc }}
path: ${{ github.workspace }}/artifact/
build-cli:
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-22.04, target: x86_64-unknown-linux-gnu, platform: linux-x64, cross: zigbuild, glibc: 2.17 }
- { os: ubuntu-22.04, target: aarch64-unknown-linux-gnu, platform: linux-arm64, cross: zigbuild, glibc: 2.17 }
- { os: macos-latest, target: x86_64-apple-darwin, platform: darwin-x64, cross: general }
- { os: macos-latest, target: aarch64-apple-darwin, platform: darwin-arm64, cross: general }
- { os: windows-latest, target: x86_64-pc-windows-msvc, platform: win32-x64, cross: general }
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Build - General
if: ${{ matrix.cross == 'general' }}
run: |
rustup target add ${{ matrix.target }}
cargo build --release --target ${{ matrix.target }} -p emmylua_doc_cli
- name: Build - cross
if: ${{ matrix.cross == 'cross' }}
run: |
cargo install cross
cross build --release --target ${{ matrix.target }} -p emmylua_doc_cli
- name: Build -zigbuild
if: ${{ matrix.cross == 'zigbuild' }}
run: |
rustup target add ${{ matrix.target }}
cargo install --locked cargo-zigbuild
pip3 install ziglang
cargo zigbuild --release --target ${{ matrix.target }}.${{ matrix.glibc }} -p emmylua_doc_cli
- name: package-uninx
if: ${{ matrix.os != 'windows-latest' }}
run: |
python publish/workflow_copy_files.py . ${{ github.workspace }}/artifact
mkdir -p ${{ github.workspace }}/artifact/
cp ${{ github.workspace }}/target/${{ matrix.target }}/release/emmylua_doc_cli ${{ github.workspace }}/artifact/
- name: package-windows
if: ${{ matrix.os == 'windows-latest' }}
run: |
python publish/workflow_copy_files.py . "${{ github.workspace }}/artifact"
Copy-Item -Path ${{ github.workspace }}\target\${{ matrix.target }}\release\emmylua_doc_cli.exe -Destination ${{ github.workspace }}\artifact\
shell: pwsh
- name: Upload
if: ${{ matrix.cross != 'zigbuild' }}
uses: actions/upload-artifact@v4
with:
name: emmylua_doc_cli-${{ matrix.platform }}
path: ${{ github.workspace }}/artifact/
- name: Upload zigbuild
if: ${{ matrix.cross == 'zigbuild' }}
uses: actions/upload-artifact@v4
with:
name: emmylua_doc_cli-${{ matrix.platform }}-glibc.${{ matrix.glibc }}
path: ${{ github.workspace }}/artifact/
release:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download
uses: actions/download-artifact@v4
- name: zip windows package win32-x64
uses: TheDoctor0/zip-release@v0.2.1
with:
filename: emmylua_ls-win32-x64.zip
path: emmylua_ls-win32-x64
- name: zip windows package win32-ia32
uses: TheDoctor0/zip-release@v0.2.1
with:
filename: emmylua_ls-win32-ia32.zip
path: emmylua_ls-win32-ia32
- name: zip windows package win32-arm64
uses: TheDoctor0/zip-release@v0.2.1
with:
filename: emmylua_ls-win32-arm64.zip
path: emmylua_ls-win32-arm64
- name: tar unix
run: |
chmod +x emmylua_ls-linux-x64/emmylua_ls
tar -czf emmylua_ls-linux-x64.tar.gz -C emmylua_ls-linux-x64 .
chmod +x emmylua_ls-linux-x64-glibc.2.17/emmylua_ls
tar -czf emmylua_ls-linux-x64-glibc.2.17.tar.gz -C emmylua_ls-linux-x64-glibc.2.17 .
chmod +x emmylua_ls-linux-arm64-glibc.2.17/emmylua_ls
tar -czf emmylua_ls-linux-aarch64-glibc.2.17.tar.gz -C emmylua_ls-linux-arm64-glibc.2.17 .
chmod +x emmylua_ls-linux-musl/emmylua_ls
tar -czf emmylua_ls-linux-musl.tar.gz -C emmylua_ls-linux-musl .
chmod +x emmylua_ls-linux-riscv64/emmylua_ls
tar -czf emmylua_ls-linux-riscv64.tar.gz -C emmylua_ls-linux-riscv64 .
chmod +x emmylua_ls-darwin-x64/emmylua_ls
tar -czf emmylua_ls-darwin-x64.tar.gz -C emmylua_ls-darwin-x64 .
chmod +x emmylua_ls-darwin-arm64/emmylua_ls
tar -czf emmylua_ls-darwin-arm64.tar.gz -C emmylua_ls-darwin-arm64 .
- name: Release
uses: softprops/action-gh-release@v2
with:
name: emmylua_ls
draft: false
generate_release_notes: true
files: |
emmylua_ls-win32-x64.zip
emmylua_ls-win32-ia32.zip
emmylua_ls-win32-arm64.zip
emmylua_ls-linux-x64.tar.gz
emmylua_ls-linux-x64-glibc.2.17.tar.gz
emmylua_ls-linux-aarch64-glibc.2.17.tar.gz
emmylua_ls-linux-musl.tar.gz
emmylua_ls-linux-riscv64.tar.gz
emmylua_ls-darwin-x64.tar.gz
emmylua_ls-darwin-arm64.tar.gz
token: ${{ secrets.RELEASE }}