Rework freezing CI #1
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: Periodic integration matrix tests | |
on: | |
schedule: | |
# every Wednesday at 02:00 | |
- cron: '0 02 * * WED' | |
workflow_dispatch: | |
jobs: | |
render-freeze-bundle: | |
name: Render and freeze bundle | |
# We render and freeze at the start to avoid possible races, in case a new charm was release | |
# while these tests are still running. | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Render and freeze bundle | |
env: | |
CHARMHUB_TOKEN: "${{ secrets.CHARMHUB_TOKEN }}" | |
run: | | |
tox -e render-edge | |
python3 freeze_bundle.py bundle.yaml > bundle.yaml | |
- name: Upload bundle as artifact to be used by the next job | |
uses: actions/upload-artifact@v3 | |
with: | |
name: bundle-edge | |
path: bundle.yaml | |
integration-matrix: | |
name: Matrix tests for edge charms | |
needs: [ render-freeze-bundle ] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
charm-channel: [ "edge", "beta", "candidate", "stable" ] | |
juju-track: [ "3.1", "3.4" ] | |
microk8s-channel: [ "1.27-strict/stable", "1.28-strict/stable" ] | |
include: | |
- juju-track: "3.1" | |
juju-channel: "3.1/stable" | |
juju-agent-version: "3.1.7" | |
- juju-track: "3.4" | |
juju-channel: "3.4/stable" | |
juju-agent-version: "3.4.0" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get prefsrc | |
run: | | |
echo "IPADDR=$(ip -4 -j route get 2.2.2.2 | jq -r '.[] | .prefsrc')" >> $GITHUB_ENV | |
- name: Setup operator environment | |
uses: charmed-kubernetes/actions-operator@main | |
with: | |
juju-channel: ${{ matrix.juju-channel }} | |
provider: microk8s | |
channel: ${{ matrix.microk8s-channel }} | |
microk8s-addons: "hostpath-storage dns metallb:${{ env.IPADDR }}-${{ env.IPADDR }}" | |
bootstrap-options: "--agent-version ${{ matrix.juju-agent-version }}" | |
- name: Update python-libjuju dependency to match juju version | |
# Assuming the dep is given on a separate tox.ini line | |
run: sed -E -i 's/^\s*juju\s*~=.+/ juju~=${{ matrix.juju-track }}.0/g' tox.ini | |
- uses: actions/download-artifact@v3 | |
with: | |
name: bundle-edge | |
- name: Run tests (juju ${{ matrix.juju-channel }}, microk8s ${{ matrix.microk8s-channel }}) | |
run: tox -e integration -- --channel=edge | |
- name: Dump logs | |
if: failure() | |
uses: canonical/observability/.github/workflows/_dump-logs.yaml@feature/dump_logs_helper | |
release-pinned-bundle: | |
name: Release pinned bundle | |
needs: [ integration-matrix ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: bundle-edge | |
- name: Upload bundle to edge | |
uses: canonical/charming-actions/[email protected] | |
with: | |
channel: "pinned/edge" | |
credentials: "${{ secrets.CHARMHUB_TOKEN }}" | |
github-token: "${{ secrets.GITHUB_TOKEN }}" |