chore(CI): rename artifact for build packages workflows

Signed-off-by: zhanghongtong <rory-z@outlook.com>
This commit is contained in:
zhanghongtong 2021-08-12 09:33:47 +08:00 committed by Rory Z
parent 618125b1da
commit d1faf93bbf
2 changed files with 55 additions and 42 deletions

View File

@ -44,6 +44,11 @@ jobs:
echo "::set-output name=old_vsns::$old_vsns" echo "::set-output name=old_vsns::$old_vsns"
echo "::set-output name=profiles::[\"emqx\", \"emqx-edge\"]" echo "::set-output name=profiles::[\"emqx\", \"emqx-edge\"]"
fi fi
- name: get otp version
id: get_otp_version
run: |
otp="$(erl -eval '{ok, Version} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), "OTP_VERSION"])), io:fwrite(Version), halt().' -noshell)"
echo "::set-output name=otp::$otp"
- name: set get token - name: set get token
if: endsWith(github.repository, 'enterprise') if: endsWith(github.repository, 'enterprise')
run: | run: |
@ -54,12 +59,13 @@ jobs:
run: | run: |
make ensure-rebar3 make ensure-rebar3
./rebar3 as default get-deps ./rebar3 as default get-deps
rm -rf rebar.lock
- name: gen zip file - name: gen zip file
run: zip -ryq source.zip source/* source/.[^.]* run: zip -ryq source-${{ steps.get_otp_version.outputs.otp }}.zip source/* source/.[^.]*
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
with: with:
name: source name: source-${{ steps.get_otp_version.outputs.otp }}
path: source.zip path: source-${{ steps.get_otp_version.outputs.otp }}.zip
windows: windows:
runs-on: windows-2019 runs-on: windows-2019
@ -77,19 +83,21 @@ jobs:
steps: steps:
- uses: actions/download-artifact@v2 - uses: actions/download-artifact@v2
with: with:
name: source name: source-23.2.7.2-emqx-2
path: . path: .
- name: unzip source code - name: unzip source code
run: Expand-Archive -Path source.zip -DestinationPath ./ run: Expand-Archive -Path source-23.2.7.2-emqx-2.zip -DestinationPath ./
- uses: ilammy/msvc-dev-cmd@v1 - uses: ilammy/msvc-dev-cmd@v1
- uses: gleam-lang/setup-erlang@v1.1.0 - uses: gleam-lang/setup-erlang@v1.1.2
id: install_erlang id: install_erlang
## gleam-lang/setup-erlang does not yet support the installation of otp24 on windows
with: with:
otp-version: 24.0.5 otp-version: 23.2
- name: build - name: build
env: env:
PYTHON: python PYTHON: python
DIAGNOSTIC: 1 DIAGNOSTIC: 1
working-directory: source
run: | run: |
$env:PATH = "${{ steps.install_erlang.outputs.erlpath }}\bin;$env:PATH" $env:PATH = "${{ steps.install_erlang.outputs.erlpath }}\bin;$env:PATH"
@ -101,9 +109,9 @@ jobs:
else { else {
$pkg_name = "${{ matrix.profile }}-windows-$($version -replace '/').zip" $pkg_name = "${{ matrix.profile }}-windows-$($version -replace '/').zip"
} }
cd source ## We do not build/release bcrypt and quic for windows package
## We do not build/release bcrypt for windows package
Remove-Item -Recurse -Force -Path _build/default/lib/bcrypt/ Remove-Item -Recurse -Force -Path _build/default/lib/bcrypt/
Remove-Item -Recurse -Force -Path _build/default/lib/quicer/
if (Test-Path rebar.lock) { if (Test-Path rebar.lock) {
Remove-Item -Force -Path rebar.lock Remove-Item -Force -Path rebar.lock
} }
@ -118,8 +126,8 @@ jobs:
Get-FileHash -Path "_packages/${{ matrix.profile }}/$pkg_name" | Format-List | grep 'Hash' | awk '{print $3}' > _packages/${{ matrix.profile }}/$pkg_name.sha256 Get-FileHash -Path "_packages/${{ matrix.profile }}/$pkg_name" | Format-List | grep 'Hash' | awk '{print $3}' > _packages/${{ matrix.profile }}/$pkg_name.sha256
- name: run emqx - name: run emqx
timeout-minutes: 1 timeout-minutes: 1
working-directory: source
run: | run: |
cd source
./_build/${{ matrix.profile }}/rel/emqx/bin/emqx start ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx start
Start-Sleep -s 5 Start-Sleep -s 5
./_build/${{ matrix.profile }}/rel/emqx/bin/emqx stop ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx stop
@ -128,7 +136,7 @@ jobs:
- uses: actions/upload-artifact@v1 - uses: actions/upload-artifact@v1
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')
with: with:
name: ${{ matrix.profile }} name: ${{ matrix.profile }}-23.2.7.2-emqx-2
path: source/_packages/${{ matrix.profile }}/. path: source/_packages/${{ matrix.profile }}/.
mac: mac:
@ -140,7 +148,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
profile: ${{fromJSON(needs.prepare.outputs.profiles)}} profile: ${{fromJSON(needs.prepare.outputs.profiles)}}
erl_otp: otp:
- 24.0.5-emqx-1 - 24.0.5-emqx-1
exclude: exclude:
- profile: emqx-edge - profile: emqx-edge
@ -148,10 +156,10 @@ jobs:
steps: steps:
- uses: actions/download-artifact@v2 - uses: actions/download-artifact@v2
with: with:
name: source name: source-${{ matrix.otp }}
path: . path: .
- name: unzip source code - name: unzip source code
run: unzip -q source.zip run: unzip -q source-${{ matrix.otp }}.zip
- name: prepare - name: prepare
run: | run: |
brew update brew update
@ -162,7 +170,7 @@ jobs:
id: cache id: cache
with: with:
path: ~/.kerl path: ~/.kerl
key: erl${{ matrix.erl_otp }}-macos10.15 key: erl${{ matrix.otp }}-macos10.15
- name: build erlang - name: build erlang
if: steps.cache.outputs.cache-hit != 'true' if: steps.cache.outputs.cache-hit != 'true'
timeout-minutes: 60 timeout-minutes: 60
@ -171,18 +179,18 @@ jobs:
OTP_GITHUB_URL: https://github.com/emqx/otp OTP_GITHUB_URL: https://github.com/emqx/otp
run: | run: |
kerl update releases kerl update releases
kerl build ${{ matrix.erl_otp }} kerl build ${{ matrix.otp }}
kerl install ${{ matrix.erl_otp }} $HOME/.kerl/${{ matrix.erl_otp }} kerl install ${{ matrix.otp }} $HOME/.kerl/${{ matrix.otp }}
- name: build - name: build
working-directory: source
run: | run: |
. $HOME/.kerl/${{ matrix.erl_otp }}/activate . $HOME/.kerl/${{ matrix.otp }}/activate
cd source
make ensure-rebar3 make ensure-rebar3
sudo cp rebar3 /usr/local/bin/rebar3 sudo cp rebar3 /usr/local/bin/rebar3
make ${{ matrix.profile }}-zip make ${{ matrix.profile }}-zip
- name: test - name: test
working-directory: source
run: | run: |
cd source
pkg_name=$(basename _packages/${{ matrix.profile }}/${{ matrix.profile }}-*.zip) pkg_name=$(basename _packages/${{ matrix.profile }}/${{ matrix.profile }}-*.zip)
unzip -q _packages/${{ matrix.profile }}/$pkg_name unzip -q _packages/${{ matrix.profile }}/$pkg_name
# gsed -i '/emqx_telemetry/d' ./emqx/data/loaded_plugins # gsed -i '/emqx_telemetry/d' ./emqx/data/loaded_plugins
@ -207,7 +215,7 @@ jobs:
- uses: actions/upload-artifact@v1 - uses: actions/upload-artifact@v1
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')
with: with:
name: ${{ matrix.profile }} name: ${{ matrix.profile }}-${{ matrix.otp }}
path: source/_packages/${{ matrix.profile }}/. path: source/_packages/${{ matrix.profile }}/.
linux: linux:
@ -219,12 +227,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
profile: ${{fromJSON(needs.prepare.outputs.profiles)}} profile: ${{fromJSON(needs.prepare.outputs.profiles)}}
erl_otp:
- 23.2.7.2-emqx-2
- 24.0.5-emqx-1
arch:
- amd64
- arm64
os: os:
- ubuntu20.04 - ubuntu20.04
- ubuntu18.04 - ubuntu18.04
@ -237,6 +239,12 @@ jobs:
- centos6 - centos6
- raspbian10 - raspbian10
# - raspbian9 # - raspbian9
arch:
- amd64
- arm64
otp:
- 23.2.7.2-emqx-2
- 24.0.5-emqx-1
exclude: exclude:
- os: centos6 - os: centos6
arch: arm64 arch: arm64
@ -265,10 +273,10 @@ jobs:
platforms: all platforms: all
- uses: actions/download-artifact@v2 - uses: actions/download-artifact@v2
with: with:
name: source name: source-${{ matrix.otp }}
path: . path: .
- name: unzip source code - name: unzip source code
run: unzip -q source.zip run: unzip -q source-${{ matrix.otp }}.zip
- name: downloads old emqx zip packages - name: downloads old emqx zip packages
env: env:
PROFILE: ${{ matrix.profile }} PROFILE: ${{ matrix.profile }}
@ -298,7 +306,7 @@ jobs:
done done
- name: build emqx packages - name: build emqx packages
env: env:
ERL_OTP: erl${{ matrix.erl_otp }} ERL_OTP: erl${{ matrix.otp }}
PROFILE: ${{ matrix.profile }} PROFILE: ${{ matrix.profile }}
ARCH: ${{ matrix.arch }} ARCH: ${{ matrix.arch }}
SYSTEM: ${{ matrix.os }} SYSTEM: ${{ matrix.os }}
@ -327,7 +335,7 @@ jobs:
- uses: actions/upload-artifact@v1 - uses: actions/upload-artifact@v1
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')
with: with:
name: ${{ matrix.profile }} name: ${{ matrix.profile }}-${{ matrix.otp }}
path: source/_packages/${{ matrix.profile }}/. path: source/_packages/${{ matrix.profile }}/.
docker: docker:
@ -338,16 +346,16 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
profile: ${{fromJSON(needs.prepare.outputs.profiles)}} profile: ${{fromJSON(needs.prepare.outputs.profiles)}}
erl_otp: otp:
- 24.0.5-emqx-1 - 24.0.5-emqx-1
steps: steps:
- uses: actions/download-artifact@v2 - uses: actions/download-artifact@v2
with: with:
name: source name: source-${{ matrix.otp }}
path: . path: .
- name: unzip source code - name: unzip source code
run: unzip -q source.zip run: unzip -q source-${{ matrix.otp }}.zip
- uses: docker/setup-buildx-action@v1 - uses: docker/setup-buildx-action@v1
- uses: docker/setup-qemu-action@v1 - uses: docker/setup-qemu-action@v1
with: with:
@ -356,7 +364,7 @@ jobs:
- name: build emqx docker image - name: build emqx docker image
if: github.event_name != 'release' if: github.event_name != 'release'
env: env:
ERL_OTP: erl${{ matrix.erl_otp }} ERL_OTP: erl${{ matrix.otp }}
PROFILE: ${{ matrix.profile }} PROFILE: ${{ matrix.profile }}
working-directory: source working-directory: source
run: | run: |
@ -377,7 +385,7 @@ jobs:
- name: build emqx docker image - name: build emqx docker image
if: github.event_name == 'release' if: github.event_name == 'release'
env: env:
ERL_OTP: erl${{ matrix.erl_otp }} ERL_OTP: erl${{ matrix.otp }}
PROFILE: ${{ matrix.profile }} PROFILE: ${{ matrix.profile }}
working-directory: source working-directory: source
run: | run: |
@ -393,12 +401,18 @@ jobs:
--push . --push .
delete-artifact: delete-artifact:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
strategy:
matrix:
otp:
- 23.2.7.2-emqx-2
- 24.0.5-emqx-1
needs: [prepare, mac, linux, docker] needs: [prepare, mac, linux, docker]
steps: steps:
- uses: geekyeggo/delete-artifact@v1 - uses: geekyeggo/delete-artifact@v1
with: with:
name: source name: source-${{ matrix.otp }}
upload: upload:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
@ -410,6 +424,8 @@ jobs:
strategy: strategy:
matrix: matrix:
profile: ${{fromJSON(needs.prepare.outputs.profiles)}} profile: ${{fromJSON(needs.prepare.outputs.profiles)}}
otp:
- 24.0.5-emqx-1
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -420,7 +436,7 @@ jobs:
echo 'EOF' >> $GITHUB_ENV echo 'EOF' >> $GITHUB_ENV
- uses: actions/download-artifact@v2 - uses: actions/download-artifact@v2
with: with:
name: ${{ matrix.profile }} name: ${{ matrix.profile }}-${{ matrix.otp }}
path: ./_packages/${{ matrix.profile }} path: ./_packages/${{ matrix.profile }}
- name: install dos2unix - name: install dos2unix
run: sudo apt-get update && sudo apt install -y dos2unix run: sudo apt-get update && sudo apt install -y dos2unix

View File

@ -397,10 +397,7 @@ is_debug(VarName) ->
end. end.
provide_bcrypt_dep() -> provide_bcrypt_dep() ->
case os:type() of not is_win32().
{win32, _} -> false;
_ -> true
end.
provide_bcrypt_release(ReleaseType) -> provide_bcrypt_release(ReleaseType) ->
provide_bcrypt_dep() andalso ReleaseType =:= cloud. provide_bcrypt_dep() andalso ReleaseType =:= cloud.