Update GitHub actions (8/edge) #1102
This file contains hidden or 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: Run tests | |
| on: | |
| pull_request: | |
| schedule: | |
| - cron: "53 0 * * *" # Daily at 00:53 UTC | |
| workflow_dispatch: | |
| workflow_call: | |
| jobs: | |
| pre-commit: | |
| name: Run pre-commits | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| - name: Install tox & poetry | |
| run: | | |
| pipx install tox poetry | |
| - name: Set up python environment | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.14" | |
| cache: "poetry" | |
| - name: Install deps | |
| run: | | |
| sudo apt update | |
| sudo apt install -y build-essential python3-dev libldap-dev libsasl2-dev | |
| - name: Install pre-commit | |
| run: | | |
| poetry install | |
| poetry run pre-commit install | |
| - name: Run pre-commit hooks | |
| run: | | |
| poetry run pre-commit run --all-files | |
| check-pyproject-dynamic-versioning: | |
| name: Poetry dynamic versioning check | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| - name: Install deps | |
| run: sudo snap install yq | |
| - name: Check versioning | |
| run: | | |
| VERSION=$(yq -p toml -oy '.tool.poetry.version' ./pyproject.toml) | |
| DYNAMIC_FIELDS=$(yq -p toml -oc '.project.dynamic' ./pyproject.toml) | |
| if [[ $VERSION != *"0.0.0"* ]] | |
| then | |
| exit 1 | |
| fi | |
| if [[ $DYNAMIC_FIELDS != *"version"* ]] | |
| then | |
| exit 1 | |
| fi | |
| actionlint: | |
| name: Lint .github/workflows/ | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install actionlint | |
| id: install | |
| run: | | |
| curl -O https://raw.githubusercontent.com/rhysd/actionlint/main/.github/actionlint-matcher.json | |
| echo "::add-matcher::actionlint-matcher.json" | |
| bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) | |
| - name: Run actionlint | |
| run: | | |
| '${{ steps.install.outputs.executable }}' -color | |
| lib-check: | |
| name: Check libraries | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check libs | |
| uses: canonical/charming-actions/check-libraries@2.7.0 | |
| continue-on-error: true | |
| with: | |
| charm-path: ./single_kernel_mongo/ | |
| credentials: ${{ secrets.CHARMHUB_TOKEN }} | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| permissions: | |
| pull-requests: write | |
| tox-lint: | |
| name: tox run -e lint | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install tox & poetry | |
| run: | | |
| pipx install tox poetry | |
| - name: Set up python environment | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.14" | |
| cache: "poetry" | |
| - name: Install deps | |
| run: | | |
| sudo apt update | |
| sudo apt install -y build-essential python3-dev libldap-dev libsasl2-dev | |
| - name: Run linters | |
| run: tox run -e lint | |
| unit-test: | |
| strategy: | |
| matrix: | |
| env: | |
| - lxd | |
| - microk8s | |
| name: Unit test charm (${{ matrix.env }}) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Install tox & poetry | |
| run: | | |
| pipx install tox poetry | |
| - name: Set up python environment | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.14" | |
| cache: "poetry" | |
| - name: Install deps | |
| run: | | |
| sudo apt update | |
| sudo apt install -y build-essential python3-dev libldap-dev libsasl2-dev | |
| - name: Run tests | |
| run: tox run -e unit-${{ matrix.env }} |