Switch from Travis to Github Actions
This commit is contained in:
44
.github/workflows/ci.yml
vendored
Normal file
44
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
name: CI
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
|
||||
tests:
|
||||
name: Tests
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
otp: ['19.3', '21.3', 24]
|
||||
runs-on: ubuntu-20.04
|
||||
container:
|
||||
image: erlang:${{ matrix.otp }}
|
||||
|
||||
steps:
|
||||
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Cache rebar3
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cache/rebar3/
|
||||
key: ${{matrix.otp}}-${{hashFiles('rebar.config')}}
|
||||
|
||||
- run: rebar3 compile
|
||||
- run: rebar3 xref
|
||||
- run: rebar3 dialyzer
|
||||
- run: rebar3 eunit -v
|
||||
|
||||
- name: Send to Coveralls
|
||||
if: matrix.otp == 24
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
rebar3 as test coveralls send
|
||||
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_ID,
|
||||
"status":"done"}}'
|
||||
23
.travis.yml
23
.travis.yml
@@ -1,23 +0,0 @@
|
||||
language: erlang
|
||||
|
||||
os: linux
|
||||
|
||||
dist: xenial
|
||||
|
||||
before_install:
|
||||
- pip install --user cpp-coveralls coveralls-merge
|
||||
|
||||
install:
|
||||
- rebar get-deps
|
||||
|
||||
script: rebar compile && rebar skip_deps=true eunit
|
||||
|
||||
after_success:
|
||||
- cpp-coveralls --exclude lib --exclude tests --gcov-options '\-lp' --dump c.json
|
||||
- coveralls-merge c.json erlang.json
|
||||
|
||||
otp_release:
|
||||
- R16B03-1
|
||||
- 17.3
|
||||
- 19.3
|
||||
- 23.0
|
||||
@@ -1,11 +1,13 @@
|
||||
# Erlang wrapper for SQLite3
|
||||
|
||||
[](https://github.com/badlop/erlang-sqlite3/actions/workflows/ci.yml)
|
||||
[](https://coveralls.io/github/processone/erlang-sqlite3?branch=master)
|
||||
[](https://hex.pm/packages/sqlite3)
|
||||
|
||||
This library allows you to work with SQLite3 databases from Erlang.
|
||||
|
||||
It is compatible with Windows and Linux, and should probably work on other OSes as well.
|
||||
|
||||
[](https://travis-ci.org/alexeyr/erlang-sqlite3)
|
||||
|
||||
See also [esqlite](https://github.com/mmzeeman/esqlite) for an alternative library.
|
||||
|
||||
## Requirements
|
||||
|
||||
@@ -9,3 +9,10 @@
|
||||
{".*win32.*", "DRV_LDFLAGS", "$DRV_LDFLAGS sqlite3.lib"}]}.
|
||||
{cover_enabled, true}.
|
||||
{eunit_opts, [verbose, {report,{eunit_surefire,[{dir,"."}]}}]}.
|
||||
{cover_export_enabled, true}.
|
||||
{coveralls_coverdata , "_build/test/cover/eunit.coverdata"}.
|
||||
{coveralls_service_name , "github"}.
|
||||
|
||||
{xref_checks, [undefined_function_calls, undefined_functions, deprecated_function_calls, deprecated_functions]}.
|
||||
|
||||
{profiles, [{test, [{erl_opts, [{src_dirs, ["src", "test"]}]}]}]}.
|
||||
|
||||
@@ -29,7 +29,6 @@ IsRebar3 = case application:get_key(rebar, vsn) of
|
||||
lists:keymember(mix, 1, application:loaded_applications())
|
||||
end,
|
||||
|
||||
JobId = case os:getenv("TRAVIS_JOB_ID") of false -> ""; V -> V end,
|
||||
|
||||
ModCfg0 = fun(F, Cfg, [Key|Tail], Op, Default) ->
|
||||
{OldVal,PartCfg} = case lists:keytake(Key, 1, Cfg) of
|
||||
@@ -93,6 +92,23 @@ GlobalDepsFilter = fun(Deps) ->
|
||||
end, DepNames)
|
||||
end,
|
||||
|
||||
GithubConfig = 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")}],
|
||||
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;
|
||||
_ ->
|
||||
[]
|
||||
end,
|
||||
|
||||
Rules = [
|
||||
{[deps], IsRebar3,
|
||||
Rebar3DepsFilter, []},
|
||||
@@ -103,12 +119,17 @@ Rules = [
|
||||
{compile, {pc, compile}},
|
||||
{clean, {pc, clean}}
|
||||
]}]), []},
|
||||
{[plugins], IsRebar3 and (os:getenv("GITHUB_ACTIONS") == "true"),
|
||||
AppendList([{coveralls, {git,
|
||||
"https://github.com/RoadRunnr/coveralls-erl.git",
|
||||
{branch, "feature/git-info"}}} ]), []},
|
||||
{[deps], os:getenv("USE_GLOBAL_DEPS") /= false,
|
||||
GlobalDepsFilter, []}
|
||||
],
|
||||
|
||||
|
||||
Config = FilterConfig(FilterConfig, CONFIG, Rules),
|
||||
Config = FilterConfig(FilterConfig, CONFIG, Rules)
|
||||
++ GithubConfig,
|
||||
|
||||
%io:format("Rules:~n~p~n~nCONFIG:~n~p~n~nConfig:~n~p~n", [Rules, CONFIG, Config]),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user