diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 0ef8c69..320a65e 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,3 +1,5 @@ +--- + version: 2 updates: - package-ecosystem: "github-actions" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1b5c8d6..fc37752 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,9 +1,12 @@ +--- + name: CI on: pull_request: push: - branches: [ "main" ] + branches: + - main workflow_dispatch: concurrency: @@ -11,53 +14,47 @@ concurrency: cancel-in-progress: true jobs: - build: - name: Build + yamllint: runs-on: ubuntu-latest - strategy: - matrix: - otp_version: ['27.1', '26.2', '25.3'] - steps: - - uses: actions/checkout@v4 - - - uses: erlef/setup-beam@v1 - with: - otp-version: ${{ matrix.otp_version }} - version-type: 'strict' + - name: Checkout Code + uses: actions/checkout@v4 + - name: Run YAML Lint + uses: actionshub/yamllint@main - - uses: actions/cache@v4 + markdownlint-cli: + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + - name: Run markdownlint-cli + uses: nosborn/github-action-markdown-cli@v3.4.0 with: - path: | - ~/.cache/rebar3 - _build - key: ${{ runner.os }}-erlang-${{ matrix.otp_version }}-${{ hashFiles('**/*rebar.lock') }} - - - run: make build + files: . + config_file: ".markdownlint.yaml" test: - name: Test - runs-on: ubuntu-latest + name: OTP ${{matrix.otp}} strategy: matrix: - otp_version: ['27.1', '26.2', '25.3'] - - needs: - - build - + otp: ['27', '26', '25'] + rebar3: ['3.24'] + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: erlef/setup-beam@v1 with: - otp-version: ${{ matrix.otp_version }} - version-type: 'strict' - + otp-version: ${{ matrix.otp }} + rebar3-version: ${{matrix.rebar3}} - uses: actions/cache@v4 with: path: | ~/.cache/rebar3 _build - key: ${{ runner.os }}-erlang-${{ matrix.otp_version }}-${{ hashFiles('**/*rebar.lock') }} - + key: ${{ runner.os }}-erlang-${{ matrix.otp }}-rebar3-${{ matrix.rebar3 }}-hash-${{hashFiles('rebar.lock')}} + - run: make build - run: make test + # - name: Coveralls + # uses: coverallsapp/github-action@v2 + # with: + # file: _build/test/covertool/dns_erlang.covertool.xml diff --git a/.markdownlint.yaml b/.markdownlint.yaml new file mode 100644 index 0000000..5935c62 --- /dev/null +++ b/.markdownlint.yaml @@ -0,0 +1,13 @@ +--- +default: true + +# no-hard-tabs +MD010: + code_blocks: false + +# no-multiple-blanks +MD012: + maximum: 2 + +# line-length +MD013: false diff --git a/.tool-versions b/.tool-versions deleted file mode 100644 index 145b3cd..0000000 --- a/.tool-versions +++ /dev/null @@ -1 +0,0 @@ -erlang 27.1.3 diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..f383e9d --- /dev/null +++ b/.yamllint @@ -0,0 +1,9 @@ +--- +extends: default +rules: + line-length: + max: 256 + level: warning + truthy: + ignore: | + /.github/workflows/*.yml diff --git a/Makefile b/Makefile index b3bec85..fc9fe1c 100644 --- a/Makefile +++ b/Makefile @@ -1,29 +1,28 @@ -REBAR:=$(shell which rebar3 || echo ./rebar3) -REBAR_URL:="https://s3.amazonaws.com/rebar3/rebar3" - -all: deps compile - -$(REBAR): - wget $(REBAR_URL) && chmod +x rebar3 - -build: compile - -compile: $(REBAR) - @$(REBAR) compile - -deps: $(REBAR) - @$(REBAR) get-deps - -doc: $(REBAR) - @$(REBAR) doc skip_deps=true - -clean: $(REBAR) - @$(REBAR) clean - @rm -fr doc/* - -fresh: - rm -fr _build/* - -test: $(REBAR) all - @$(REBAR) dialyzer - @$(REBAR) eunit skip_deps=true +all: build + +.PHONY: build +build: + rebar3 compile + +.PHONY: doc +doc: + rebar3 edoc + +.PHONY: clean +clean: + rebar3 clean + @rm -rf doc + +.PHONY: fresh +fresh: clean + rm -rf _build + +.PHONY: test +test: all + rebar3 fmt --check + rebar3 eunit + rebar3 do cover, covertool generate + +.PHONY: format +format: build + rebar3 fmt diff --git a/README.md b/README.md index 5831888..e081be9 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ![CI](https://github.com/dnsimple/base32_erlang/actions/workflows/ci.yml/badge.svg) -``` +```erlang 1> X = <<"foobar">>. <<"foobar">> 2> X0 = base32:encode(X). diff --git a/rebar.config b/rebar.config index 8dd8506..44aeca2 100644 --- a/rebar.config +++ b/rebar.config @@ -1,19 +1,38 @@ % -*- mode: Erlang; -*- -{cover_enabled, true}. -{cover_print_enabled, true}. -{erl_opts, [warnings_as_errors]}. +{erl_opts, [ + warnings_as_errors +]}. {project_plugins, [ - erlfmt + {rebar3_hex, "~> 7.0"}, + {rebar3_ex_doc, "~> 0.2"}, + {erlfmt, "~> 1.6"}, + {covertool, "~> 2.0.7"} +]}. + +{profiles, [ + {test, [ + {erl_opts, [nowarn_export_all, nowarn_missing_spec, nowarn_missing_doc]}, + {eunit_opts, [verbose]}, + {covertool, [{coverdata_files, ["eunit.coverdata", "ct.coverdata"]}]}, + {cover_opts, [verbose, {min_coverage, 60}]}, + {cover_enabled, true}, + {cover_export_enabled, true} + ]} ]}. -{eunit_opts, [verbose]}. +{hex, [{doc, #{provider => ex_doc}}]}. + +{ex_doc, [ + {source_url, <<"https://github.com/dnsimple/base32_erlang">>}, + {main, <<"readme">>}, + {extras, [ + {'README.md', #{title => <<"Overview">>}}, + {'LICENSE', #{title => <<"License">>}} + ]} +]}. {erlfmt, [ write, {print_width, 140} ]}. - -{dialyzer, [ - {warnings, [no_unknown]} -]}.