From fbb5336b73642c520c92b8070112dec7e3b298b3 Mon Sep 17 00:00:00 2001 From: Andrew Mayorov Date: Tue, 14 Jan 2025 18:47:13 +0100 Subject: [PATCH 1/5] ci: run test / diagnostic workflows under recent Erlang/OTP 27 --- .github/workflows/codeql.yml | 2 +- .github/workflows/cover.yaml | 4 ++-- .github/workflows/lux.yml | 6 +++--- .github/workflows/main.yml | 18 ++++++++++-------- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 274c2843..7c9c1955 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -34,7 +34,7 @@ jobs: - uses: erlef/setup-beam@v1.18.2 with: - otp-version: 24.3.4 + otp-version: '27' - name: Build cpp run: make build-nif diff --git a/.github/workflows/cover.yaml b/.github/workflows/cover.yaml index aa233201..3c4a0096 100644 --- a/.github/workflows/cover.yaml +++ b/.github/workflows/cover.yaml @@ -10,9 +10,9 @@ jobs: strategy: matrix: otp: - - 25.3.2 + - '27' rebar3: - - 3.20.0 + - '3.23.0' build_type: - RelWithDebInfo logging: diff --git a/.github/workflows/lux.yml b/.github/workflows/lux.yml index 3fd8da2d..452bd048 100644 --- a/.github/workflows/lux.yml +++ b/.github/workflows/lux.yml @@ -7,8 +7,8 @@ jobs: strategy: matrix: otp: - - 25.3.2 - - 26.2.1 + - '26.2.1' + - '27.2' steps: - name: Checkout uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 @@ -17,7 +17,7 @@ jobs: - uses: erlef/setup-beam@v1.18.2 with: otp-version: ${{ matrix.otp }} - rebar3-version: 3.23.0 + rebar3-version: '3.23.0' - name: build lux run: | diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cb2b9124..e9a33488 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,8 +15,8 @@ jobs: - name: Prepare OTP and rebar3 uses: erlef/setup-beam@v1.18.2 with: - otp-version: 26 - rebar3-version: 3.20.0 + otp-version: '27' + rebar3-version: '3.23.0' - name: Run erlfmt for erlang code run: | rebar3 fmt -c @@ -30,7 +30,9 @@ jobs: os: - macos-14 otp: - - 26 + - '27' + rebar3: + - '3.23.0' openssl: - openssl3 - openssl @@ -57,7 +59,7 @@ jobs: env: QUICER_TLS_VER: ${{ matrix.openssl }} run: | - wget https://s3.amazonaws.com/rebar3/rebar3 + wget https://github.com/erlang/rebar3/releases/download/${{ matrix.rebar3 }}/rebar3 sudo mv rebar3 /usr/local/bin/ && sudo chmod +x /usr/local/bin/rebar3 erl -eval 'erlang:display(erlang:system_info(system_version)),halt()' ulimit -c unlimited @@ -92,15 +94,15 @@ jobs: matrix: # https://builds.hex.pm/builds/otp/ubuntu-22.04/builds.txt otp: - - 25.3.2.9 - - 26.2.5.3 - - 27.1 + - '25.3.2.9' + - '26.2.5.3' + - '27.2' openssl: - openssl3 - openssl - sys rebar3: - - 3.23.0 + - '3.23.0' build_type: - RelWithDebInfo - Debug From 8f4f00dbc2a1a282d0c90f24c0ae26db45ab667b Mon Sep 17 00:00:00 2001 From: Andrew Mayorov Date: Tue, 14 Jan 2025 18:50:06 +0100 Subject: [PATCH 2/5] ci: enable releases targeting recent Erlang/OTP 27 --- .github/workflows/release.yaml | 35 +++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 180d583a..ba032d06 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -18,14 +18,17 @@ jobs: fail-fast: false matrix: otp: - - 26 + - '26' + - '27' + rebar3: + - '3.23.0' openssl: - openssl3 - openssl - sys os: - macos-14 - - macos-13 + - macos-15 runs-on: ${{ matrix.os }} steps: @@ -51,7 +54,7 @@ jobs: env: QUICER_TLS_VER: ${{ matrix.openssl }} run: | - wget https://s3.amazonaws.com/rebar3/rebar3 && chmod +x rebar3 + wget https://github.com/erlang/rebar3/releases/download/${{ matrix.rebar3 }}/rebar3 sudo mv rebar3 /usr/local/bin/ && sudo chmod +x /usr/local/bin/rebar3 erl -eval 'erlang:display(erlang:system_info(system_version)),halt()' export QUICER_TLS_VER @@ -69,8 +72,11 @@ jobs: strategy: fail-fast: false matrix: - otp: - - 26.2.5.2-1 + erlang: + - otp: 26.2.5.2-3 + builder: 5.4-4:1.15.7-26.2.5.2-3 + - otp: 27.2-2 + builder: 5.4-4:1.17.3-27.2-2 openssl: - openssl3 - openssl @@ -110,18 +116,21 @@ jobs: - name: build release if: startsWith(github.ref, 'refs/tags/') run: | - IMAGE=ghcr.io/emqx/emqx-builder/5.3-13:1.15.7-${{ matrix.otp }}-${{ matrix.os }} - docker run -i --rm -v $(pwd):/wd --workdir /wd --platform=linux/${{ matrix.arch }} \ - -e BUILD_RELEASE=1 -e QUICER_TLS_VER=${{ matrix.openssl }} \ - $IMAGE bash -euc 'git config --global --add safe.directory /wd; \ - grep -q "\"Amazon Linux 2\"" /etc/os-release && alternatives --set python /usr/bin/python2; \ - which yum && yum install -y perl-IPC-Cmd; \ - make' + docker run -i --rm -v $(pwd):/wd --workdir /wd \ + --platform=linux/${{ matrix.arch }} \ + -e BUILD_RELEASE=1 \ + -e QUICER_TLS_VER=${{ matrix.openssl }} \ + ghcr.io/emqx/emqx-builder/${{ matrix.erlang.builder }}-${{ matrix.os }} \ + bash -euc '\ + git config --global --add safe.directory /wd; \ + grep -q "\"Amazon Linux 2\"" /etc/os-release && alternatives --set python /usr/bin/python2; \ + which yum && yum install -y perl-IPC-Cmd; \ + make' - uses: actions/upload-artifact@v4 if: startsWith(github.ref, 'refs/tags/') with: - name: quicer-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.otp }}-${{ matrix.openssl }} + name: quicer-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.erlang.otp }}-${{ matrix.openssl }} path: | _packages/*.gz _packages/*.gz.sha256 From 5415f95dd57e10cceba0d235447f476847603665 Mon Sep 17 00:00:00 2001 From: Andrew Mayorov Date: Tue, 14 Jan 2025 18:50:35 +0100 Subject: [PATCH 3/5] ci: do not install `rebar3` unnecessarily --- .github/workflows/release.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index ba032d06..900d62db 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -102,11 +102,6 @@ jobs: with: fetch-depth: 0 - - name: install rebar3 - run: | - wget https://s3.amazonaws.com/rebar3/rebar3 && chmod +x rebar3 - cp ./rebar3 /usr/local/bin/rebar3 - - uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 - uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0 From 7f9f3ae352ee5b585218799d6e5048b01c56bf87 Mon Sep 17 00:00:00 2001 From: Andrew Mayorov Date: Tue, 14 Jan 2025 18:56:44 +0100 Subject: [PATCH 4/5] ci: enable rerelease of existing tags with release workflow --- .github/workflows/release.yaml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 900d62db..0b97979c 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -7,11 +7,15 @@ on: description: 'Ref to release' required: false default: '' + ref_name: + description: 'Tag to (re)release' + required: false push: tags: - "*" branches: - 'ci/**' + jobs: mac: strategy: @@ -50,7 +54,6 @@ jobs: ref: ${{ github.event.inputs.ref }} - name: build release - if: startsWith(github.ref, 'refs/tags/') env: QUICER_TLS_VER: ${{ matrix.openssl }} run: | @@ -61,7 +64,6 @@ jobs: BUILD_RELEASE=1 make - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 - if: startsWith(github.ref, 'refs/tags/') with: name: quicer-${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.openssl }} path: | @@ -101,6 +103,7 @@ jobs: - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: fetch-depth: 0 + ref: ${{ github.event.inputs.ref }} - uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 @@ -109,7 +112,6 @@ jobs: platforms: ${{ matrix.arch }} - name: build release - if: startsWith(github.ref, 'refs/tags/') run: | docker run -i --rm -v $(pwd):/wd --workdir /wd \ --platform=linux/${{ matrix.arch }} \ @@ -123,7 +125,6 @@ jobs: make' - uses: actions/upload-artifact@v4 - if: startsWith(github.ref, 'refs/tags/') with: name: quicer-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.erlang.otp }}-${{ matrix.openssl }} path: | @@ -135,7 +136,7 @@ jobs: needs: - mac - emqx-linux - if: startsWith(github.ref, 'refs/tags/') + if: github.event.inputs.ref_name || (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) steps: - uses: actions/download-artifact@v4 with: @@ -145,7 +146,8 @@ jobs: - name: Create Release uses: softprops/action-gh-release@v2 with: - name: quicer ${{ github.ref_name }} Released + name: quicer ${{ github.event.inputs.ref_name || github.ref_name }} Released + tag_name: ${{ github.event.inputs.ref_name || github.ref_name }} files: packages/* draft: true prerelease: false From 1a2fa6a56628ad87bd08a9dd36a72178f15e3ff2 Mon Sep 17 00:00:00 2001 From: Andrew Mayorov Date: Wed, 15 Jan 2025 11:00:13 +0100 Subject: [PATCH 5/5] test(upgrade): fix crashes in purge-related `end_per_testcase`s --- test/quicer_test_lib.erl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/quicer_test_lib.erl b/test/quicer_test_lib.erl index 5d8a280b..eceb236c 100644 --- a/test/quicer_test_lib.erl +++ b/test/quicer_test_lib.erl @@ -402,7 +402,13 @@ report_active_connections() -> report_active_connections(fun ct:comment/2). report_active_connections(LogFun) -> erlang:garbage_collect(), - {ok, Cnts} = quicer:perf_counters(), + case quicer:perf_counters() of + {ok, Cnts} -> + ok; + {error, not_found} -> + %% Library is likely not loaded. + Cnts = [{strm_active, 0}, {conn_active, 0}] + end, ActiveStrms = proplists:get_value(strm_active, Cnts), ActiveConns = proplists:get_value(conn_active, Cnts), 0 =/= (ActiveStrms + ActiveConns) andalso