Merge pull request #9 from canonical/renovate/actions-checkout-4.x #26
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: CI | |
on: | |
push: | |
jobs: | |
lint-report: | |
name: Lint report | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install tox | |
run: pip install tox | |
- name: Run tests using tox | |
run: tox -e lint | |
static-analysis: | |
name: Static analysis | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install tox | |
run: pip install tox | |
- name: Run tests using tox | |
run: tox -e static | |
unit-tests-with-coverage: | |
name: Unit tests | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install tox | |
run: pip install tox | |
- name: Run tests using tox | |
run: tox -e unit | |
integration-test: | |
name: Integration tests | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup LXD | |
uses: canonical/setup-lxd@main | |
with: | |
channel: 5.17/stable | |
- name: Setup operator environment | |
uses: charmed-kubernetes/actions-operator@main | |
with: | |
provider: microk8s | |
- name: Run integration tests | |
run: tox -e integration | |
- name: Archive Tested Charm | |
uses: actions/upload-artifact@v3 | |
if: ${{ github.ref_name == 'main' }} | |
with: | |
name: tested-charm | |
path: .tox/**/httpreq-acme-operator_ubuntu-22.04-amd64.charm | |
retention-days: 5 | |
- name: Archive charmcraft logs | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: charmcraft-logs | |
path: /home/runner/.local/state/charmcraft/log/*.log | |
- name: Archive juju crashdump | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: juju-crashdump | |
path: juju-crashdump-*.tar.xz | |
publish-charm: | |
name: Publish Charm | |
needs: | |
- lint-report | |
- static-analysis | |
- unit-tests-with-coverage | |
- integration-test | |
runs-on: ubuntu-22.04 | |
if: ${{ github.ref_name == 'main' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install charmcraft | |
run: sudo snap install charmcraft --classic | |
- name: Fetch Tested Charm | |
uses: actions/download-artifact@v3 | |
with: | |
name: tested-charm | |
- name: Move charm in current directory | |
run: find ./ -name httpreq-acme-operator_ubuntu-22.04-amd64.charm -exec mv -t ./ {} \; | |
- name: Select Charmhub channel | |
uses: canonical/charming-actions/[email protected] | |
id: channel | |
- name: Upload charm to Charmhub | |
env: | |
CHARMCRAFT_AUTH: "${{ secrets.CHARMHUB_TOKEN }}" | |
run: charmcraft upload ./httpreq-acme-operator_ubuntu-22.04-amd64.charm --release ${{ steps.channel.outputs.name }} |