From 0589383b044988092b6eb5adc1cb77ba6d69a162 Mon Sep 17 00:00:00 2001 From: Lukas Holecek Date: Feb 28 2022 08:32:30 +0000 Subject: Enable GitHub Actions Inspired by GitHub Actions used by Cachito. --- diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..85006f3 --- /dev/null +++ b/.github/dependabot.yml @@ -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" diff --git a/.github/workflows/gating.yaml b/.github/workflows/gating.yaml new file mode 100644 index 0000000..bd6038f --- /dev/null +++ b/.github/workflows/gating.yaml @@ -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 - + ignore: DL3041 + failure-threshold: warning diff --git a/tox.ini b/tox.ini index 2194843..a232175 100644 --- a/tox.ini +++ b/tox.ini @@ -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 @@ -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 =