Skip to content

Commit

Permalink
Some maintenance updates (#62)
Browse files Browse the repository at this point in the history
* Move test-specific rebar.config options to the test profile

* Trim .gitignore to bare requirements for a rebar3 project

* Update some CI versions

* Tweak dialyzer options

* underspecs allows for stricts typespecs, which is good
* no_return prevents a class of warnings we might want to be aware of

* Analyse it with XRef

* markdownlint it!

* YAMLlint it!

* Prefer ex_doc to EDoc

Also adds a much-deserved badge to README.md

* Analyse further

We also add `no_unknown` to Dialyzer (because `unknown` is
default in OTP 26), so we can fix errors locally without having to
wait for CI (if locally you're using OTP 25, and CI fails in OTP 26,
that is)

* Fix as per CI: Warning: ... is undefined function (Xref)
  • Loading branch information
paulo-ferraz-oliveira authored Aug 21, 2023
1 parent edf814f commit 6023c2c
Show file tree
Hide file tree
Showing 18 changed files with 161 additions and 105 deletions.
12 changes: 8 additions & 4 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,26 @@ about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

## Bug Description

A clear and concise description of what the bug is.

## To Reproduce

Steps to reproduce the behavior

## Expected Behavior

A clear and concise description of what you expected to happen.

## `rebar3` Logs

If applicable, run `rebar3` with `DIAGNOSTIC=1` and attach all the logs to your report.

## Additional Context
- OS: [e.g. MacOS]
- Erlang version
- rebar3 version

- OS: [e.g. MacOS]
- Erlang version
- rebar3 version
7 changes: 5 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@ about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

## Is your feature request related to a problem? Please describe.
## Is your feature request related to a problem? Please describe

A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

## Describe the solution you'd like

A clear and concise description of what you want to happen.

## Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

## Additional Context

Add any other context or screenshots about the feature request here.
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/other-issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ about: Something that's not covered by the other categories
title: ''
labels: ''
assignees: ''

---

<!-- Please consider opening a discussion if this is not really an issue -->
61 changes: 35 additions & 26 deletions .github/workflows/erlang.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
name: Erlang CI

on: [push, pull_request]
"on": [push, pull_request]

env:
ERL_FLAGS: "-enable-feature all"
Expand All @@ -9,33 +10,41 @@ jobs:

build:

runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

strategy:
matrix:
otp: ['25.2.1']
rebar: ['3.20.0']
otp: ["25", "26"]
rebar: ["3.22"]

steps:
- uses: actions/checkout@v2
- uses: erlef/setup-beam@v1
id: setup-beam
with:
otp-version: ${{matrix.otp}}
rebar3-version: ${{matrix.rebar}}
- name: Restore _build
uses: actions/cache@v2
with:
path: _build
key: _build-cache-for-os-${{runner.os}}-otp-${{steps.setup-beam.outputs.otp-version}}-rebar3-${{steps.setup-beam.outputs.rebar3-version}}-hash-${{hashFiles('rebar.lock')}}
- name: Restore rebar3's cache
uses: actions/cache@v2
with:
path: ~/.cache/rebar3
key: rebar3-cache-for-os-${{runner.os}}-otp-${{steps.setup-beam.outputs.otp-version}}-rebar3-${{steps.setup-beam.outputs.rebar3-version}}-hash-${{hashFiles('rebar.lock')}}
- name: Compile
run: rebar3 compile
- name: Format check
run: rebar3 format --verify
- name: Run tests and verifications
run: rebar3 test
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
id: setup-beam
with:
otp-version: ${{matrix.otp}}
rebar3-version: ${{matrix.rebar}}
- name: Restore _build
uses: actions/cache@v3
with:
path: _build
key: "_build-cache-for
-os-${{runner.os}}
-otp-${{steps.setup-beam.outputs.otp-version}}
-rebar3-${{steps.setup-beam.outputs.rebar3-version}}
-hash-${{hashFiles('rebar.lock')}}"
- name: Restore rebar3's cache
uses: actions/cache@v3
with:
path: ~/.cache/rebar3
key: "rebar3-cache-for
-os-${{runner.os}}
-otp-${{steps.setup-beam.outputs.otp-version}}
-rebar3-${{steps.setup-beam.outputs.rebar3-version}}
-hash-${{hashFiles('rebar.lock')}}"
- name: Compile
run: rebar3 compile
- name: Format check
run: rebar3 format --verify
- name: Run tests and verifications
run: rebar3 as test test
30 changes: 30 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: Lint

"on": [push, pull_request]

jobs:
lint:
name: Lint

runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3

# uses .markdownlint.yml for configuration
- name: markdownlint
uses: DavidAnson/markdownlint-cli2-action@v11
with:
globs: |
.github/**/*.md
*.md
- name: yamllint
uses: ibiqlik/action-yamllint@v3
with:
file_or_dir: |
.github/**/*.yml
.*.yml
strict: true
config_file: .yamllint.yml
13 changes: 0 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
rebar3.crashdump
.rebar3
_*
.eunit
*.o
*.beam
*.plt
erl_crash.dump
.concrete/DEV_MODE

.rebar
rel/
ebin/

_build
_checkouts
doc/
rebar3
4 changes: 4 additions & 0 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
default: true
MD013:
line_length: 100
5 changes: 5 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
extends: default
rules:
line-length:
max: 100
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# Changelog

See the [Releases](../../releases) page.
8 changes: 4 additions & 4 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [email protected]. All
reported by contacting the project team at <[email protected]>. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Expand All @@ -67,10 +67,10 @@ members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 1.4, available at <https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
<https://www.contributor-covenant.org/faq>
34 changes: 18 additions & 16 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ helps, and credit will always be given.

You can contribute in many ways:

Types of Contributions
----------------------
## Types of Contributions

### Report Bugs

Report bugs at https://github.com/AdRoll/rebar3_depup/issues.
Report bugs at <https://github.com/AdRoll/rebar3_depup/issues>.

If you are reporting a bug, please include:

* Your operating system name and version.
* Any details about your local setup that might be helpful in troubleshooting (OTP version, rebar3 version, sample code, etc).
* Any details about your local setup that might be helpful in troubleshooting
(OTP version, rebar3 version, sample code, etc).
* Detailed steps to reproduce the bug.

### Fix Bugs
Expand All @@ -36,17 +36,18 @@ articles, and such.

### Submit Feedback

The best way to send feedback is to file an issue at https://github.com/AdRoll/rebar3_depup/issues.
The best way to send feedback is to file an issue at <https://github.com/AdRoll/rebar3_depup/issues>.

If you are proposing a feature:

* Explain in detail how it would work.
* Keep the scope as narrow as possible, to make it easier to implement.
* Remember that this is a volunteer-driven project, and that contributions are welcome :)

Get Started!
------------
* Remember that this is a volunteer-driven project, and that contributions are
welcome :)

<!-- markdownlint-disable MD026 # Trailing punctuation in heading -->
## Get Started!
<!-- markdownlint-enable MD026 -->
Ready to contribute? Here's how to set up `rebar3_depup` for local development.

1. Fork the `rebar3_depup` repo on GitHub.
Expand All @@ -55,7 +56,7 @@ Ready to contribute? Here's how to set up `rebar3_depup` for local development.

`$ git clone [email protected]:your_name_here/rebar3_depup.git`

3. Compile the project, assuming you rebar3 and OTP 21 installed, you can run:
3. Compile the project, assuming you rebar3 and OTP 24 installed, you can run:

`$ rebar3 compile`

Expand All @@ -65,20 +66,21 @@ Ready to contribute? Here's how to set up `rebar3_depup` for local development.

Now you can make your changes locally.

5. When you're done making changes, check that your changes pass the tests by running `rebar3 test`. You might have to run it twice, if the `dialyzer` step fails while building the PLT. It's a known annoyance, sorry about that.
5. When you're done making changes, check that your changes pass the tests
by running `rebar3 test`. You might have to run it twice, if the `dialyzer`
step fails while building the PLT. It's a known annoyance, sorry about that.

6. Commit your changes and push your branch to GitHub:

```bash
$ git add .
$ git commit -m "Your detailed description of your changes."
$ git push origin name-of-your-bugfix-or-feature
git add .
git commit -m "Your detailed description of your changes."
git push origin name-of-your-bugfix-or-feature
```

7. Submit a pull request through the GitHub website.

Pull Request Guidelines
-----------------------
## Pull Request Guidelines

Before you submit a pull request, check that it meets these guidelines:

Expand Down
26 changes: 17 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# rebar3_depup
# rebar3_depup [![Erlang CI](https://github.com/AdRoll/rebar3_depup/actions/workflows/erlang.yml/badge.svg)](https://github.com/AdRoll/rebar3_depup/actions/workflows/erlang.yml)

## Dependency updater for rebar3 managed projects

![Cinderella Upgrade](https://media1.tenor.com/images/5d0c66a25a24f1c89936b90ea54ac41a/tenor.gif?itemid=13582416)
Expand All @@ -16,14 +17,17 @@ You can add it to your _global `rebar.config`_ (e.g. `~/.config/rebar3/rebar.con
Then...

```bash
$ rebar3 update-deps
rebar3 update-deps
```

### ⚠️ Warning ⚠️

With the default options (see below), this project assumes that…

1. You have `rebar.config` file in your root folder
1. You do not use a `rebar.config.script`
1. The current OS user has access to the git repos that you have in your `rebar.config` file.
1. The current OS user has access to the git repos that you have in
your `rebar.config` file.

### Command-Line Options

Expand Down Expand Up @@ -58,22 +62,26 @@ Usage: rebar3 update-deps [-r [<replace>]] [-c [<rebar_config>]]
## Configuration
To automatically ignore updates for one or more deps, add the `ignore` configuration to your `rebar.config`:
To automatically ignore updates for one or more deps, add the `ignore`
configuration to your `rebar.config`:
```erlang
%% Ignore any updates for eredis and lager.
{depup, [{ignore, [eredis, lager]}]}.
```
To only update if the specified SemVer component has changed, use `only`. Note that this configuration can
To only update if the specified SemVer component has changed, use `only`.
Note that this configuration can
be overridden by the `-o/--only` command-line argument:
```erlang
%% Ignore any updates that change more than the minor (and patch) version of any dependency.
%% Ignore any updates that change more than the minor
%% (and patch) version of any dependency.
{depup, [{only, minor}].
```
With the above configuration in your `rebar.config`, running the following will update all dependencies by overriding `minor` with `none`:
With the above configuration in your `rebar.config`, running the following will
update all dependencies by overriding `minor` with `none`:
```bash
rebar3 update-deps --only none
Expand All @@ -82,11 +90,11 @@ rebar3 update-deps --only none
## Build
```bash
$ rebar3 compile
rebar3 compile
```
## Test
```bash
$ rebar3 test
rebar3 test
```
8 changes: 0 additions & 8 deletions priv/overview.edoc

This file was deleted.

Loading

0 comments on commit 6023c2c

Please sign in to comment.