From 2a6ccc3ac14755a3f76f60888453d3607115bd9f Mon Sep 17 00:00:00 2001 From: Nick Vatamaniuc Date: Mon, 9 May 2022 17:35:22 -0400 Subject: [PATCH] Simplify Makefile and update CI Remove `app` file and allow specifying a different REBAR executable so we can test both rebar2 and rebar3. Since OTP team provides docker images we can use those for CI. They seem to be a bit more recent than ESL packages and also provide `rebar` and `rebar3` commands. --- .github/workflows/ci.yml | 30 ++++++++++-------------------- Makefile | 26 +++++++++----------------- 2 files changed, 19 insertions(+), 37 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f04e5378..cfaab3df 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,34 +5,24 @@ on: pull_request: jobs: test: - name: test + name: test ${{matrix.otp_vsn}} on ${{matrix.os}} runs-on: ${{matrix.os}} + container: + image: erlang:${{matrix.otp_vsn}} strategy: fail-fast: false matrix: os: - ubuntu-latest otp: - - "24.3.3" - - "23.3.4.5" - - "22.3.4.9" - - "21.3.8.17" + - "24.3.4.0" + - "23.3.4.14" + - "22.3.4.26" + - "21.3.8.24" - "20.3.8.26" - include: - - os: ubuntu-18.04 - otp: "19.3.6.13" - - os: ubuntu-18.04 - otp: "18.3.4.11" + - "19.3.6.13" + - "18.3.4.11" steps: - uses: actions/checkout@v2.3.2 - - run: | - VERSION=${{matrix.otp}} - RELEASE=$(lsb_release -cs) - DIR=$(mktemp -d) - pushd $DIR - FILE=esl-erlang_$VERSION-1~ubuntu~$RELEASE\_amd64.deb - wget https://packages.erlang-solutions.com/erlang/debian/pool/$FILE - sudo dpkg -i $FILE - popd - rm -r $DIR - run: make test + - run: REBAR=rebar make test diff --git a/Makefile b/Makefile index 983c3046..e115e308 100644 --- a/Makefile +++ b/Makefile @@ -1,24 +1,16 @@ -PREFIX:=../ -DEST:=$(PREFIX)$(PROJECT) +REBAR?=rebar3 -REBAR=./rebar +.PHONY: all edoc test clean -.PHONY: all edoc test clean build_plt dialyzer app +build: + @$(REBAR) get-deps # rebar2 compatibility, it's no-op on rebar3 + @$(REBAR) compile -all: - @$(REBAR) prepare-deps - -edoc: all - @$(REBAR) doc - -test: - @rm -rf .eunit - @mkdir -p .eunit +test: build @$(REBAR) eunit +edoc: build + @$(REBAR) edoc + clean: @$(REBAR) clean - -app: - @[ -z "$(PROJECT)" ] && echo "ERROR: required variable PROJECT missing" 1>&2 && exit 1 || true - @$(REBAR) -r create template=mochiwebapp dest=$(DEST) appid=$(PROJECT)