Skip to content

Commit

Permalink
Freshen up
Browse files Browse the repository at this point in the history
  • Loading branch information
g-andrade committed Mar 16, 2024
1 parent 5c6856d commit fb23952
Show file tree
Hide file tree
Showing 82 changed files with 27,457 additions and 25,514 deletions.
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
reviewers:
- "g-andrade"
schedule:
interval: "monthly"
80 changes: 80 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
name: CI
on:
push:
branches:
- master
- develop
pull_request:
branches:
- master
- develop
workflow_dispatch:
jobs:
ci:
name: Run CI with Erlang/OTP ${{matrix.otp_vsn}}
runs-on: ${{matrix.os}}
strategy:
matrix:
otp_vsn: [
'19.3',
'20.3',
'21.3',
'22.3',
'23.3',
'24.3',
'25.3',
'26.2'
]
os: ['ubuntu-20.04']
steps:
- name: Checkout
uses: actions/checkout@v4

- id: otp-version-to-rebar3-version
name: "Read #{OTP version => rebar3 version} map"
uses: juliangruber/read-file-action@v1
with:
path: ./.github/workflows/otp_version_to_rebar3_version.json

- id: setup-beam
name: Setup BEAM
uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.otp_vsn}}
# rebar3-version: https://stackoverflow.com/a/64405821
rebar3-version: |
${{ fromJson(steps.otp-version-to-rebar3-version.outputs.content)[matrix.otp_vsn] }}
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Set dynamic env (1)
run: |
echo "prev_github_run_number=$((${{github.run_number}} - 1))" >> "$GITHUB_ENV"
echo "build_cache_prefix=_build-cache-for-os-${{runner.os}}-otp-${{matrix.otp_vsn}}-rebar3-${{steps.setup-beam.outputs.rebar3-version}}" >> "$GITHUB_ENV"
- name: Set dynamic env (2)
run: |
echo "build_cache_prefix_with_hash=${{env.build_cache_prefix}}-hash-${{hashFiles('rebar.lock')}}" >> "$GITHUB_ENV"
- name: Restore cached build artifacts
uses: actions/cache/restore@v4
with:
path: _build
key: ${{env.build_cache_prefix_with_hash}}-${{env.prev_github_run_number}}
restore-keys: |-
${{env.build_cache_prefix_with_hash}}-
${{env.build_cache_prefix}}-
- name: Run Tests
run: make test

- name: Run Checks
run: make check

- name: Save build artifacts to cache
if: always()
uses: actions/cache/save@v4
with:
path: _build
key: ${{env.build_cache_prefix_with_hash}}-${{github.run_number}}
11 changes: 11 additions & 0 deletions .github/workflows/otp_version_to_rebar3_version.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"19.3": "3.15",
"20.3": "3.15",
"21.3": "3.15",
"22.3": "3.18",
"22.3": "3.18",
"23.3": "3.19",
"24.3": "3.22",
"25.3": "3.22",
"26.2": "3.22"
}
19 changes: 13 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
.rebar3
_*
.eunit
deps
*.o
*.beam
*.plt
erl_crash.dump
*.swp
*.swo
.erlang.cookie
ebin
rel/example_project
.concrete/DEV_MODE
deps
log
erl_crash.dump
.rebar
logs
_build
*.crashdump
*.swp
.idea
*.iml
rebar3.crashdump
/doc/
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

2 changes: 0 additions & 2 deletions .vimrc

This file was deleted.

51 changes: 51 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Changed

- CI from Travis to GitHub Actions

## [1.1.0] - 2020-05-26

### Added

- OTP 22.0 to CI
- OTP 22.1 to CI
- OTP 22.2 to CI
- OTP 22.3 to CI
- OTP 23.0 to CI

### Removed

- OTP 17 from CI
- OTP 18 from CI

## [1.0.3] - 2019-01-19

### Added

- Travis CI

## [1.0.2] - 2017-04-30

### Added

- inference of app version from git

## [1.0.1] - 2017-04-30

### Fixed

- unwarranted import of `rebar3_hex` by lib dependents

## [1.0.0] - 2017-04-30

### Added

- initial implementation
166 changes: 86 additions & 80 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,85 +1,91 @@
REBAR3_URL=https://s3.amazonaws.com/rebar3/rebar3
export ERL_FLAGS = -enable-feature maybe_expr # needed for katana-code under OTP 25

ifeq ($(wildcard rebar3),rebar3)
REBAR3 = $(CURDIR)/rebar3
endif
.PHONY: all build clean check
.PHONY: xref hank-dead-code-cleaner elvis-linter dialyzer
.PHONY: test cover
.PHONY: shell console doc-dry publish

ifdef RUNNING_ON_CI
REBAR3 = ./rebar3
else
REBAR3 ?= $(shell test -e `which rebar3` 2>/dev/null && which rebar3 || echo "./rebar3")
endif

ifeq ($(REBAR3),)
REBAR3 = $(CURDIR)/rebar3
endif

.PHONY: deps build test check dialyzer xref test_code test_cases test_cases_clean publish

.NOTPARALLEL: check
.NOTPARALLEL: check cover test

all: build

build: $(REBAR3)
@$(REBAR3) compile

$(REBAR3):
wget $(REBAR3_URL) || curl -Lo rebar3 $(REBAR3_URL)
@chmod a+x rebar3

clean: $(REBAR3)
@$(REBAR3) clean

check: dialyzer xref

dialyzer: $(REBAR3)
@$(REBAR3) dialyzer

xref: $(REBAR3)
@$(REBAR3) xref

doc: build
./scripts/hackish_inject_version_in_docs.sh
./scripts/hackish_make_docs.sh

test: $(REBAR3)
@$(REBAR3) eunit

test_code:
./test_cases/generate_code.py test_cases/test_data/*.data test/erlzord_test.erl

test_data: clean_test_data
./test_cases/generate_data.py 1 0 7 >test_cases/test_data/1dim_from_0_to_7.data
./test_cases/generate_data.py 2 0 7 >test_cases/test_data/2dim_from_0_to_7.data
./test_cases/generate_data.py 3 0 7 >test_cases/test_data/3dim_from_0_to_7.data
./test_cases/generate_data.py 4 0 7 >test_cases/test_data/4dim_from_0_to_7.data
./test_cases/generate_data.py 5 0 7 >test_cases/test_data/5dim_from_0_to_7.data
./test_cases/generate_data.py 10 0 7 >test_cases/test_data/10dim_from_0_to_7.data
./test_cases/generate_data.py 30 0 7 >test_cases/test_data/30dim_from_0_to_7.data
./test_cases/generate_data.py 1 0 100 >test_cases/test_data/1dim_from_0_to_100.data
./test_cases/generate_data.py 2 0 100 >test_cases/test_data/2dim_from_0_to_100.data
./test_cases/generate_data.py 3 0 100 >test_cases/test_data/3dim_from_0_to_100.data
./test_cases/generate_data.py 4 0 100 >test_cases/test_data/4dim_from_0_to_100.data
./test_cases/generate_data.py 5 0 100 >test_cases/test_data/5dim_from_0_to_100.data
./test_cases/generate_data.py 10 0 100 >test_cases/test_data/10dim_from_0_to_100.data
./test_cases/generate_data.py 30 0 100 >test_cases/test_data/30dim_from_0_to_100.data
./test_cases/generate_data.py 1 0 123456789 >test_cases/test_data/1dim_from_0_to_123456789.data
./test_cases/generate_data.py 2 0 123456789 >test_cases/test_data/2dim_from_0_to_123456789.data
./test_cases/generate_data.py 3 0 123456789 >test_cases/test_data/3dim_from_0_to_123456789.data
./test_cases/generate_data.py 4 0 123456789 >test_cases/test_data/4dim_from_0_to_123456789.data
./test_cases/generate_data.py 5 0 123456789 >test_cases/test_data/5dim_from_0_to_123456789.data
./test_cases/generate_data.py 10 0 123456789 >test_cases/test_data/10dim_from_0_to_123456789.data
./test_cases/generate_data.py 30 0 123456789 >test_cases/test_data/30dim_from_0_to_123456789.data
./test_cases/generate_data.py 1 -123456789 54321 >test_cases/test_data/1dim_from_-123456789_to_54321.data
./test_cases/generate_data.py 2 -123456789 54321 >test_cases/test_data/2dim_from_-123456789_to_54321.data
./test_cases/generate_data.py 3 -123456789 54321 >test_cases/test_data/3dim_from_-123456789_to_54321.data
./test_cases/generate_data.py 4 -123456789 54321 >test_cases/test_data/4dim_from_-123456789_to_54321.data
./test_cases/generate_data.py 5 -123456789 54321 >test_cases/test_data/5dim_from_-123456789_to_54321.data
./test_cases/generate_data.py 10 -123456789 54321 >test_cases/test_data/10dim_from_-123456789_to_54321.data
./test_cases/generate_data.py 30 -123456789 54321 >test_cases/test_data/30dim_from_-123456789_to_54321.data

clean_test_data:
rm test_cases/test_data/*.data

publish: $(REBAR3)
@$(REBAR3) as publish hex publish
build:
@rebar3 compile

clean:
@rebar3 clean

check: xref hank-dead-code-cleaner elvis-linter dialyzer

xref:
@rebar3 xref

hank-dead-code-cleaner:
@if rebar3 plugins list | grep '^rebar3_hank\>' >/dev/null; then \
rebar3 hank; \
else \
echo >&2 "WARN: skipping rebar3_hank check"; \
fi

elvis-linter:
@if rebar3 plugins list | grep '^rebar3_lint\>' >/dev/null; then \
rebar3 lint; \
else \
echo >&2 "WARN: skipping rebar3_lint check"; \
fi

dialyzer:
@rebar3 dialyzer

test: test/erlzord_tests.erl
@rebar3 do eunit, ct, cover

cover: test

test/erlzord_tests.erl:
./support/test_cases/generate_code.py support/test_cases/test_data/*.data test/erlzord_tests.erl

test-data: clean-test-data
./support/test_cases/generate_data.py 1 0 7 >support/test_cases/test_data/1dim_from_0_to_7.data
./support/test_cases/generate_data.py 2 0 7 >support/test_cases/test_data/2dim_from_0_to_7.data
./support/test_cases/generate_data.py 3 0 7 >support/test_cases/test_data/3dim_from_0_to_7.data
./support/test_cases/generate_data.py 4 0 7 >support/test_cases/test_data/4dim_from_0_to_7.data
./support/test_cases/generate_data.py 5 0 7 >support/test_cases/test_data/5dim_from_0_to_7.data
./support/test_cases/generate_data.py 10 0 7 >support/test_cases/test_data/10dim_from_0_to_7.data
./support/test_cases/generate_data.py 30 0 7 >support/test_cases/test_data/30dim_from_0_to_7.data
./support/test_cases/generate_data.py 1 0 100 >support/test_cases/test_data/1dim_from_0_to_100.data
./support/test_cases/generate_data.py 2 0 100 >support/test_cases/test_data/2dim_from_0_to_100.data
./support/test_cases/generate_data.py 3 0 100 >support/test_cases/test_data/3dim_from_0_to_100.data
./support/test_cases/generate_data.py 4 0 100 >support/test_cases/test_data/4dim_from_0_to_100.data
./support/test_cases/generate_data.py 5 0 100 >support/test_cases/test_data/5dim_from_0_to_100.data
./support/test_cases/generate_data.py 10 0 100 >support/test_cases/test_data/10dim_from_0_to_100.data
./support/test_cases/generate_data.py 30 0 100 >support/test_cases/test_data/30dim_from_0_to_100.data
./support/test_cases/generate_data.py 1 0 123456789 >support/test_cases/test_data/1dim_from_0_to_123456789.data
./support/test_cases/generate_data.py 2 0 123456789 >support/test_cases/test_data/2dim_from_0_to_123456789.data
./support/test_cases/generate_data.py 3 0 123456789 >support/test_cases/test_data/3dim_from_0_to_123456789.data
./support/test_cases/generate_data.py 4 0 123456789 >support/test_cases/test_data/4dim_from_0_to_123456789.data
./support/test_cases/generate_data.py 5 0 123456789 >support/test_cases/test_data/5dim_from_0_to_123456789.data
./support/test_cases/generate_data.py 10 0 123456789 >support/test_cases/test_data/10dim_from_0_to_123456789.data
./support/test_cases/generate_data.py 30 0 123456789 >support/test_cases/test_data/30dim_from_0_to_123456789.data
./support/test_cases/generate_data.py 1 -123456789 54321 >support/test_cases/test_data/1dim_from_-123456789_to_54321.data
./support/test_cases/generate_data.py 2 -123456789 54321 >support/test_cases/test_data/2dim_from_-123456789_to_54321.data
./support/test_cases/generate_data.py 3 -123456789 54321 >support/test_cases/test_data/3dim_from_-123456789_to_54321.data
./support/test_cases/generate_data.py 4 -123456789 54321 >support/test_cases/test_data/4dim_from_-123456789_to_54321.data
./support/test_cases/generate_data.py 5 -123456789 54321 >support/test_cases/test_data/5dim_from_-123456789_to_54321.data
./support/test_cases/generate_data.py 10 -123456789 54321 >support/test_cases/test_data/10dim_from_-123456789_to_54321.data
./support/test_cases/generate_data.py 30 -123456789 54321 >support/test_cases/test_data/30dim_from_-123456789_to_54321.data

clean-test-data:
rm support/test_cases/test_data/*.data

shell: export ERL_FLAGS = +pc unicode
shell:
@rebar3 as shell shell

console: shell

doc-dry:
@rebar3 hex build

publish:
@rebar3 hex publish
Loading

0 comments on commit fb23952

Please sign in to comment.