ci(windows): build windows package on otp 24

This commit is contained in:
Zaiming (Stone) Shi 2022-02-21 19:16:58 +01:00
parent f173a2f61f
commit 6dedf4875a
3 changed files with 50 additions and 36 deletions

View File

@ -52,18 +52,14 @@ jobs:
windows: windows:
runs-on: windows-2019 runs-on: windows-2019
needs: prepare needs: prepare
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
profile: # only CE for windows profile: # for now only CE for windows
- emqx - emqx
otp: otp:
## gleam-lang/setup-erlang does not yet support the installation of otp24 on windows - 24.2.1
- 23.2
steps: steps:
- uses: actions/download-artifact@v2 - uses: actions/download-artifact@v2
with: with:
@ -72,8 +68,7 @@ jobs:
- name: unzip source code - name: unzip source code
run: Expand-Archive -Path source.zip -DestinationPath ./ run: Expand-Archive -Path source.zip -DestinationPath ./
- uses: ilammy/msvc-dev-cmd@v1 - uses: ilammy/msvc-dev-cmd@v1
- uses: gleam-lang/setup-erlang@v1.1.2 - uses: erlef/setup-beam@v1
id: install_erlang
with: with:
otp-version: ${{ matrix.otp }} otp-version: ${{ matrix.otp }}
- name: build - name: build
@ -82,40 +77,22 @@ jobs:
DIAGNOSTIC: 1 DIAGNOSTIC: 1
working-directory: source working-directory: source
run: | run: |
$env:PATH = "${{ steps.install_erlang.outputs.erlpath }}\bin;$env:PATH" # ensure crypto app (openssl)
erl -eval "erlang:display(crypto:info_lib())" -s init stop
$version = $( "${{ github.ref }}" -replace "^(.*)/(.*)/" ) make ${{ matrix.profile }}-tgz
if ($version -match "^v[0-9]+\.[0-9]+(\.[0-9]+)?") {
$regex = "[0-9]+\.[0-9]+(-alpha|-beta|-rc)?\.[0-9]+"
$pkg_name = "${{ matrix.profile }}-$([regex]::matches($version, $regex).value)-otp${{ matrix.otp }}-windows-amd64.tar.gz"
}
else {
$pkg_name = "${{ matrix.profile }}-$($version -replace '/')-otp${{ matrix.otp }}-windows-amd64.tar.gz"
}
## We do not build/release bcrypt and quic for windows package
Remove-Item -Recurse -Force -Path _build/default/lib/bcrypt/
Remove-Item -Recurse -Force -Path _build/default/lib/quicer/
if (Test-Path rebar.lock) {
Remove-Item -Force -Path rebar.lock
}
make ensure-rebar3
copy rebar3 "${{ steps.install_erlang.outputs.erlpath }}\bin"
ls "${{ steps.install_erlang.outputs.erlpath }}\bin"
rebar3 --help
make ${{ matrix.profile }}
mkdir -p _packages/${{ matrix.profile }}
Compress-Archive -Path _build/${{ matrix.profile }}/rel/emqx -DestinationPath _build/${{ matrix.profile }}/rel/$pkg_name
mv _build/${{ matrix.profile }}/rel/$pkg_name _packages/${{ matrix.profile }}
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: 5
working-directory: source working-directory: source
run: | run: |
./_build/${{ matrix.profile }}/rel/emqx/bin/emqx start ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx start
Start-Sleep -s 5 Start-Sleep -s 5
echo "EMQX started"
./_build/${{ matrix.profile }}/rel/emqx/bin/emqx stop ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx stop
echo "EMQX stopped"
./_build/${{ matrix.profile }}/rel/emqx/bin/emqx install ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx install
echo "EMQX installed"
./_build/${{ matrix.profile }}/rel/emqx/bin/emqx uninstall ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx uninstall
echo "EMQX uninstalled"
- uses: actions/upload-artifact@v1 - uses: actions/upload-artifact@v1
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')
with: with:

View File

@ -96,6 +96,43 @@ jobs:
with: with:
name: ${{ matrix.profile}}-${{ matrix.otp }}-${{ matrix.os }} name: ${{ matrix.profile}}-${{ matrix.otp }}-${{ matrix.os }}
path: _packages/${{ matrix.profile}}/*.tar.gz path: _packages/${{ matrix.profile}}/*.tar.gz
windows:
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
profile:
- emqx
otp:
- 24.2.1
steps:
- uses: actions/checkout@v2
- uses: ilammy/msvc-dev-cmd@v1
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp }}
- name: build
env:
PYTHON: python
DIAGNOSTIC: 1
run: |
# ensure crypto app (openssl)
erl -eval "erlang:display(crypto:info_lib())" -s init stop
make ${{ matrix.profile }}-tgz
- name: run emqx
timeout-minutes: 5
run: |
./_build/${{ matrix.profile }}/rel/emqx/bin/emqx start
Start-Sleep -s 5
echo "EMQX started"
./_build/${{ matrix.profile }}/rel/emqx/bin/emqx stop
echo "EMQX stopped"
./_build/${{ matrix.profile }}/rel/emqx/bin/emqx install
echo "EQMX installed"
./_build/${{ matrix.profile }}/rel/emqx/bin/emqx uninstall
echo "EQMX uninstaled"
mac: mac:
strategy: strategy:
fail-fast: false fail-fast: false

View File

@ -29,7 +29,7 @@ The second path is for CMD to setup environment variables.
### Erlang/OTP ### Erlang/OTP
Install Erlang/OTP 23.2 from https://www.erlang.org/downloads Install Erlang/OTP 24 from https://www.erlang.org/downloads
You may need to edit the `Path` environment variable to allow running You may need to edit the `Path` environment variable to allow running
Erlang commands such as `erl` from powershell. Erlang commands such as `erl` from powershell.
@ -45,7 +45,7 @@ e.g.
``` ```
PS C:\Users\zmsto> erl PS C:\Users\zmsto> erl
Eshell V11.1.4 (abort with ^G) Eshell V12.2.1 (abort with ^G)
1> halt(). 1> halt().
``` ```