Skip to content

Commit

Permalink
Merge pull request #16 from esl/upgrade_ci
Browse files Browse the repository at this point in the history
Upgrade CI
  • Loading branch information
chrzaszcz authored Oct 4, 2024
2 parents e7341dc + fa7d09e commit a89fc20
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 26 deletions.
42 changes: 24 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,25 @@ jobs:
name: OTP ${{matrix.otp}} / rebar3 ${{matrix.rebar3}} / OS ${{matrix.os}}
strategy:
matrix:
os: ['ubuntu-22.04']
otp: ['26.1', '25.3', '24.3']
rebar3: ['3.22.1']
os: ['ubuntu-24.04']
otp: ['27', '26', '25']
rebar3: ['3.24.0']
include:
- otp: '26.1'
- otp: '23'
rebar3: '3.20.0'
os: 'ubuntu-20.04'
- otp: '24'
rebar3: '3.22.1'
os: 'ubuntu-22.04'
- otp: '27'
rebar3: '3.24.0'
os: 'windows-2022'
- otp: '26.1'
rebar3: '3.22.1'
- otp: '27'
rebar3: '3.24.0'
os: 'macos-latest'
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# OS setups
- name: Ubuntu/Windows – Prepare Erlang
Expand Down Expand Up @@ -56,12 +62,12 @@ jobs:

# caches
- name: Restore _build
uses: actions/cache@v3
uses: actions/cache@v4
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
uses: actions/cache@v4
with:
path: ~/.cache/rebar3
key: rebar3-cache-for-os-${{matrix.os}}-otp-${{matrix.otp}}-rebar3-${{matrix.rebar3}}-hash-${{hashFiles('rebar.lock')}}
Expand All @@ -71,27 +77,27 @@ jobs:
- run: rebar3 as test compile
- run: rebar3 as test ct
- run: rebar3 dialyzer
if: ${{ matrix.otp == '26.1' && matrix.os == 'ubuntu-22.04' }}
if: ${{ matrix.otp == '27' && matrix.os == 'ubuntu-24.04' }}
- name: Run coverage
if: ${{ matrix.otp == '26.1' && matrix.os == 'ubuntu-22.04' }}
if: ${{ matrix.otp == '27' && matrix.os == 'ubuntu-24.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
- name: Upload coverage reports to Codecov
if: ${{ matrix.otp == '27' && matrix.os == 'ubuntu-24.04' }}
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

test-on-s390x:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup emulator
run: |
sudo docker run --rm --privileged tonistiigi/binfmt:qemu-v6.2.0
- name: Run build
uses: uraimo/run-on-arch-action@v2.6.0
uses: uraimo/run-on-arch-action@v2.7.2
with:
arch: s390x
distro: ubuntu22.04
Expand Down
7 changes: 3 additions & 4 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
{base16, "2.0.1"},
{proper, "1.4.0"}
]},
{cover_enabled, true},
{cover_export_enabled, true},
{plugins, [
{rebar3_codecov, "0.6.0"}]},
{rebar3_codecov, "0.7.0"}]},
{port_env,
[
{"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)",
Expand Down Expand Up @@ -60,9 +62,6 @@
]}
]}.

{cover_enabled, true}.
{cover_export_enabled, true}.

{project_plugins, [
rebar3_hex,
rebar3_ex_doc
Expand Down
6 changes: 2 additions & 4 deletions src/fast_pbkdf2.erl
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@
-export([pbkdf2/4, pbkdf2/5]).

%%% @doc
%%% This function calculates the pbkdf2 algorithm where dkLen is simply assumed to be that of the
%%% underlying hash function, a sane default.
%%% @end
%%% This function calculates the pbkdf2 algorithm where dkLen is simply assumed to be that
%%% of the underlying hash function, a sane default.
-spec pbkdf2(sha_type(), binary(), binary(), non_neg_integer()) -> binary().
pbkdf2(Hash, Password, Salt, IterationCount) ->
pbkdf2_block(Hash, Password, Salt, IterationCount, 1).

%%% @doc
%%% This function allows to customise the desired dkLen parameter for pbkdf2.
%%% @end
-spec pbkdf2(sha_type(), binary(), binary(), non_neg_integer(), non_neg_integer()) -> binary().
pbkdf2(Hash, Password, Salt, IterationCount, DkLen) ->
pbkdf2(Hash, Password, Salt, IterationCount, DkLen, 1, [], 0).
Expand Down

0 comments on commit a89fc20

Please sign in to comment.