From f59612b28f6605178acd8812caba50c5c5f7c0a5 Mon Sep 17 00:00:00 2001 From: Daniela Plascencia Date: Wed, 7 Feb 2024 13:16:46 +0100 Subject: [PATCH] ci: add on pull/push CI workflows This commit adds the corresponding workflows for on pull and push actions, enabling linting and unit testing. --- .github/workflows/integrate.yaml | 32 ++++++++++++++++++++++++++ .github/workflows/on_pull_request.yaml | 14 +++++++++++ .github/workflows/on_push.yaml | 20 ++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 .github/workflows/integrate.yaml create mode 100644 .github/workflows/on_pull_request.yaml create mode 100644 .github/workflows/on_push.yaml diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml new file mode 100644 index 0000000..782c3d5 --- /dev/null +++ b/.github/workflows/integrate.yaml @@ -0,0 +1,32 @@ +# reusable workflow triggered by other actions +name: CI + +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 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..b850b97 --- /dev/null +++ b/.github/workflows/on_push.yaml @@ -0,0 +1,20 @@ +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: + - master + - main + - track/** + +jobs: + tests: + name: Run Tests + uses: ./.github/workflows/integrate.yaml