Skip to content

Commit ecd43b3

Browse files
committed
split build and release
1 parent b6e452c commit ecd43b3

File tree

2 files changed

+173
-105
lines changed

2 files changed

+173
-105
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ on:
77
push:
88
branches:
99
- master
10-
tags:
11-
- "*"
1210
pull_request:
1311
branches:
1412
- master
@@ -23,71 +21,30 @@ jobs:
2321
fail-fast: false
2422
matrix:
2523
include:
26-
- { os: ubuntu-22.04, target: linux, platform: linux-x64, container: 'alpine:latest', libc: musl }
27-
- { os: ubuntu-20.04, target: linux, platform: linux-x64, container: 'ubuntu:18.04' }
28-
- { os: ubuntu-20.04, target: linux, platform: linux-arm64, container: 'ubuntu:18.04' }
24+
- { os: ubuntu-20.04, target: linux, platform: linux-x64 }
25+
- { os: ubuntu-20.04, target: linux, platform: linux-arm64 }
2926
- { os: macos-11, target: darwin, platform: darwin-x64 }
3027
- { os: macos-11, target: darwin, platform: darwin-arm64 }
3128
- { os: windows-latest, target: windows, platform: win32-ia32 }
3229
- { os: windows-latest, target: windows, platform: win32-x64 }
3330
runs-on: ${{ matrix.os }}
34-
container:
35-
image: ${{ matrix.container }}
3631
steps:
37-
- name: Prepare container
38-
if: ${{ matrix.target == 'linux' && matrix.libc != 'musl' }}
39-
run: |
40-
apt-get update
41-
apt-get install -y software-properties-common
42-
add-apt-repository -y ppa:ubuntu-toolchain-r/test # For gcc-9 and g++-9
43-
add-apt-repository -y ppa:git-core/ppa # For git>=2.18.
44-
apt-get update
45-
apt-get install -y sudo git gcc-9 g++-9
46-
47-
- name: Install aarch64-linux-gnu
48-
if: ${{ matrix.platform == 'linux-arm64' && matrix.libc != 'musl' }}
49-
run: |
50-
apt-get update
51-
apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
52-
53-
- name: Prepare container env
54-
if: ${{ matrix.target == 'linux' && matrix.libc != 'musl' }}
55-
run: |
56-
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 100
57-
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 100
58-
59-
- name: Prepare container for musl
60-
if: ${{ matrix.target == 'linux' && matrix.libc == 'musl' }}
61-
run: |
62-
apk update
63-
apk add git ninja bash build-base nodejs linux-headers
64-
6532
- uses: actions/checkout@v3
6633
with:
6734
submodules: recursive
6835

69-
- name: Build for others step-1
70-
if: ${{ matrix.libc != 'musl' }}
36+
- name: Install Luamake
7137
uses: actboy168/setup-luamake@master
7238

73-
- name: Build for others step-2
74-
if: ${{ matrix.libc != 'musl' }}
39+
- name: Luamake
7540
run: luamake -platform ${{ matrix.platform }}
7641

77-
- name: Build for musl
78-
if: ${{ matrix.target == 'linux' && matrix.libc == 'musl' }}
79-
run: ./make.sh
80-
8142
- name: Setting up workflow variables
8243
id: vars
8344
shell: bash
8445
run: |
8546
# Package version
86-
if [[ $GITHUB_REF = refs/tags/* ]]; then
87-
PKG_VERSION=${GITHUB_REF##*/}
88-
else
89-
PKG_VERSION=${GITHUB_SHA:0:7}
90-
fi
47+
PKG_VERSION=${GITHUB_SHA:0:7}
9148
9249
# Package suffix relative to the platform
9350
if [[ "${{ matrix.target }}" = windows ]]; then
@@ -98,21 +55,8 @@ jobs:
9855
9956
# Package name w/ version
10057
PKG_BASENAME="${{ env.PROJECT }}-${PKG_VERSION}-${{ matrix.platform }}"
101-
if [[ "${{ matrix.libc }}" = musl ]]; then
102-
PKG_BASENAME="${PKG_BASENAME}-${{matrix.libc}}"
103-
fi
10458
105-
# Full name of the tarball asset
106-
PKG_NAME="${PKG_BASENAME}.${PKG_SUFFIX}"
107-
108-
# Staging area for tarballs
109-
PKG_STAGING="ci_staging/$PKG_BASENAME"
110-
111-
echo PKG_VERSION=${PKG_VERSION} >> $GITHUB_OUTPUT
11259
echo PKG_BASENAME=${PKG_BASENAME} >> $GITHUB_OUTPUT
113-
echo PKG_NAME=${PKG_NAME} >> $GITHUB_OUTPUT
114-
echo PKG_PATH="${PKG_STAGING}/${PKG_NAME}" >> $GITHUB_OUTPUT
115-
echo PKG_STAGING=${PKG_STAGING} >> $GITHUB_OUTPUT
11660
11761
- uses: actions/upload-artifact@v3
11862
with:
@@ -127,47 +71,3 @@ jobs:
12771
doc
12872
meta
12973
script
130-
131-
- name: Package tarballs
132-
if: startsWith(github.ref, 'refs/tags/')
133-
shell: bash
134-
run: |
135-
STAGING=${{ steps.vars.outputs.PKG_STAGING }}
136-
NAME=${{ steps.vars.outputs.PKG_NAME }}
137-
138-
# Making the staging area
139-
mkdir -p ${STAGING}
140-
141-
# Copying binary and runtime files to staging area
142-
cp -r main.lua debugger.lua LICENSE changelog.md locale meta script ${{ env.BIN_DIR }} ${STAGING}
143-
144-
# Creating release assets
145-
pushd "${STAGING}/" >/dev/null
146-
if [[ "${{ matrix.target }}" = windows ]]; then
147-
7z -y a ${NAME} * | tail -2
148-
else
149-
tar czf ${NAME} *
150-
fi
151-
popd >/dev/null
152-
153-
# Packaging submodules for homebrew distribution
154-
- name: Package submodules
155-
id: submodules
156-
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.platform == 'darwin-x64' }}
157-
run: |
158-
STAGING=${{ steps.vars.outputs.PKG_STAGING }}
159-
PKG_SUBMOD_NAME="${{ env.PROJECT }}-${{ steps.vars.outputs.PKG_VERSION }}-submodules.zip"
160-
PKG_SUBMOD_PATH="${STAGING}/$PKG_SUBMOD_NAME"
161-
162-
zip -r $PKG_SUBMOD_PATH ./ -x "*.git*" -x "*.vscode*" -x "build*" -x "${{ env.BIN_DIR }}*" -x "${STAGING}*" -x "3rd/json.lua*" -x "log*" -x "ci_staging*"
163-
164-
echo PKG_SUBMOD_PATH=${PKG_SUBMOD_PATH} >> $GITHUB_OUTPUT
165-
166-
- name: Publish release assets
167-
uses: softprops/action-gh-release@v1
168-
if: startsWith(github.ref, 'refs/tags/')
169-
with:
170-
generate_release_notes: true
171-
files: |
172-
${{ steps.vars.outputs.PKG_PATH }}
173-
${{ steps.submodules.outputs.PKG_SUBMOD_PATH }}

.github/workflows/release.yml

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
name: build_full
2+
3+
permissions:
4+
contents: write
5+
6+
on:
7+
push:
8+
tags:
9+
- "*"
10+
11+
env:
12+
PROJECT: lua-language-server
13+
BIN_DIR: bin
14+
15+
jobs:
16+
compile:
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
include:
21+
- { os: ubuntu-22.04, target: linux, platform: linux-x64, container: 'alpine:latest', libc: musl }
22+
- { os: ubuntu-20.04, target: linux, platform: linux-x64, container: 'ubuntu:18.04' }
23+
- { os: ubuntu-20.04, target: linux, platform: linux-arm64, container: 'ubuntu:18.04' }
24+
- { os: macos-11, target: darwin, platform: darwin-x64 }
25+
- { os: macos-11, target: darwin, platform: darwin-arm64 }
26+
- { os: windows-latest, target: windows, platform: win32-ia32 }
27+
- { os: windows-latest, target: windows, platform: win32-x64 }
28+
runs-on: ${{ matrix.os }}
29+
container:
30+
image: ${{ matrix.container }}
31+
steps:
32+
- name: Prepare container
33+
if: ${{ matrix.target == 'linux' && matrix.libc != 'musl' }}
34+
run: |
35+
apt-get update
36+
apt-get install -y software-properties-common
37+
add-apt-repository -y ppa:ubuntu-toolchain-r/test # For gcc-9 and g++-9
38+
add-apt-repository -y ppa:git-core/ppa # For git>=2.18.
39+
apt-get update
40+
apt-get install -y sudo git gcc-9 g++-9
41+
42+
- name: Install aarch64-linux-gnu
43+
if: ${{ matrix.platform == 'linux-arm64' && matrix.libc != 'musl' }}
44+
run: |
45+
apt-get update
46+
apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
47+
48+
- name: Prepare container env
49+
if: ${{ matrix.target == 'linux' && matrix.libc != 'musl' }}
50+
run: |
51+
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 100
52+
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 100
53+
54+
- name: Prepare container for musl
55+
if: ${{ matrix.target == 'linux' && matrix.libc == 'musl' }}
56+
run: |
57+
apk update
58+
apk add git ninja bash build-base nodejs linux-headers
59+
60+
- uses: actions/checkout@v3
61+
with:
62+
submodules: recursive
63+
64+
- name: Build for others step-1
65+
if: ${{ matrix.libc != 'musl' }}
66+
uses: actboy168/setup-luamake@master
67+
68+
- name: Build for others step-2
69+
if: ${{ matrix.libc != 'musl' }}
70+
run: luamake -platform ${{ matrix.platform }}
71+
72+
- name: Build for musl
73+
if: ${{ matrix.target == 'linux' && matrix.libc == 'musl' }}
74+
run: ./make.sh
75+
76+
- name: Setting up workflow variables
77+
id: vars
78+
shell: bash
79+
run: |
80+
# Package version
81+
if [[ $GITHUB_REF = refs/tags/* ]]; then
82+
PKG_VERSION=${GITHUB_REF##*/}
83+
else
84+
PKG_VERSION=${GITHUB_SHA:0:7}
85+
fi
86+
87+
# Package suffix relative to the platform
88+
if [[ "${{ matrix.target }}" = windows ]]; then
89+
PKG_SUFFIX="zip"
90+
else
91+
PKG_SUFFIX="tar.gz"
92+
fi
93+
94+
# Package name w/ version
95+
PKG_BASENAME="${{ env.PROJECT }}-${PKG_VERSION}-${{ matrix.platform }}"
96+
if [[ "${{ matrix.libc }}" = musl ]]; then
97+
PKG_BASENAME="${PKG_BASENAME}-${{matrix.libc}}"
98+
fi
99+
100+
# Full name of the tarball asset
101+
PKG_NAME="${PKG_BASENAME}.${PKG_SUFFIX}"
102+
103+
# Staging area for tarballs
104+
PKG_STAGING="ci_staging/$PKG_BASENAME"
105+
106+
echo PKG_VERSION=${PKG_VERSION} >> $GITHUB_OUTPUT
107+
echo PKG_BASENAME=${PKG_BASENAME} >> $GITHUB_OUTPUT
108+
echo PKG_NAME=${PKG_NAME} >> $GITHUB_OUTPUT
109+
echo PKG_PATH="${PKG_STAGING}/${PKG_NAME}" >> $GITHUB_OUTPUT
110+
echo PKG_STAGING=${PKG_STAGING} >> $GITHUB_OUTPUT
111+
112+
- uses: actions/upload-artifact@v3
113+
with:
114+
name: ${{ steps.vars.outputs.PKG_BASENAME }}
115+
path: |
116+
${{ env.BIN_DIR }}
117+
main.lua
118+
debugger.lua
119+
LICENSE
120+
changelog.md
121+
locale
122+
doc
123+
meta
124+
script
125+
126+
- name: Package tarballs
127+
if: startsWith(github.ref, 'refs/tags/')
128+
shell: bash
129+
run: |
130+
STAGING=${{ steps.vars.outputs.PKG_STAGING }}
131+
NAME=${{ steps.vars.outputs.PKG_NAME }}
132+
133+
# Making the staging area
134+
mkdir -p ${STAGING}
135+
136+
# Copying binary and runtime files to staging area
137+
cp -r main.lua debugger.lua LICENSE changelog.md locale meta script ${{ env.BIN_DIR }} ${STAGING}
138+
139+
# Creating release assets
140+
pushd "${STAGING}/" >/dev/null
141+
if [[ "${{ matrix.target }}" = windows ]]; then
142+
7z -y a ${NAME} * | tail -2
143+
else
144+
tar czf ${NAME} *
145+
fi
146+
popd >/dev/null
147+
148+
# Packaging submodules for homebrew distribution
149+
- name: Package submodules
150+
id: submodules
151+
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.platform == 'darwin-x64' }}
152+
run: |
153+
STAGING=${{ steps.vars.outputs.PKG_STAGING }}
154+
PKG_SUBMOD_NAME="${{ env.PROJECT }}-${{ steps.vars.outputs.PKG_VERSION }}-submodules.zip"
155+
PKG_SUBMOD_PATH="${STAGING}/$PKG_SUBMOD_NAME"
156+
157+
zip -r $PKG_SUBMOD_PATH ./ -x "*.git*" -x "*.vscode*" -x "build*" -x "${{ env.BIN_DIR }}*" -x "${STAGING}*" -x "3rd/json.lua*" -x "log*" -x "ci_staging*"
158+
159+
echo PKG_SUBMOD_PATH=${PKG_SUBMOD_PATH} >> $GITHUB_OUTPUT
160+
161+
- name: Publish release assets
162+
uses: softprops/action-gh-release@v1
163+
if: startsWith(github.ref, 'refs/tags/')
164+
with:
165+
generate_release_notes: true
166+
files: |
167+
${{ steps.vars.outputs.PKG_PATH }}
168+
${{ steps.submodules.outputs.PKG_SUBMOD_PATH }}

0 commit comments

Comments
 (0)