From 5eb0faa347863fa78bf40d587d16b3763a45d2d0 Mon Sep 17 00:00:00 2001 From: jneo8 Date: Thu, 21 Dec 2023 14:04:07 +0800 Subject: [PATCH] ci: enable github workflow - github workflow - Remove unused dependency - Drop bionic --- .github/CODEOWNERS | 12 +++++ .github/workflows/check.yaml | 44 +++++++++++++++++++ .github/workflows/issues_to_jira.yaml | 25 +++++++++++ .github/workflows/release.yaml | 25 +++++++++++ .github/workflows/sonar.yaml | 17 +++++++ charmcraft.yaml | 4 -- tests/functional/tests/bundles/bionic.yaml | 1 - .../tests/bundles/overlays/bionic.yaml.j2 | 1 - tests/functional/tests/tests.yaml | 1 - tests/functional/tests/tests_juju_local.py | 2 +- tox.ini | 7 ++- 11 files changed, 129 insertions(+), 10 deletions(-) create mode 100644 .github/CODEOWNERS create mode 100644 .github/workflows/check.yaml create mode 100644 .github/workflows/issues_to_jira.yaml create mode 100644 .github/workflows/release.yaml create mode 100644 .github/workflows/sonar.yaml delete mode 120000 tests/functional/tests/bundles/bionic.yaml delete mode 100644 tests/functional/tests/bundles/overlays/bionic.yaml.j2 diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..ef9d84a --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,12 @@ +# This is a template `CODEOWNERS` file for ops charms +# This file is managed by bootstack-charms-spec and should not be modified +# within individual charm repos. https://launchpad.net/bootstack-charms-spec + +# For more information about CODEOWNER, please refer to +# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#example-of-a-codeowners-file + +# These owners will be the default owners for everything in the repo. Unless a +# later match takes precedence, @canonical/bootstack will be requested for +# review when someone opens a pull request. +* @canonical/soleng-reviewers + diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml new file mode 100644 index 0000000..9952bba --- /dev/null +++ b/.github/workflows/check.yaml @@ -0,0 +1,44 @@ +name: Check workflow running linter, unit and functional tests + +on: + workflow_call: + pull_request: + types: [opened, synchronize, reopened] + branches: [master, main] + paths-ignore: + - "**.md" + - "**.rst" + +jobs: + lint-unit: + uses: canonical/bootstack-actions/.github/workflows/lint-unit.yaml@v2 + strategy: + fail-fast: false + matrix: + python-version: ["3.8", "3.10"] + with: + python-version: ${{ matrix.python-version }} + tox-version: "<4" + + func: + uses: canonical/bootstack-actions/.github/workflows/func.yaml@v3 + needs: lint-unit + strategy: + fail-fast: false + with: + command: "make functional31" + juju-channel: "3.1/stable" + nested-containers: false + provider: "lxd" + python-version: "3.10" + timeout-minutes: 120 + tox-version: "<4" + runs-on: "['self-hosted', 'runner-juju-local']" + action-operator: false + external-controller: true + juju-controller: soleng-ci-ctrl + zaza-yaml: "LS0tCm1vZGVsX3NldHRpbmdzOgogIGltYWdlLXN0cmVhbTogcmVsZWFzZWQKcmVnaW9uOiBwcm9kc3RhY2s2CmNsb3VkOiBidWlsZGVyLWNsb3VkCmNyZWRlbnRpYWw6IGJ1aWxkZXItY2xvdWQtY3JlZAo=" + secrets: + juju-controllers-yaml: ${{ secrets.JUJU_CONTROLLERS_YAML }} + juju-accounts-yaml: ${{ secrets.JUJU_ACCOUNTS_YAML }} + openstack-auth-env: ${{ secrets.OPENSTACK_AUTH_ENV }} diff --git a/.github/workflows/issues_to_jira.yaml b/.github/workflows/issues_to_jira.yaml new file mode 100644 index 0000000..cc44534 --- /dev/null +++ b/.github/workflows/issues_to_jira.yaml @@ -0,0 +1,25 @@ +# This is a template `issues_to_jira.yaml` file for ops charms +# This file is managed by bootstack-charms-spec and should not be modified +# within individual charm repos. https://launchpad.net/bootstack-charms-spec + +# This workflow requires to provide JIRA webhook URL via JIRA_URL GitHub Secret. +# +# Read more: +# https://support.atlassian.com/cloud-automation/docs/jira-automation-triggers/#Automationtriggers-Incomingwebhook +# +# Original code source: +# https://github.com/beliaev-maksim/github-to-jira-automation + +name: Issues to JIRA + +on: + issues: + # available via github.event.action + types: [opened, reopened, closed] + +jobs: + update: + name: Update Issue + uses: beliaev-maksim/github-to-jira-automation/.github/workflows/issues_to_jira.yaml@master + secrets: + JIRA_URL: ${{ secrets.JIRA_URL }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..309562b --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,25 @@ +# This is a template `release.yaml` file for ops charms +# This file is managed by bootstack-charms-spec and should not be modified +# within individual charm repos. https://launchpad.net/bootstack-charms-spec + +name: Release to Edge + +on: + push: + branches: [master, main] + +concurrency: + group: release + cancel-in-progress: true + +jobs: + check: + uses: ./.github/workflows/check.yaml + + release: + needs: check + uses: canonical/bootstack-actions/.github/workflows/charm-release.yaml@v2 + secrets: inherit + with: + channel: "latest/edge" + upload-image: false diff --git a/.github/workflows/sonar.yaml b/.github/workflows/sonar.yaml new file mode 100644 index 0000000..34c8d6f --- /dev/null +++ b/.github/workflows/sonar.yaml @@ -0,0 +1,17 @@ +# This is a template `sonar.yaml` file for ops charms +# This file is managed by bootstack-charms-spec and should not be modified +# within individual charm repos. https://launchpad.net/bootstack-charms-spec + +name: SonarCloud +on: + workflow_run: + workflows: + - PR workflow running lint checkers, unit and functional tests + types: [completed] + +jobs: + sonar: + uses: canonical/bootstack-actions/.github/workflows/sonar.yaml@main + secrets: inherit + with: + workflow-name: PR workflow running lint checkers, unit and functional tests diff --git a/charmcraft.yaml b/charmcraft.yaml index ac5f07b..df36352 100644 --- a/charmcraft.yaml +++ b/charmcraft.yaml @@ -18,7 +18,3 @@ bases: channel: "20.04" architectures: - amd64 - - name: ubuntu - channel: "18.04" - architectures: - - amd64 \ No newline at end of file diff --git a/tests/functional/tests/bundles/bionic.yaml b/tests/functional/tests/bundles/bionic.yaml deleted file mode 120000 index f81f6ff..0000000 --- a/tests/functional/tests/bundles/bionic.yaml +++ /dev/null @@ -1 +0,0 @@ -base.yaml \ No newline at end of file diff --git a/tests/functional/tests/bundles/overlays/bionic.yaml.j2 b/tests/functional/tests/bundles/overlays/bionic.yaml.j2 deleted file mode 100644 index 65b2826..0000000 --- a/tests/functional/tests/bundles/overlays/bionic.yaml.j2 +++ /dev/null @@ -1 +0,0 @@ -series: bionic diff --git a/tests/functional/tests/tests.yaml b/tests/functional/tests/tests.yaml index c0f919c..18a12d9 100644 --- a/tests/functional/tests/tests.yaml +++ b/tests/functional/tests/tests.yaml @@ -6,7 +6,6 @@ gate_bundles: - focal-juju3 - jammy - focal - - bionic dev_bundles: - jammy-juju3 - jammy diff --git a/tests/functional/tests/tests_juju_local.py b/tests/functional/tests/tests_juju_local.py index d34cf34..35fbb8d 100644 --- a/tests/functional/tests/tests_juju_local.py +++ b/tests/functional/tests/tests_juju_local.py @@ -13,7 +13,7 @@ def setUpClass(cls): cls.model_name = model.get_juju_model() cls.test_config = lifecycle_utils.get_charm_config() model.block_until_all_units_idle() - # Add a test model in the remote Juju cloud + # Add a test model in the remote Juju cloud # This is needed becuase in Juju 3.x there's no default model created # after bootstrapping the controller cls.remote_juju(["add-model", "test"], None) diff --git a/tox.ini b/tox.ini index b0f8d45..7222e34 100644 --- a/tox.ini +++ b/tox.ini @@ -13,8 +13,12 @@ passenv = setenv = PYTHONPATH = . -[testenv:func] +[testenv:unit] changedir = {toxinidir}/tests/functional +commands = echo "No unit tests available at the moment" +allowlist_externals = echo + +[testenv:func] deps = -r {toxinidir}/tests/functional/requirements.txt commands = functest-run-suite --keep-faulty-model {posargs} @@ -23,7 +27,6 @@ commands = functest-run-suite --keep-faulty-model {posargs} changedir = {toxinidir}/tests/functional deps = -r {toxinidir}/tests/functional/requirements.txt - git+https://github.com/esunar/zaza.git@fix-normalise_action_results#egg=zaza[juju-31] commands = functest-run-suite --keep-faulty-model {posargs} [testenv:func-smoke]