-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Building charm in independent step (#136)
- Loading branch information
Showing
8 changed files
with
78 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,26 +10,34 @@ on: | |
|
||
jobs: | ||
check-libraries: | ||
uses: canonical/sdcore-github-workflows/.github/workflows/check-libraries.yaml@v0.0.1 | ||
uses: canonical/sdcore-github-workflows/.github/workflows/check-libraries.yaml@v1.0.0 | ||
secrets: | ||
CHARMCRAFT_AUTH: ${{ secrets.CHARMCRAFT_AUTH }} | ||
|
||
lint-report: | ||
uses: canonical/sdcore-github-workflows/.github/workflows/lint-report.yaml@v0.0.1 | ||
uses: canonical/sdcore-github-workflows/.github/workflows/lint-report.yaml@v1.0.0 | ||
|
||
terraform-check: | ||
uses: canonical/sdcore-github-workflows/.github/workflows/terraform.yaml@v0.0.1 | ||
uses: canonical/sdcore-github-workflows/.github/workflows/terraform.yaml@v1.0.0 | ||
|
||
static-analysis: | ||
uses: canonical/sdcore-github-workflows/.github/workflows/static-analysis.yaml@v0.0.1 | ||
uses: canonical/sdcore-github-workflows/.github/workflows/static-analysis.yaml@v1.0.0 | ||
|
||
unit-tests-with-coverage: | ||
uses: canonical/sdcore-github-workflows/.github/workflows/[email protected] | ||
uses: canonical/sdcore-github-workflows/.github/workflows/[email protected] | ||
|
||
build: | ||
needs: | ||
- lint-report | ||
- static-analysis | ||
- unit-tests-with-coverage | ||
uses: canonical/sdcore-github-workflows/.github/workflows/[email protected] | ||
secrets: inherit | ||
|
||
integration-test: | ||
uses: canonical/sdcore-github-workflows/.github/workflows/[email protected] | ||
with: | ||
charm-file-name: "sdcore-udr-k8s_ubuntu-22.04-amd64.charm" | ||
needs: | ||
- build | ||
uses: canonical/sdcore-github-workflows/.github/workflows/[email protected] | ||
|
||
publish-charm: | ||
name: Publish Charm | ||
|
@@ -39,9 +47,8 @@ jobs: | |
- unit-tests-with-coverage | ||
- integration-test | ||
if: ${{ github.ref_name == 'main' }} | ||
uses: canonical/sdcore-github-workflows/.github/workflows/publish-charm.yaml@v0.0.1 | ||
uses: canonical/sdcore-github-workflows/.github/workflows/publish-charm.yaml@v1.0.0 | ||
with: | ||
charm-file-name: "sdcore-udr-k8s_ubuntu-22.04-amd64.charm" | ||
track-name: 1.5 | ||
secrets: | ||
CHARMCRAFT_AUTH: ${{ secrets.CHARMCRAFT_AUTH }} | ||
|
@@ -54,10 +61,9 @@ jobs: | |
- unit-tests-with-coverage | ||
- integration-test | ||
if: ${{ (github.ref_name != 'main') && (github.event_name == 'push') }} | ||
uses: canonical/sdcore-github-workflows/.github/workflows/publish-charm.yaml@v0.0.1 | ||
uses: canonical/sdcore-github-workflows/.github/workflows/publish-charm.yaml@v1.0.0 | ||
with: | ||
branch-name: ${{ github.ref_name }} | ||
charm-file-name: "sdcore-udr-k8s_ubuntu-22.04-amd64.charm" | ||
track-name: 1.5 | ||
secrets: | ||
CHARMCRAFT_AUTH: ${{ secrets.CHARMCRAFT_AUTH }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env python3 | ||
# Copyright 2024 Canonical Ltd. | ||
# See LICENSE file for licensing details. | ||
|
||
import os | ||
|
||
import pytest | ||
|
||
|
||
def pytest_addoption(parser: pytest.Parser) -> None: | ||
"""Add options to the pytest command line. | ||
This is a pytest hook that is called when the pytest command line is being parsed. | ||
Args: | ||
parser: The pytest command line parser. | ||
""" | ||
parser.addoption( | ||
"--charm_path", | ||
action="store", | ||
default=None, | ||
help="Path to the charm under test" | ||
) | ||
|
||
|
||
def pytest_configure(config: pytest.Config) -> None: | ||
"""Validate the options provided by the user. | ||
This is a pytest hook that is called after command line options have been parsed. | ||
Args: | ||
config: The pytest configuration object. | ||
""" | ||
charm_path = str(config.getoption("--charm_path")) | ||
if not charm_path: | ||
pytest.exit("The --charm_path option is required. Tests aborted.") | ||
if not os.path.exists(charm_path): | ||
pytest.exit(f"The path specified for the charm under test does not exist: {charm_path}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters