Merge pull request #18 from Hintay/master

Added ARMv5, ARMv6, ARMv7 supports to Action build
This commit is contained in:
Hintay 2022-07-05 20:04:02 +08:00 committed by GitHub
commit a571bccb84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 58 additions and 23 deletions

14
.github/build/build_info.json vendored Normal file
View file

@ -0,0 +1,14 @@
{
"linux": {
"386": {"arch": "i686", "name": "linux-32"},
"amd64": {"arch": "x86_64", "name": "linux-64"},
"arm5": {"arch": "arm", "abi": "eabi", "name": "linux-arm32-v5"},
"arm6": {"arch": "armv5l", "abi": "eabihf", "name": "linux-arm32-v6"},
"arm7": {"arch": "armv7l", "abi": "eabihf", "name": "linux-arm32-v7a"},
"arm64": {"arch": "aarch64", "name": "linux-arm64-v8a"}
},
"darwin": {
"amd64": {"arch": "o64", "name": "macos-64"},
"arm64": {"arch": "oa64", "name": "macos-arm64-v8a"}
}
}

View file

@ -1,5 +0,0 @@
{
"386": {"linux": "i686"},
"amd64": {"linux": "x86_64", "darwin": "o64"},
"arm64": {"linux": "aarch64", "darwin": "oa64"}
}

View file

@ -84,13 +84,23 @@ jobs:
# Exclude i386 on darwin. # Exclude i386 on darwin.
- goarch: 386 - goarch: 386
goos: darwin goos: darwin
include:
# BEGIN Linux ARM 5 6 7
- goos: linux
goarch: arm
goarm: 7
- goos: linux
goarch: arm
goarm: 6
- goos: linux
goarch: arm
goarm: 5
# END Linux ARM 5 6 7
env: env:
CGO_ENABLED: 1 CGO_ENABLED: 1
GOOS: ${{ matrix.goos }} GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }} GOARCH: ${{ matrix.goarch }}
DIST: nginx-ui-${{ matrix.GOOS }}-${{ matrix.GOARCH }} GOARM: ${{ matrix.goarm }}
outputs:
dist: ${{ env.DIST }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -106,29 +116,34 @@ jobs:
path: | path: |
~/.cache/go-build ~/.cache/go-build
~/go/pkg/mod ~/go/pkg/mod
key: ${{ runner.os }}-${{ env.GOOS }}-${{ env.GOARCH }}-go-${{ hashFiles('**/go.sum') }} key: ${{ runner.os }}-${{ env.GOOS }}-${{ env.GOARCH }}${{ env.GOARM }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: | restore-keys: |
${{ runner.os }}-${{ env.GOOS }}-${{ env.GOARCH }}-go- ${{ runner.os }}-${{ env.GOOS }}-${{ env.GOARCH }}${{ env.GOARM }}-go-
- name: Setup compiler environment - name: Setup compiler environment
id: info id: info
run: | run: |
export _ARCH=$(jq ".[\"$GOARCH\"].$GOOS" -r < .github/build/compiler_arch.json) export _NAME=nginx-ui-$(jq ".$GOOS[\"$GOARCH$GOARM\"].name" -r < .github/build/build_info.json)
echo "::set-output name=ARCH_NAME::$_ARCH" export _ARCH=$(jq ".$GOOS[\"$GOARCH$GOARM\"].arch" -r < .github/build/build_info.json)
export _ABI=$(jq ".$GOOS[\"$GOARCH$GOARM\"].abi // \"\"" -r < .github/build/build_info.json)
echo "GOOS: $GOOS, GOARCH: $GOARCH, GOARM: $GOARM, ABI: $_ABI, RELEASE_NAME: $_NAME"
echo "ARCH_NAME=$_ARCH" >> $GITHUB_ENV
echo "ABI=$_ABI" >> $GITHUB_ENV
echo "DIST=$_NAME" >> $GITHUB_ENV
- name: Install musl cross compiler - name: Install musl cross compiler
if: env.GOOS == 'linux' if: env.GOOS == 'linux'
uses: Lesmiscore/musl-cross-compilers@v0.5 uses: Lesmiscore/musl-cross-compilers@v0.5
id: musl id: musl
with: with:
target: ${{ steps.info.outputs.ARCH_NAME }}-linux-musl target: ${{ env.ARCH_NAME }}-linux-musl${{ env.ABI }}
- name: Post install musl cross compiler - name: Post install musl cross compiler
if: env.GOOS == 'linux' if: env.GOOS == 'linux'
run: | run: |
echo "PATH=${{ steps.musl.outputs.path }}:$PATH" >> $GITHUB_ENV echo "PATH=${{ steps.musl.outputs.path }}:$PATH" >> $GITHUB_ENV
echo "CC=${{ steps.info.outputs.ARCH_NAME }}-linux-musl-gcc" >> $GITHUB_ENV echo "CC=${{ env.ARCH_NAME }}-linux-musl${{ env.ABI }}-gcc" >> $GITHUB_ENV
echo "CXX=${{ steps.info.outputs.ARCH_NAME }}-linux-musl-g++" >> $GITHUB_ENV echo "CXX=${{ env.ARCH_NAME }}-linux-musl${{ env.ABI }}-g++" >> $GITHUB_ENV
echo "LD_FLAGS=--extldflags '-static'" >> $GITHUB_ENV echo "LD_FLAGS=--extldflags '-static'" >> $GITHUB_ENV
- name: Install darwin cross compiler - name: Install darwin cross compiler
@ -138,8 +153,8 @@ jobs:
tar xvaf crossosx.tar.zst tar xvaf crossosx.tar.zst
echo "LD_LIBRARY_PATH=$(pwd)/crossosx/lib/" >> $GITHUB_ENV echo "LD_LIBRARY_PATH=$(pwd)/crossosx/lib/" >> $GITHUB_ENV
echo "PATH=$(pwd)/crossosx/bin/:$PATH" >> $GITHUB_ENV echo "PATH=$(pwd)/crossosx/bin/:$PATH" >> $GITHUB_ENV
echo "CC=${{ steps.info.outputs.ARCH_NAME }}-clang" >> $GITHUB_ENV echo "CC=${{ env.ARCH_NAME }}-clang" >> $GITHUB_ENV
echo "CXX=${{ steps.info.outputs.ARCH_NAME }}-clang++" >> $GITHUB_ENV echo "CXX=${{ env.ARCH_NAME }}-clang++" >> $GITHUB_ENV
echo "LD_FLAGS=-s -w" >> $GITHUB_ENV echo "LD_FLAGS=-s -w" >> $GITHUB_ENV
- name: Download frontend artifacts - name: Download frontend artifacts

View file

@ -107,7 +107,7 @@ Nginx UI 遵循 Nginx 的标准,创建的网站配置文件位于 Nginx 配置
Nginx UI 可在以下平台中使用: Nginx UI 可在以下平台中使用:
- Mac OS X 10.10 Yosemite 及之后版本amd64 / arm64 - Mac OS X 10.10 Yosemite 及之后版本amd64 / arm64
- Linux 2.6.23 及之后版本x86 / amd64 / arm64 - Linux 2.6.23 及之后版本x86 / amd64 / arm64 / armv5 / armv6 / armv7
- 包括但不限于 Debian 7 / 8、Ubuntu 12.04 / 14.04 及后续版本、CentOS 6 / 7、Arch Linux - 包括但不限于 Debian 7 / 8、Ubuntu 12.04 / 14.04 及后续版本、CentOS 6 / 7、Arch Linux
- FreeBSD (x86 / amd64) - FreeBSD (x86 / amd64)
- OpenBSD (x86 / amd64) - OpenBSD (x86 / amd64)

View file

@ -107,7 +107,7 @@ Nginx UI 遵循 Nginx 的標準,建立的網站配置檔案位於 Nginx 配置
Nginx UI 可在以下平臺中使用: Nginx UI 可在以下平臺中使用:
- Mac OS X 10.10 Yosemite 及之後版本amd64 / arm64 - Mac OS X 10.10 Yosemite 及之後版本amd64 / arm64
- Linux 2.6.23 及之後版本x86 / amd64 / arm64 - Linux 2.6.23 及之後版本x86 / amd64 / arm64 / armv5 / armv6 / armv7
- 包括但不限於 Debian 7 / 8、Ubuntu 12.04 / 14.04 及後續版本、CentOS 6 / 7、Arch Linux - 包括但不限於 Debian 7 / 8、Ubuntu 12.04 / 14.04 及後續版本、CentOS 6 / 7、Arch Linux
- FreeBSD (x86 / amd64) - FreeBSD (x86 / amd64)
- OpenBSD (x86 / amd64) - OpenBSD (x86 / amd64)

View file

@ -105,7 +105,7 @@ to the `sites-enabled` directory. Therefore, you may need to adjust the way the
Nginx UI is available on the following platforms: Nginx UI is available on the following platforms:
- Mac OS X 10.10 Yosemite and later (amd64 / arm64) - Mac OS X 10.10 Yosemite and later (amd64 / arm64)
- Linux 2.6.23 and later (x86 / amd64 / arm64) - Linux 2.6.23 and later (x86 / amd64 / arm64 / armv5 / armv6 / armv7)
- Including but not limited to Debian 7 / 8, Ubuntu 12.04 / 14.04 and later, CentOS 6 / 7, Arch Linux - Including but not limited to Debian 7 / 8, Ubuntu 12.04 / 14.04 and later, CentOS 6 / 7, Arch Linux
- FreeBSD (x86 / amd64) - FreeBSD (x86 / amd64)
- OpenBSD (x86 / amd64) - OpenBSD (x86 / amd64)

View file

@ -134,13 +134,24 @@ identify_the_operating_system_and_architecture() {
if [[ "$(uname)" == 'Linux' ]]; then if [[ "$(uname)" == 'Linux' ]]; then
case "$(uname -m)" in case "$(uname -m)" in
'i386' | 'i686') 'i386' | 'i686')
MACHINE='386' MACHINE='32'
;; ;;
'amd64' | 'x86_64') 'amd64' | 'x86_64')
MACHINE='amd64' MACHINE='64'
;;
'armv5tel')
MACHINE='arm32-v5'
;;
'armv6l')
MACHINE='arm32-v6'
grep Features /proc/cpuinfo | grep -qw 'vfp' || MACHINE='arm32-v5'
;;
'armv7' | 'armv7l')
MACHINE='arm32-v7a'
grep Features /proc/cpuinfo | grep -qw 'vfp' || MACHINE='arm32-v5'
;; ;;
'armv8' | 'aarch64') 'armv8' | 'aarch64')
MACHINE='arm64' MACHINE='arm64-v8a'
;; ;;
*) *)
echo -e "${FontRed}error: The architecture is not supported.${FontSuffix}" echo -e "${FontRed}error: The architecture is not supported.${FontSuffix}"