7
7
push :
8
8
branches :
9
9
- master
10
+ tags :
11
+ - " *"
10
12
pull_request :
11
13
branches :
12
14
- master
@@ -21,35 +23,71 @@ jobs:
21
23
fail-fast : false
22
24
matrix :
23
25
include :
24
- - { os: ubuntu-20.04, target: linux, platform: linux-x64 }
25
- - { os: ubuntu-20.04, target: linux, platform: linux-arm64 }
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' }
26
29
- { os: macos-11, target: darwin, platform: darwin-x64 }
27
30
- { os: macos-11, target: darwin, platform: darwin-arm64 }
28
31
- { os: windows-latest, target: windows, platform: win32-ia32 }
29
32
- { os: windows-latest, target: windows, platform: win32-x64 }
30
33
runs-on : ${{ matrix.os }}
34
+ container :
35
+ image : ${{ matrix.container }}
31
36
steps :
32
- - uses : actions/checkout@v3
33
- with :
34
- submodules : recursive
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
35
46
36
- - name : Prepare Linux-ARM64
37
- if : ${{ matrix.platform == 'linux-arm64' }}
47
+ - name : Install aarch64-linux-gnu
48
+ if : ${{ matrix.platform == 'linux-arm64' && matrix.libc != 'musl' }}
38
49
run : |
50
+ apt-get update
39
51
apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
40
52
41
- - name : Install Luamake
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
+
65
+ - uses : actions/checkout@v3
66
+ with :
67
+ submodules : recursive
68
+
69
+ - name : Build for others step-1
70
+ if : ${{ matrix.libc != 'musl' }}
42
71
uses : actboy168/setup-luamake@master
43
72
44
- - name : Luamake
73
+ - name : Build for others step-2
74
+ if : ${{ matrix.libc != 'musl' }}
45
75
run : luamake -platform ${{ matrix.platform }}
46
76
77
+ - name : Build for musl
78
+ if : ${{ matrix.target == 'linux' && matrix.libc == 'musl' }}
79
+ run : ./make.sh
80
+
47
81
- name : Setting up workflow variables
48
82
id : vars
49
83
shell : bash
50
84
run : |
51
85
# Package version
52
- PKG_VERSION=${GITHUB_SHA:0:7}
86
+ if [[ $GITHUB_REF = refs/tags/* ]]; then
87
+ PKG_VERSION=${GITHUB_REF##*/}
88
+ else
89
+ PKG_VERSION=${GITHUB_SHA:0:7}
90
+ fi
53
91
54
92
# Package suffix relative to the platform
55
93
if [[ "${{ matrix.target }}" = windows ]]; then
60
98
61
99
# Package name w/ version
62
100
PKG_BASENAME="${{ env.PROJECT }}-${PKG_VERSION}-${{ matrix.platform }}"
101
+ if [[ "${{ matrix.libc }}" = musl ]]; then
102
+ PKG_BASENAME="${PKG_BASENAME}-${{matrix.libc}}"
103
+ fi
104
+
105
+ # Full name of the tarball asset
106
+ PKG_NAME="${PKG_BASENAME}.${PKG_SUFFIX}"
63
107
108
+ # Staging area for tarballs
109
+ PKG_STAGING="ci_staging/$PKG_BASENAME"
110
+
111
+ echo PKG_VERSION=${PKG_VERSION} >> $GITHUB_OUTPUT
64
112
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
65
116
66
117
- uses : actions/upload-artifact@v3
67
118
with :
@@ -76,3 +127,47 @@ jobs:
76
127
doc
77
128
meta
78
129
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 }}
0 commit comments