diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml new file mode 100644 index 0000000..e6c6b69 --- /dev/null +++ b/.github/workflows/integrate.yaml @@ -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 diff --git a/.github/workflows/on_pull_request.yaml b/.github/workflows/on_pull_request.yaml new file mode 100644 index 0000000..203a66b --- /dev/null +++ b/.github/workflows/on_pull_request.yaml @@ -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 diff --git a/.github/workflows/on_push.yaml b/.github/workflows/on_push.yaml new file mode 100644 index 0000000..2f3b545 --- /dev/null +++ b/.github/workflows/on_push.yaml @@ -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