Skip to content

Commit 1799eab

Browse files
committed
fix: migrate from travis-ci to Github Actions
1 parent e53d75b commit 1799eab

11 files changed

Lines changed: 147 additions & 33 deletions

File tree

.coveragerc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[run]
2+
include = casbin_adapter/*
3+
omit = *migrations*, *tests*

.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/build.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: build
2+
on:
3+
push:
4+
branches: [master]
5+
pull_request:
6+
branches: [master]
7+
8+
jobs:
9+
test:
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
python-version: ['3.7', '3.8', '3.9', '3.10']
15+
os: [ubuntu-18.04, macOS-latest, windows-latest]
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v2
20+
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v2
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
26+
- name: Install dependencies
27+
run: |
28+
pip install -r requirements_dev.txt
29+
pip install coveralls
30+
pip install pytest
31+
32+
- name: Run tests
33+
run: coverage run -m django test --settings=tests.settings
34+
35+
- name: Upload coverage data to coveralls.io
36+
run: coveralls --service=github
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
COVERALLS_FLAG_NAME: ${{ matrix.os }} - ${{ matrix.python-version }}
40+
COVERALLS_PARALLEL: true
41+
42+
lint:
43+
name: Run Linters
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@v2
48+
with:
49+
fetch-depth: 0
50+
51+
- name: Super-Linter
52+
uses: github/super-linter@v4.9.2
53+
env:
54+
VALIDATE_ALL_CODEBASE: false
55+
VALIDATE_PYTHON_BLACK: true
56+
DEFAULT_BRANCH: master
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
LINTER_RULES_PATH: /
59+
PYTHON_BLACK_CONFIG_FILE: pyproject.toml
60+
61+
coveralls:
62+
name: Indicate completion to coveralls.io
63+
needs: test
64+
runs-on: ubuntu-latest
65+
container: python:3-slim
66+
steps:
67+
- name: Finished
68+
run: |
69+
pip3 install --upgrade coveralls
70+
coveralls --finish
71+
env:
72+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
74+
release:
75+
name: Release
76+
runs-on: ubuntu-latest
77+
needs: [ test, coveralls ]
78+
steps:
79+
- name: Checkout
80+
uses: actions/checkout@v2
81+
with:
82+
fetch-depth: 0
83+
84+
- name: Setup Node.js
85+
uses: actions/setup-node@v2
86+
with:
87+
node-version: '16'
88+
89+
- name: Setup
90+
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
91+
92+
- name: Set up python
93+
uses: actions/setup-python@v2
94+
with:
95+
python-version: 3.8
96+
97+
- name: Install setuptools
98+
run: python -m pip install --upgrade setuptools wheel twine
99+
100+
- name: Release
101+
env:
102+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
104+
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 & 23 deletions
This file was deleted.

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[tool.black]
2+
line-length = 120

requirements.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
casbin
2-
django
1+
casbin==1.16.10
2+
Django
3+

requirements_dev.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-r requirements.txt
2+
setuptools==60.2.0
3+
simpleeval==0.9.12

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[metadata]
2+
version = 1.0.0

setup.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
setuptools.setup(
99
name="casbin-django-orm-adapter",
10-
version="0.0.1",
1110
author="Yang Luo",
1211
author_email="hsluoyz@qq.com",
1312
description="Django's ORM adapter for PyCasbin",
@@ -17,15 +16,13 @@
1716
keywords=["casbin", "adapter", "storage-driver", "django", "orm", "django-orm", "access-control", "authorization"],
1817
packages=setuptools.find_packages(exclude=("tests",)),
1918
install_requires=["casbin", "django"],
20-
python_requires=">=3.3",
19+
python_requires=">=3.7",
2120
license="Apache 2.0",
2221
classifiers=[
23-
"Programming Language :: Python :: 3.3",
24-
"Programming Language :: Python :: 3.4",
25-
"Programming Language :: Python :: 3.5",
26-
"Programming Language :: Python :: 3.6",
2722
"Programming Language :: Python :: 3.7",
2823
"Programming Language :: Python :: 3.8",
24+
"Programming Language :: Python :: 3.9",
25+
"Programming Language :: Python :: 3.10",
2926
"License :: OSI Approved :: Apache Software License",
3027
"Operating System :: OS Independent",
3128
],

0 commit comments

Comments
 (0)