Skip to content

Commit

Permalink
Enable GitHub Actions
Browse files Browse the repository at this point in the history
Inspired by GitHub Actions used by Cachito.
  • Loading branch information
hluk committed Feb 28, 2022
1 parent a4cbbef commit 0589383
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
101 changes: 101 additions & 0 deletions .github/workflows/gating.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Gating

on:
pull_request:
push:
workflow_dispatch:
inputs: {}

jobs:
tests:
name: Unit tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]

steps:
- uses: actions/checkout@v1

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Test with tox
run: tox -e py

- name: Run coveralls-python
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: python-${{ matrix.python-version }}
COVERALLS_PARALLEL: true
run: |
pip3 install --upgrade pip
pip3 install --upgrade setuptools
pip3 install --upgrade coveralls==3.2.0
coveralls --service=github
coveralls-finish:
name: Finish coveralls-python
needs: tests
runs-on: ubuntu-latest
steps:
- name: Finished
run: |
pip3 install --upgrade pip
pip3 install --upgrade setuptools
pip3 install --upgrade coveralls
coveralls --finish --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

linters:
name: Linters
strategy:
matrix:
tox_env:
- bandit
- lint

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Test '${{ matrix.tox_env }}' with tox
run: tox -e ${{ matrix.tox_env }}

hadolint:
name: Hadolint
runs-on: ubuntu-latest
strategy:
matrix:
dockerfile:
- Dockerfile

steps:
- uses: actions/checkout@v2

- uses: hadolint/hadolint-action@v1.5.0
with:
dockerfile: ${{ matrix.dockerfile }}
# Ignore list:
# * DL3041 - Specify version with dnf install -y <package>-<version>
ignore: DL3041
failure-threshold: warning
9 changes: 8 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = lint,py310,docs
envlist = bandit,lint,py310,docs
# If the user is missing an interpreter, don't fail
skip_missing_interpreters = True

Expand All @@ -17,6 +17,13 @@ commands =
--cov-config .coveragerc --cov=greenwave --cov-report term \
--cov-report xml --cov-report html {posargs}

[testenv:bandit]
skip_install = true
deps =
bandit
commands =
bandit -r greenwave

[testenv:docs]
changedir = docs
whitelist_externals =
Expand Down

0 comments on commit 0589383

Please sign in to comment.