diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..70d144e --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @travelping/erlang-devs diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..adcb001 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,49 @@ +name: CI + +on: + push: + pull_request: + branches: [ $default-branch ] + release: + types: + - created + +jobs: + test: + name: CI + runs-on: ubuntu-latest + strategy: + matrix: + otp: [21.3.8.18, 22.0.7, 22.1.8, 22.2.8, 22.3.4.14, 23.0.4, 23.1.5.0, 23.2.1.0] + 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 \ + musl-dev musl-utils ncurses-dev pcre2 pkgconf scanelf wget zlib + - uses: actions/checkout@v2 + - name: Build + run: rebar3 compile + - name: Run tests + run: | + rebar3 do xref + rebar3 do ct + - name: Coveralls + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: DEBUG=1 rebar3 as test coveralls send || /bin/true + + finish: + needs: test + runs-on: ubuntu-20.04 + steps: + - name: Coveralls Finished + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + curl -v -k https://coveralls.io/webhook \ + --header "Content-Type: application/json" \ + --data "{\"repo_name\":\"$GITHUB_REPOSITORY\",\"repo_token\":\"$GITHUB_TOKEN\",\"payload\":{\"build_num\":$GITHUB_RUN_NUMBER,\"status\":\"done\"}}" diff --git a/.gitignore b/.gitignore index 2955d97..e14e966 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ _build/ .arcconfig tetrapak/.local.cache *~ +rebar3 +rebar.lock diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7f46d00..0000000 --- a/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -sudo: required -dist: bionic - -language: erlang - -otp_release: - - 22.0.7 - - 22.1.8.1 - - 22.2.8 - -install: "true" - -before_install: - - wget https://s3.amazonaws.com/rebar3/rebar3 - - chmod u+x ./rebar3 - -script: - - env - - ./rebar3 plugins list - - ./rebar3 compile - - ./rebar3 do xref, ct - - (./rebar3 as test do coveralls send || /bin/true) - -jobs: - include: - - - - dist: xenial - otp_release: 21.3.8.1 - -notifications: - webhooks: https://coveralls.io/webhook diff --git a/README.md b/README.md index f72f282..9c37bd8 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ gtplib ====== -[![Build Status][travis badge]][travis] +[![Build Status][gh badge]][gh] [![Coverage Status][coveralls badge]][coveralls] -[![Erlang Versions][erlang version badge]][travis] +[![Erlang Versions][erlang version badge]][gh] Erlang library for encoding and decoding GTPv1, GTPv2 and GTP' frames. Erlang netlink wrapper for talking the Linux kernel GTP-U module @@ -17,8 +17,8 @@ Using rebar: # rebar3 compile -[travis]: https://travis-ci.com/travelping/gtplib -[travis badge]: https://img.shields.io/travis/travelping/com/gtplib/master.svg?style=flat-square +[gh]: https://github.com/travelping/gtplib/actions/workflows/main.yml +[gh badge]: https://img.shields.io/github/workflow/status/travelping/gtplib/CI?style=flat-square [coveralls]: https://coveralls.io/github/travelping/gtplib [coveralls badge]: https://img.shields.io/coveralls/travelping/gtplib/master.svg?style=flat-square [erlang version badge]: https://img.shields.io/badge/erlang-R20.1%20to%21.0-blue.svg?style=flat-square diff --git a/cover.spec b/cover.spec deleted file mode 100644 index f9f071d..0000000 --- a/cover.spec +++ /dev/null @@ -1,2 +0,0 @@ -{incl_app, gtplib, details}. -{export, "logs/all.coverdata"}. diff --git a/rebar.config b/rebar.config index 52a8809..e32059a 100644 --- a/rebar.config +++ b/rebar.config @@ -14,7 +14,7 @@ [{deps, [{proper, {git, "https://github.com/proper-testing/proper.git", {branch, "master"}}}]}, - {plugins, [{coveralls, "2.1.0"}]} + {plugins, [{coveralls, {git, "https://github.com/RoadRunnr/coveralls-erl.git", {branch, "feature/git-info"}}}]} ]}, {pcap, [{deps, @@ -46,5 +46,5 @@ {do_coveralls_after_ct, false}. {do_coveralls_after_eunit, false}. {coveralls_coverdata, "_build/test/cover/ct.coverdata"}. -{coveralls_service_name, "travis-ci"}. +{coveralls_service_name, "github"}. {coveralls_parallel, true}. diff --git a/rebar.config.script b/rebar.config.script index 4b49006..e904b0b 100644 --- a/rebar.config.script +++ b/rebar.config.script @@ -1,8 +1,17 @@ -%% -*- Erlang -*- -case os:getenv("TRAVIS") of - "true" -> - JobId = os:getenv("TRAVIS_JOB_ID"), - lists:keystore(coveralls_service_job_id, 1, CONFIG, {coveralls_service_job_id, JobId}); - _ -> - CONFIG +%% -*- erlang -*- +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_service_number, os:getenv("GITHUB_RUN_NUMBER")} | CONFIG], + case os:getenv("GITHUB_EVENT_NAME") =:= "pull_request" + andalso string:tokens(os:getenv("GITHUB_REF"), "/") of + [_, "pull", PRNO, _] -> + [{coveralls_service_pull_request, PRNO} | CONFIG1]; + _ -> + CONFIG1 + end; + _ -> + CONFIG end.