Skip to content

Commit

Permalink
Add workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
danischm committed May 22, 2024
1 parent 07875f9 commit 1375046
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# 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: 'github-actions'
directory: '/'
schedule:
interval: 'daily'
- package-ecosystem: pip
directory: '/'
schedule:
interval: daily
versioning-strategy: lockfile-only
allow:
- dependency-type: 'all'
21 changes: 21 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Release

on:
push:
tags:
- 'v*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Publish
env:
POETRY_HTTP_BASIC_PYPI_USERNAME: __token__
POETRY_HTTP_BASIC_PYPI_PASSWORD: ${{ secrets.POETRY_HTTP_BASIC_PYPI_PASSWORD }}
run: |
keyring --disable
pip install poetry
poetry build
poetry publish
88 changes: 88 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Tests
on:
workflow_dispatch:
pull_request:
push:
branches:
- main

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Python Setup
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Lint Checks
run: |
pip install poetry
poetry install
poetry run flake8
poetry run isort --check nac_collector
poetry run black --check nac_collector
poetry run mypy nac_collector
test:
name: Tests
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
python:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Python Setup
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

- name: Test
run: |
pip install poetry
poetry install
poetry run pytest
notification:
name: Notification
if: always() && github.event_name != 'pull_request'
needs: [lint, test]
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Check Job Success
run: |
if [ ${{ needs.lint.result }} == 'success' ] && [ ${{ needs.test.result }} == 'success' ]; then
echo "All jobs succeeded"
echo "jobSuccess=success" >> $GITHUB_ENV
else
echo "Not all jobs succeeded"
echo "jobSuccess=fail" >> $GITHUB_ENV
fi
id: print_status

- name: Webex Notification
if: always()
uses: qsnyder/action-wxt@master
env:
TOKEN: ${{ secrets.WEBEX_TOKEN }}
ROOMID: ${{ secrets.WEBEX_ROOM_ID }}
MESSAGE: |
[**[${{ env.jobSuccess }}] ${{ github.repository }} #${{ github.run_number }}**](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
* Commit: [${{ github.event.head_commit.message }}](${{ github.event.head_commit.url }})[${{ github.event.pull_request.title }}](${{ github.event.pull_request.html_url }})
* Author: ${{ github.event.sender.login }}
* Branch: ${{ github.ref }} ${{ github.head_ref }}
* Event: ${{ github.event_name }}

0 comments on commit 1375046

Please sign in to comment.