Skip to content

Commit 9297043

Browse files
authored
ci: change travis-ci to github-action (#10)
Signed-off-by: ffyuanda <46557895+ffyuanda@users.noreply.github.com>
1 parent 88b9b8a commit 9297043

6 files changed

Lines changed: 136 additions & 29 deletions

File tree

.github/semantic.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Always validate the PR title AND all the commits
2+
titleAndCommits: true

.github/workflows/main.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: tests
2+
on:
3+
push:
4+
branches: [ master ]
5+
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
test:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
python-version: [ 3.6, 3.7, 3.8, 3.9 ]
16+
mongodb-version: ['4.0', '4.2', '4.4']
17+
os: [ ubuntu-latest ]
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v2
22+
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v2
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
28+
- name: Start MongoDB
29+
uses: supercharge/mongodb-github-action@1.6.0
30+
with:
31+
mongodb-version: ${{ matrix.mongodb-version }}
32+
33+
- name: Install dependencies
34+
run: |
35+
pip install -r requirements.txt
36+
pip install coveralls
37+
38+
- name: Run tests
39+
run: |
40+
coverage run -m unittest discover --verbose --start-directory tests/ --pattern "test_*.py" --top-level-directory tests/
41+
42+
- name: Upload coverage data to coveralls.io
43+
run: coveralls --service=github
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
COVERALLS_FLAG_NAME: ${{ matrix.os }} - ${{ matrix.python-version }}
47+
COVERALLS_PARALLEL: true
48+
49+
coveralls:
50+
name: Indicate completion to coveralls.io
51+
needs: test
52+
runs-on: ubuntu-latest
53+
container: python:3-slim
54+
steps:
55+
- name: Finished
56+
run: |
57+
pip3 install --upgrade coveralls
58+
coveralls --finish
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
62+
release:
63+
name: Release
64+
runs-on: ubuntu-latest
65+
needs: [ test, coveralls ]
66+
steps:
67+
- name: Checkout
68+
uses: actions/checkout@v2
69+
with:
70+
fetch-depth: 0
71+
72+
- name: Setup Node.js
73+
uses: actions/setup-node@v1
74+
75+
- name: Setup
76+
run: npm install -g semantic-release @semantic-release/github @semantic-release/changelog @semantic-release/commit-analyzer @semantic-release/git @semantic-release/release-notes-generator semantic-release-pypi
77+
78+
- name: Set up python
79+
uses: actions/setup-python@v2
80+
with:
81+
python-version: 3.8
82+
83+
- name: Install setuptools
84+
run: python -m pip install --upgrade setuptools wheel twine
85+
86+
- name: Release
87+
env:
88+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
90+
run: npx semantic-release

.releaserc.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"branches": "master",
3+
"plugins": [
4+
"@semantic-release/commit-analyzer",
5+
"@semantic-release/release-notes-generator",
6+
"semantic-release-pypi",
7+
"@semantic-release/github",
8+
[
9+
"@semantic-release/changelog",
10+
{
11+
"changelogFile": "CHANGELOG.md",
12+
"changelogTitle": "# Semantic Versioning Changelog"
13+
}
14+
],
15+
[
16+
"@semantic-release/git",
17+
{
18+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}",
19+
"assets": ["CHANGELOG.md", "setup.py", "setup.cfg"]
20+
}
21+
]
22+
]
23+
}

.travis.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

setup.cfg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[bdist_wheel]
2+
universal = 1
3+
4+
[metadata]
5+
description-file = README.md
6+
version = 0.1.0

setup.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,32 @@
1-
import setuptools
1+
from setuptools import setup, find_packages, __version__
2+
from os import path
23

34
desc_file = "README.md"
45

6+
here = path.abspath(path.dirname(__file__))
7+
8+
# Get the long description from the README file
59
with open(desc_file, "r") as fh:
610
long_description = fh.read()
711

8-
setuptools.setup(
12+
# get the dependencies and installs
13+
with open(path.join(here, "requirements.txt"), encoding="utf-8") as f:
14+
all_reqs = f.read().split("\n")
15+
16+
install_requires = [x.strip() for x in all_reqs if "git+" not in x]
17+
18+
19+
setup(
920
name="casbin_pymongo_adapter",
10-
version="0.1.0",
1121
author="TechLee,Xhy-5000,AmosChenYQ",
1222
author_email="techlee@qq.com,amoschenyq@foxmail.com",
1323
description="PyMongo Adapter for PyCasbin",
1424
long_description=long_description,
1525
long_description_content_type="text/markdown",
1626
url="https://github.com/pycasbin/pymongo-adapter",
1727
keywords=["casbin", "pymongo", "casbin-adapter", "rbac", "access control", "abac", "acl", "permission"],
18-
packages=setuptools.find_packages(),
19-
install_requires=['casbin>=0.8.4', 'pymongo>=3.10.1'],
28+
packages=find_packages(),
29+
install_requires=install_requires,
2030
python_requires=">=3.6",
2131
license="Apache 2.0",
2232
classifiers=[

0 commit comments

Comments
 (0)