Skip to content

Commit

Permalink
Merge pull request #18 from Hintay/master
Browse files Browse the repository at this point in the history
Added ARMv5, ARMv6, ARMv7 supports to Action build
  • Loading branch information
Hintay authored Jul 5, 2022
2 parents 21c6f40 + 1c7dbfe commit a571bcc
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 23 deletions.
14 changes: 14 additions & 0 deletions .github/build/build_info.json
Original file line number Diff line number Diff line change
@@ -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"}
}
}
5 changes: 0 additions & 5 deletions .github/build/compiler_arch.json

This file was deleted.

39 changes: 27 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,23 @@ jobs:
# Exclude i386 on darwin.
- goarch: 386
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:
CGO_ENABLED: 1
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
DIST: nginx-ui-${{ matrix.GOOS }}-${{ matrix.GOARCH }}
outputs:
dist: ${{ env.DIST }}
GOARM: ${{ matrix.goarm }}
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -106,29 +116,34 @@ jobs:
path: |
~/.cache/go-build
~/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: |
${{ runner.os }}-${{ env.GOOS }}-${{ env.GOARCH }}-go-
${{ runner.os }}-${{ env.GOOS }}-${{ env.GOARCH }}${{ env.GOARM }}-go-
- name: Setup compiler environment
id: info
run: |
export _ARCH=$(jq ".[\"$GOARCH\"].$GOOS" -r < .github/build/compiler_arch.json)
echo "::set-output name=ARCH_NAME::$_ARCH"
export _NAME=nginx-ui-$(jq ".$GOOS[\"$GOARCH$GOARM\"].name" -r < .github/build/build_info.json)
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
if: env.GOOS == 'linux'
uses: Lesmiscore/[email protected]
id: musl
with:
target: ${{ steps.info.outputs.ARCH_NAME }}-linux-musl
target: ${{ env.ARCH_NAME }}-linux-musl${{ env.ABI }}

- name: Post install musl cross compiler
if: env.GOOS == 'linux'
run: |
echo "PATH=${{ steps.musl.outputs.path }}:$PATH" >> $GITHUB_ENV
echo "CC=${{ steps.info.outputs.ARCH_NAME }}-linux-musl-gcc" >> $GITHUB_ENV
echo "CXX=${{ steps.info.outputs.ARCH_NAME }}-linux-musl-g++" >> $GITHUB_ENV
echo "CC=${{ env.ARCH_NAME }}-linux-musl${{ env.ABI }}-gcc" >> $GITHUB_ENV
echo "CXX=${{ env.ARCH_NAME }}-linux-musl${{ env.ABI }}-g++" >> $GITHUB_ENV
echo "LD_FLAGS=--extldflags '-static'" >> $GITHUB_ENV
- name: Install darwin cross compiler
Expand All @@ -138,8 +153,8 @@ jobs:
tar xvaf crossosx.tar.zst
echo "LD_LIBRARY_PATH=$(pwd)/crossosx/lib/" >> $GITHUB_ENV
echo "PATH=$(pwd)/crossosx/bin/:$PATH" >> $GITHUB_ENV
echo "CC=${{ steps.info.outputs.ARCH_NAME }}-clang" >> $GITHUB_ENV
echo "CXX=${{ steps.info.outputs.ARCH_NAME }}-clang++" >> $GITHUB_ENV
echo "CC=${{ env.ARCH_NAME }}-clang" >> $GITHUB_ENV
echo "CXX=${{ env.ARCH_NAME }}-clang++" >> $GITHUB_ENV
echo "LD_FLAGS=-s -w" >> $GITHUB_ENV
- name: Download frontend artifacts
Expand Down
2 changes: 1 addition & 1 deletion README-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Nginx UI 遵循 Nginx 的标准,创建的网站配置文件位于 Nginx 配置
Nginx UI 可在以下平台中使用:

- 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
- FreeBSD (x86 / amd64)
- OpenBSD (x86 / amd64)
Expand Down
2 changes: 1 addition & 1 deletion README-zh_TW.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Nginx UI 遵循 Nginx 的標準,建立的網站配置檔案位於 Nginx 配置
Nginx UI 可在以下平臺中使用:

- 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
- FreeBSD (x86 / amd64)
- OpenBSD (x86 / amd64)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

- 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
- FreeBSD (x86 / amd64)
- OpenBSD (x86 / amd64)
Expand Down
17 changes: 14 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,24 @@ identify_the_operating_system_and_architecture() {
if [[ "$(uname)" == 'Linux' ]]; then
case "$(uname -m)" in
'i386' | 'i686')
MACHINE='386'
MACHINE='32'
;;
'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')
MACHINE='arm64'
MACHINE='arm64-v8a'
;;
*)
echo -e "${FontRed}error: The architecture is not supported.${FontSuffix}"
Expand Down

0 comments on commit a571bcc

Please sign in to comment.