Add base structure for testing of statuses from real cloud #636
Workflow file for this run
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
name: Check workflow running linter, unit and functional tests | |
on: | |
workflow_call: | |
workflow_dispatch: | |
pull_request: | |
types: [ opened, synchronize, reopened ] | |
branches: [ master, main ] | |
paths-ignore: | |
- '**.md' | |
- '**.rst' | |
concurrency: | |
# We do not want to run multiple jobs for single PR. | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
lint-unit: | |
name: Lint checkers and Unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install tox | |
- name: Run lint checkers | |
run: tox -e lint | |
- name: Run unit tests | |
run: tox -e unit | |
- name: Save PR number to file | |
run: echo ${{ github.event.number }} > PR_NUMBER.txt | |
- name: Archive PR number | |
uses: actions/upload-artifact@v4 | |
with: | |
name: PR_NUMBER | |
path: PR_NUMBER.txt | |
- name: Archive code coverage results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-report | |
path: ./tests/unit/report/coverage.xml | |
mocked-plans: | |
name: Mocked plans tests | |
needs: lint-unit | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install tox | |
- name: Run mocked-plans tests | |
run: tox -e mocked-plans | |
snap-build: | |
name: Build snap package | |
needs: lint-unit | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install tox | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install tox | |
- name: Setup LXD | |
uses: canonical/[email protected] | |
with: | |
channel: latest/stable | |
- name: Install snapcraft | |
run: sudo snap install snapcraft --classic | |
- name: Build snap | |
run: make build | |
- name: Upload the built snap as an artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: SNAP_FILE | |
path: charmed-openstack-upgrader.snap | |
func: | |
name: Functional tests | |
needs: snap-build | |
runs-on: ubuntu-latest | |
timeout-minutes: 120 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Setup Juju 2.9/stable environment | |
uses: charmed-kubernetes/actions-operator@main | |
with: | |
provider: lxd | |
juju-channel: 2.9/stable | |
- name: Remove tox install by actions-operator | |
run: sudo apt remove tox -y | |
- name: Install tox | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install tox | |
- name: Download snap file artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: SNAP_FILE | |
- name: Run func tests | |
run: TEST_SNAP=$GITHUB_WORKSPACE/charmed-openstack-upgrader.snap tox -e func |