From 17093edb0a6034d7baf7b350611ce9e19c0ade3a Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Mon, 20 Nov 2023 14:07:19 +0100 Subject: [PATCH 1/8] Remove Makefile, moving to pure rebar3 --- Makefile | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 Makefile diff --git a/Makefile b/Makefile deleted file mode 100644 index 43482d7..0000000 --- a/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -.PHONY: rel deps test - -REBARVER = 3.15.2 - -all: deps compile - -compile: rebar3 - ./rebar3 compile - -deps: rebar3 - ./rebar3 get-deps - -clean: rebar3 - ./rebar3 clean - -test-deps: rebar3 - ./rebar3 get-deps - -test-compile: rebar3 test-deps - ./rebar3 as test compile - -test: test-compile - ./rebar3 as test ct - -codecov: _build/test/cover/ct.coverdata - ./rebar3 as test codecov analyze - -gcov: test-compile - gcov -o c_src fast_pbkdf2 - -rebar3: - wget https://github.com/erlang/rebar3/releases/download/${REBARVER}/rebar3 &&\ - chmod u+x rebar3 - -dialyzer: rebar3 - ./rebar3 dialyzer From 8b493c215ef11dd16e9a2db642e9adcaf113098a Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Mon, 20 Nov 2023 14:07:40 +0100 Subject: [PATCH 2/8] Update codecov plugin --- rebar.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rebar.config b/rebar.config index f73d7a5..3203938 100644 --- a/rebar.config +++ b/rebar.config @@ -12,7 +12,7 @@ {proper, "1.4.0"} ]}, {plugins, [ - {rebar3_codecov, "0.3.0"}]}, + {rebar3_codecov, "0.6.0"}]}, {port_env, [ {"CFLAGS", "$CFLAGS -std=c99 -O3 -g -Wall -Wextra -fPIC -I/opt/homebrew/include -I/usr/local/include --coverage"}, From ea87390b65afb8391215a94dd7e3a555bcb3e29d Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Mon, 20 Nov 2023 14:09:19 +0100 Subject: [PATCH 3/8] Split port_env in two lines --- rebar.config | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rebar.config b/rebar.config index 3203938..361dbdc 100644 --- a/rebar.config +++ b/rebar.config @@ -27,8 +27,10 @@ {port_env, [ - {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)", "CFLAGS", "$CFLAGS -std=c99 -O3 -g -Wall -Wextra -fPIC -I/opt/homebrew/include -I/usr/local/include "}, - {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)", "LDLIBS", "$LDLIBS -lcrypto -L/opt/homebrew/lib/ -L/usr/local/lib"}, + {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)", + "CFLAGS", "$CFLAGS -std=c99 -O3 -g -Wall -Wextra -fPIC -I/opt/homebrew/include -I/usr/local/include"}, + {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)", + "LDLIBS", "$LDLIBS -lcrypto -L/opt/homebrew/lib/ -L/usr/local/lib"}, {"win32", "CFLAGS", "$CFLAGS /O2 /DNDEBUG /Wall"}, {"win32", "LDLIBS", "$LDLIBS libcrypto.lib"}, {"DRV_LINK_TEMPLATE", "$DRV_LINK_TEMPLATE $LDLIBS"} From 7616fd83c4c95c82e50ba18dad62eadb296b7dcd Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Mon, 20 Nov 2023 14:10:12 +0100 Subject: [PATCH 4/8] Test with no C optimisations for coverage --- rebar.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rebar.config b/rebar.config index 361dbdc..7644415 100644 --- a/rebar.config +++ b/rebar.config @@ -15,7 +15,7 @@ {rebar3_codecov, "0.6.0"}]}, {port_env, [ - {"CFLAGS", "$CFLAGS -std=c99 -O3 -g -Wall -Wextra -fPIC -I/opt/homebrew/include -I/usr/local/include --coverage"}, + {"CFLAGS", "$CFLAGS -std=c99 -O0 -g -Wall -Wextra -fPIC -I/opt/homebrew/include -I/usr/local/include --coverage"}, {"LDLIBS", "$LDLIBS -lcrypto -L/opt/homebrew/lib/ -L/usr/local/lib --coverage"} ] } From 0908785756aa68157d80f446fb575c332bb41927 Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Mon, 20 Nov 2023 14:10:40 +0100 Subject: [PATCH 5/8] gitignore codecov.json --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 0154361..e0fa4c7 100644 --- a/.gitignore +++ b/.gitignore @@ -27,4 +27,4 @@ priv/ erl_crash.dump *.ez *.tar - +codecov.json From 42c61565dc094476fe22defb07488066de13bd30 Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Mon, 20 Nov 2023 14:11:56 +0100 Subject: [PATCH 6/8] Use pure rebar3 in GHA --- .github/workflows/ci.yml | 58 +++++++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 285b205..9b5264b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,28 +9,44 @@ on: jobs: test: - name: OTP ${{matrix.otp}} + name: OTP ${{matrix.otp}} / rebar3 ${{matrix.rebar3}} / OS ${{matrix.os}} strategy: matrix: - otp: ['24.0', '23.3', '22.3', '21.3'] - runs-on: 'ubuntu-20.04' - env: - OTPVER: ${{ matrix.otp }} + os: ['ubuntu-22.04'] + otp: ['26.1', '25.3', '24.3'] + rebar3: ['3.22.1'] + runs-on: ${{matrix.os}} steps: - - uses: actions/checkout@v2 - - uses: ErlGang/setup-erlang@v1.0.0 + - uses: actions/checkout@v3 + - uses: erlef/setup-beam@v1 with: - otp-version: ${{ matrix.otp }} - - run: make rebar3 - - run: make deps - - run: make test - - run: make dialyzer - if: ${{ matrix.otp == '24.0' }} - - run: make codecov - if: ${{ matrix.otp == '24.0' }} - - run: make gcov - if: ${{ matrix.otp == '24.0' }} - - run: pip install --user codecov - if: ${{ matrix.otp == '24.0' }} - - run: /home/runner/.local/bin/codecov - if: ${{ matrix.otp == '24.0' }} + otp-version: ${{matrix.otp}} + rebar3-version: ${{matrix.rebar3}} + - name: Restore _build + uses: actions/cache@v3 + with: + path: _build + key: _build-cache-for-os-${{matrix.os}}-otp-${{matrix.otp}}-rebar3-${{matrix.rebar3}}-hash-${{hashFiles('rebar.lock')}} + - name: Restore rebar3's cache + uses: actions/cache@v3 + with: + path: ~/.cache/rebar3 + key: rebar3-cache-for-os-${{matrix.os}}-otp-${{matrix.otp}}-rebar3-${{matrix.rebar3}}-hash-${{hashFiles('rebar.lock')}} + + - run: rebar3 as test get-deps + - run: rebar3 as test compile + - run: rebar3 as test ct + + - run: rebar3 dialyzer + if: ${{ matrix.otp == '26.1' && matrix.os == 'ubuntu-22.04' }} + + - name: Run coverage + if: ${{ matrix.otp == '26.1' && matrix.os == 'ubuntu-22.04' }} + run: | + rebar3 as test codecov analyze + gcov -o c_src fast_pbkdf2 + - name: Upload coverage + if: ${{ matrix.otp == '26.1' && matrix.os == 'ubuntu-22.04' }} + run: | + pip install --user codecov + /home/runner/.local/bin/codecov From 59bdcea9de70e87524b5922ee5d2261d842345e6 Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Mon, 20 Nov 2023 14:18:42 +0100 Subject: [PATCH 7/8] Remove extra includes from compile flags --- rebar.config | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rebar.config b/rebar.config index 7644415..518bd1d 100644 --- a/rebar.config +++ b/rebar.config @@ -15,8 +15,8 @@ {rebar3_codecov, "0.6.0"}]}, {port_env, [ - {"CFLAGS", "$CFLAGS -std=c99 -O0 -g -Wall -Wextra -fPIC -I/opt/homebrew/include -I/usr/local/include --coverage"}, - {"LDLIBS", "$LDLIBS -lcrypto -L/opt/homebrew/lib/ -L/usr/local/lib --coverage"} + {"CFLAGS", "$CFLAGS -std=c99 -O0 -g -Wall -Wextra -fPIC --coverage"}, + {"LDLIBS", "$LDLIBS -lcrypto --coverage"} ] } ]} @@ -28,9 +28,9 @@ {port_env, [ {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)", - "CFLAGS", "$CFLAGS -std=c99 -O3 -g -Wall -Wextra -fPIC -I/opt/homebrew/include -I/usr/local/include"}, + "CFLAGS", "$CFLAGS -std=c99 -O3 -g -Wall -Wextra -fPIC"}, {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)", - "LDLIBS", "$LDLIBS -lcrypto -L/opt/homebrew/lib/ -L/usr/local/lib"}, + "LDLIBS", "$LDLIBS -lcrypto"}, {"win32", "CFLAGS", "$CFLAGS /O2 /DNDEBUG /Wall"}, {"win32", "LDLIBS", "$LDLIBS libcrypto.lib"}, {"DRV_LINK_TEMPLATE", "$DRV_LINK_TEMPLATE $LDLIBS"} From d916ff11e721145447bb0da10de3bf0f321cd80f Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Mon, 20 Nov 2023 14:20:41 +0100 Subject: [PATCH 8/8] Enable testing in windows Co-authored-by: Ronny Berndt --- .github/workflows/ci.yml | 18 +++++++++++++++--- rebar.config | 10 ++++++---- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b5264b..5c23cf4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,10 @@ jobs: os: ['ubuntu-22.04'] otp: ['26.1', '25.3', '24.3'] rebar3: ['3.22.1'] + include: + - otp: '26.1' + rebar3: '3.22.1' + os: 'windows-2022' runs-on: ${{matrix.os}} steps: - uses: actions/checkout@v3 @@ -22,6 +26,17 @@ jobs: with: otp-version: ${{matrix.otp}} rebar3-version: ${{matrix.rebar3}} + + - name: Windows - Enable Developer Command Prompt + uses: ilammy/msvc-dev-cmd@v1.12.1 + if: ${{ matrix.os == 'windows-2022' }} + - name: Windows - Install openssl + shell: pwsh + run: | + choco install openssl + echo "OPENSSL_INSTALL_DIR=""C:\Program Files\OpenSSL""" >> $env:GITHUB_ENV + if: ${{ matrix.os == 'windows-2022' }} + - name: Restore _build uses: actions/cache@v3 with: @@ -32,14 +47,11 @@ jobs: with: path: ~/.cache/rebar3 key: rebar3-cache-for-os-${{matrix.os}}-otp-${{matrix.otp}}-rebar3-${{matrix.rebar3}}-hash-${{hashFiles('rebar.lock')}} - - run: rebar3 as test get-deps - run: rebar3 as test compile - run: rebar3 as test ct - - run: rebar3 dialyzer if: ${{ matrix.otp == '26.1' && matrix.os == 'ubuntu-22.04' }} - - name: Run coverage if: ${{ matrix.otp == '26.1' && matrix.os == 'ubuntu-22.04' }} run: | diff --git a/rebar.config b/rebar.config index 518bd1d..c13fb26 100644 --- a/rebar.config +++ b/rebar.config @@ -15,8 +15,10 @@ {rebar3_codecov, "0.6.0"}]}, {port_env, [ - {"CFLAGS", "$CFLAGS -std=c99 -O0 -g -Wall -Wextra -fPIC --coverage"}, - {"LDLIBS", "$LDLIBS -lcrypto --coverage"} + {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)", + "$CFLAGS -std=c99 -O0 -g -Wall -Wextra -fPIC --coverage"}, + {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)", + "$LDLIBS -lcrypto --coverage"} ] } ]} @@ -31,8 +33,8 @@ "CFLAGS", "$CFLAGS -std=c99 -O3 -g -Wall -Wextra -fPIC"}, {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)", "LDLIBS", "$LDLIBS -lcrypto"}, - {"win32", "CFLAGS", "$CFLAGS /O2 /DNDEBUG /Wall"}, - {"win32", "LDLIBS", "$LDLIBS libcrypto.lib"}, + {"win32", "CFLAGS", "$CFLAGS /I${OPENSSL_INSTALL_DIR}/include /O2 /DNDEBUG /Wall"}, + {"win32", "LDLIBS", "$LDLIBS /LIBPATH:${OPENSSL_INSTALL_DIR}/lib libcrypto.lib"}, {"DRV_LINK_TEMPLATE", "$DRV_LINK_TEMPLATE $LDLIBS"} ] }.