Skip to content

Commit

Permalink
ci: add on pull/push CI workflows (#4)
Browse files Browse the repository at this point in the history
* ci: add on pull/push CI workflows

This commit adds the corresponding workflows for on pull and push actions, enabling
linting and unit testing.
  • Loading branch information
DnPlas authored Feb 14, 2024
1 parent a0d974c commit 0b09a89
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# reusable workflow triggered by other actions
name: CI

on:
workflow_call:

jobs:
lint:
name: Lint Check
runs-on: ubuntu-20.04

steps:
- name: Check out code
uses: actions/checkout@v3

- name: Install dependencies
run: |
sudo apt-get install python3-pip
python3 -m pip install tox
- name: Lint code
run: tox -e lint

unit:
name: Unit Test
runs-on: ubuntu-20.04

steps:
- name: Check out code
uses: actions/checkout@v3

- name: Install dependencies
run: sudo apt-get install python3-pip tox

- name: Run unit tests
run: tox -e unit
14 changes: 14 additions & 0 deletions .github/workflows/on_pull_request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: On Pull Request

# On pull_request, we:
# * always publish to charmhub at latest/edge/branchname
# * always run tests

on:
pull_request:

jobs:

tests:
name: Run Tests
uses: ./.github/workflows/integrate.yaml
19 changes: 19 additions & 0 deletions .github/workflows/on_push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: On Push

# On push to a "special" branch, we:
# * always publish to charmhub at latest/edge/branchname
# * always run tests
# where a "special" branch is one of main/master or track/**, as
# by convention these branches are the source for a corresponding
# charmhub edge channel.

on:
push:
branches:
- main
- track/**

jobs:
tests:
name: Run Tests
uses: ./.github/workflows/integrate.yaml

0 comments on commit 0b09a89

Please sign in to comment.