From d844bd9a656b0d661513bd4b1d38cfdf42ede4e8 Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Wed, 22 Nov 2023 10:32:40 +0100 Subject: [PATCH] Ensure support for macos --- .github/workflows/ci.yml | 24 ++++++++++++++++++++++-- rebar.config | 8 ++++---- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5c23cf4..5392c80 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,14 +19,20 @@ jobs: - otp: '26.1' rebar3: '3.22.1' os: 'windows-2022' + - otp: '26.1' + rebar3: '3.22.1' + os: 'macos-latest' runs-on: ${{matrix.os}} steps: - uses: actions/checkout@v3 - - uses: erlef/setup-beam@v1 + + # OS setups + - name: Ubuntu/Windows – Prepare Erlang + uses: erlef/setup-beam@v1 with: otp-version: ${{matrix.otp}} rebar3-version: ${{matrix.rebar3}} - + if: ${{ matrix.os != 'macos-latest' }} - name: Windows - Enable Developer Command Prompt uses: ilammy/msvc-dev-cmd@v1.12.1 if: ${{ matrix.os == 'windows-2022' }} @@ -36,7 +42,19 @@ jobs: choco install openssl echo "OPENSSL_INSTALL_DIR=""C:\Program Files\OpenSSL""" >> $env:GITHUB_ENV if: ${{ matrix.os == 'windows-2022' }} + - name: MacOS – Prepare Brew + run: | + brew --version + brew cleanup --prune=all -s + brew autoremove + brew untap homebrew/cask homebrew/core + brew update + if: ${{ matrix.os == 'macos-latest' }} + - name: MacOS - Prepare Erlang + run: brew install erlang rebar3 + if: ${{ matrix.os == 'macos-latest' }} + # caches - name: Restore _build uses: actions/cache@v3 with: @@ -47,6 +65,8 @@ jobs: with: path: ~/.cache/rebar3 key: rebar3-cache-for-os-${{matrix.os}}-otp-${{matrix.otp}}-rebar3-${{matrix.rebar3}}-hash-${{hashFiles('rebar.lock')}} + + # tests - run: rebar3 as test get-deps - run: rebar3 as test compile - run: rebar3 as test ct diff --git a/rebar.config b/rebar.config index 4a91f0f..391bcba 100644 --- a/rebar.config +++ b/rebar.config @@ -16,9 +16,9 @@ {port_env, [ {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)", - "$CFLAGS -std=c99 -O0 -g -Wall -Wextra -fPIC --coverage"}, + "CFLAGS", "$CFLAGS -std=c99 -O0 -g -Wall -Wextra -fPIC -I/opt/homebrew/include -I/usr/local/include --coverage"}, {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)", - "$LDLIBS -lcrypto --coverage"} + "LDLIBS", "$LDLIBS -lcrypto -L/opt/homebrew/lib/ -L/usr/local/lib --coverage"} ] } ]} @@ -30,9 +30,9 @@ {port_env, [ {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)", - "CFLAGS", "$CFLAGS -std=c99 -O3 -g -Wall -Wextra -fPIC"}, + "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"}, + "LDLIBS", "$LDLIBS -lcrypto -L/opt/homebrew/lib/ -L/usr/local/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"}