Skip to content

Commit

Permalink
Merge pull request #26 from travelping/update/gh-action
Browse files Browse the repository at this point in the history
Update GH workflows and coding style
  • Loading branch information
RoadRunnr authored Apr 3, 2024
2 parents e6653f9 + 1cec860 commit 1b559c5
Show file tree
Hide file tree
Showing 8 changed files with 208 additions and 145 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/hex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ on:

jobs:
publish:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
container:
image: erlang:23.2.5.0-alpine
image: erlang:26-alpine
steps:
- name: Prepare
run: |
apk update
apk --no-cache upgrade
apk --no-cache add gcc git libc-dev libc-utils libgcc linux-headers make bash \
musl-dev musl-utils ncurses-dev pcre2 pkgconf scanelf wget zlib
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: work around for permission issue
run: |
git config --global --add safe.directory /__w/prometheus_diameter_collector/prometheus_diameter_collector
- name: Publish to Hex.pm
env:
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
run: |
rebar3 edoc
rebar3 ex_doc
rebar3 hex publish -r hexpm --yes
21 changes: 11 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ on:
jobs:
test:
name: CI
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
matrix:
otp: [22, 23, 24, 25]
otp: [22, 23, 24, 25, 26]
container:
image: erlang:${{ matrix.otp }}-alpine
steps:
- name: Prepare
run: |
apk update
apk --no-cache upgrade
apk --no-cache add gcc git libc-dev libc-utils libgcc linux-headers make bash \
apk --no-cache add gcc git libc-dev libc-utils libgcc linux-headers make bash xz \
musl-dev musl-utils ncurses-dev pcre2 pkgconf scanelf wget zlib
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: rebar3 compile
- name: Run tests
Expand All @@ -36,18 +36,19 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: ${{ matrix.otp }}
run: DEBUG=1 rebar3 as test coveralls send || /bin/true
- name: Tar Test Output
if: ${{ always() }}
run: tar -cJf ct-logs-${{ matrix.otp }}.tar.xz _build/test/logs/
- name: Archive Test Output
if: ${{ always() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test-output-${{ matrix.otp }}
path: |
_build/test/logs/
!_build/test/logs/last
path: ct-logs-${{ matrix.otp }}.tar.xz

slack:
needs: test
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
if: always()
steps:
- name: Slack notification
Expand All @@ -65,7 +66,7 @@ jobs:

finish:
needs: test
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
if: always()
steps:
- name: Coveralls Finished
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/review.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Review

on:
pull_request_target:
types:
- opened
- synchronize
branches:
- master

jobs:
code-style-review:
runs-on: ubuntu-22.04
env:
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
-
name: work around permission issue
run: |
git config --global --add safe.directory /__w/prometheus_diameter_collector/prometheus_diameter_collector
-
name: Check out repository
uses: actions/checkout@v4
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
-
name: install dependencies
run: |
sudo apt update
sudo apt install rebar3 emacs erlang-mode
-
name: format
run: rebar3 fmt
-
name: automated review
uses: googleapis/code-suggester@v4
with:
command: review
pull_number: ${{ github.event.pull_request.number }}
git_dir: '.'
-
name: check
run: git diff --quiet --exit-code
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ DIAMETER Prometheus.io collector
[![Erlang Versions][erlang version badge]][gh]

[Erlang Prometheus.io exporter](https://github.com/deadtrickster/prometheus.erl) for the
Erlang/OTP DIAMTER Application
Erlang/OTP DIAMETER Application

Build
-----
Expand Down Expand Up @@ -48,5 +48,5 @@ Number of requests.
[coveralls]: https://coveralls.io/github/travelping/prometheus_diameter_collector
[coveralls badge]: https://img.shields.io/coveralls/travelping/prometheus_diameter_collector/master.svg?style=flat-square
[gh]: https://github.com/travelping/prometheus_diameter_collector/actions/workflows/main.yml
[gh badge]: https://img.shields.io/github/workflow/status/travelping/prometheus_diameter_collector/CI?style=flat-square
[erlang version badge]: https://img.shields.io/badge/erlang-22.0%20to%2025.1-blue.svg?style=flat-square
[gh badge]: https://img.shields.io/github/actions/workflow/status/travelping/prometheus_diameter_collector/main.yml?branch=master&style=flat-square
[erlang version badge]: https://img.shields.io/badge/erlang-22.0%20to%2026.2-blue.svg?style=flat-square
34 changes: 26 additions & 8 deletions rebar.config
Original file line number Diff line number Diff line change
@@ -1,24 +1,42 @@
%%-*-Erlang-*-

%% == Erlang Compiler ==

{erl_opts, [debug_info]}.

%% == Dependencies ==

{deps, [{prometheus, "4.9.1"}]}.
{deps, [{prometheus, "4.11.0"}]}.

%% == Xref ==

{xref_checks, [undefined_function_calls, undefined_functions,
locals_not_used, deprecated_function_calls,
deprecated_funcqtions]}.
locals_not_used, deprecated_function_calls,
deprecated_funcqtions]}.

%% == Plugins ==

{plugins, [
% @TODO: Folow https://github.com/markusn/coveralls-erl/pull/36 and use `coveralls` after release
{coveralls, {git, "https://github.com/RoadRunnr/coveralls-erl.git", {branch, "feature/git-info"}}},
rebar3_hex]
}.
{plugins,
[
%% @TODO: Folow https://github.com/markusn/coveralls-erl/pull/36 and use `coveralls` after release
{coveralls, {git, "https://github.com/RoadRunnr/coveralls-erl.git", {branch, "feature/git-info"}}},
rebar3_hex,
rebar3_ex_doc,
rebar3_fmt
]}.

%% == ExDoc ==

{ex_doc, [
{extras, ["README.md", "LICENSE"]},
{main, "README.md"},
{source_url, "https://github.com/travelping/prometheus_diameter_collector"}
]}.

%% == Hex ==
{hex, [
{doc, #{provider => ex_doc}}
]}.

%% == Cover ==
{cover_enabled, true}.
Expand Down
6 changes: 3 additions & 3 deletions rebar.config.script
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
case {os:getenv("GITHUB_ACTIONS"), os:getenv("GITHUB_TOKEN")} of
{"true", Token} when is_list(Token) ->
CONFIG1 = [{coveralls_repo_token, Token},
{coveralls_service_job_id, os:getenv("GITHUB_RUN_ID")},
{coveralls_commit_sha, os:getenv("GITHUB_SHA")},
{coveralls_flag_name, os:getenv("COVERALLS_FLAG_NAME")} | CONFIG],
{coveralls_service_job_id, os:getenv("GITHUB_RUN_ID")},
{coveralls_commit_sha, os:getenv("GITHUB_SHA")},
{coveralls_flag_name, os:getenv("COVERALLS_FLAG_NAME")} | CONFIG],
case os:getenv("GITHUB_EVENT_NAME") =:= "pull_request"
andalso string:tokens(os:getenv("GITHUB_REF"), "/") of
[_, "pull", PRNO, _] ->
Expand Down
Loading

0 comments on commit 1b559c5

Please sign in to comment.