Skip to content

Commit

Permalink
Add Github Action for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
nitmir committed Jul 26, 2023
1 parent 551ed93 commit 7bf0689
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 6 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/github-actions.yml
@@ -0,0 +1,46 @@
name: policyd-rate-limit
run-name: ${{ github.actor }} is running policyd-rate-limit CI tests
on: [push]
jobs:
flake8:
runs-on: ubuntu-latest
container:
image: python:bookworm
steps:
- uses: actions/checkout@v3
- run: pip install tox
- run: apt-get update && apt-get install -y --no-install-recommends sudo
- run: useradd --uid 1000 testuser && mkdir -p /home/testuser && chown testuser -R . /home/testuser
- run: sudo -u testuser tox -e flake8
check_rst:
runs-on: ubuntu-latest
container:
image: python:bookworm
steps:
- uses: actions/checkout@v3
- run: pip install tox
- run: apt-get update && apt-get install -y --no-install-recommends sudo
- run: useradd --uid 1000 testuser && mkdir -p /home/testuser && chown testuser -R . /home/testuser
- run: sudo -u testuser tox -e check_rst
tests:
runs-on: ubuntu-latest
container:
image: python:bookworm
steps:
- uses: actions/checkout@v3
- run: pip install tox
- run: apt-get update && apt-get install -y --no-install-recommends sudo
- run: useradd --uid 1000 testuser && mkdir -p /home/testuser && chown testuser -R . /home/testuser
- run: sudo -u testuser tox -e py3
coverage:
runs-on: ubuntu-latest
container:
image: python:bookworm
steps:
- uses: actions/checkout@v3
- run: pip install tox
- run: apt-get update && apt-get install -y --no-install-recommends sudo
- run: useradd --uid 1000 testuser && mkdir -p /home/testuser && chown testuser -R . /home/testuser
- run: sudo --preserve-env=COVERAGE_TOKEN -u testuser tox -e coverage
env:
COVERAGE_TOKEN: ${{ secrets.COVERAGE_TOKEN }}
12 changes: 6 additions & 6 deletions policyd_rate_limit/tests/test_daemon.py
Expand Up @@ -46,11 +46,11 @@ def test_main_afinet_socket(self):
with test_utils.lauch(self.base_config) as cfg:
self.base_test(cfg)

# travis CI has no IPv6 support
#def test_main_afinet6_socket(self):
# self.base_config["SOCKET"] = ["::1", 27184]
# with test_utils.lauch(self.base_config) as cfg:
# self.base_test(cfg)
# travis CI/Github Action has no IPv6 support
# def test_main_afinet6_socket(self):
# self.base_config["SOCKET"] = ["::1", 27184]
# with test_utils.lauch(self.base_config) as cfg:
# self.base_test(cfg)

def test_no_debug_no_report(self):
self.base_config["debug"] = False
Expand Down Expand Up @@ -217,7 +217,7 @@ def test_already_running(self):
f.write("")
os.chmod(self.base_config["pidfile"], 0)
with test_utils.lauch(self.base_config, get_process=True) as p:
self.assertEqual(p.wait(), 6)
self.assertEqual(p.wait(timeout=5), 6)
finally:
try:
os.remove(self.base_config["pidfile"])
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Expand Up @@ -60,3 +60,5 @@ commands=
coverage report
coverage html
{toxinidir}/.update_coverage "{toxinidir}" "policyd-rate-limit"
allowlist_externals=
{toxinidir}/.update_coverage

0 comments on commit 7bf0689

Please sign in to comment.