Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 59 additions & 54 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
# See LICENSE file for licensing details.
name: Tests

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
workflow_dispatch:
workflow_call:
pull_request:
workflow_call:
schedule:
- cron: "53 0 * * *" # Daily at 00:53 UTC

env:
JUJU_CHANNEL: "3.6/stable"
MICROK8S_CHANNEL: "1.28-strict/stable"
JUJU_BOOTSTRAP_OPTIONS: "--agent-version 3.6.12"

jobs:
lint:
name: Lint
Expand All @@ -24,54 +25,70 @@ jobs:
- name: Install tox
run: pipx install tox
- name: Run linters
run: make lint
run: tox run -e lint

integration-test:
integration-test-terraform:
strategy:
fail-fast: false
max-parallel: 5
max-parallel: 2
matrix:
tests:
- tox-environment: integration-bundle
tls: "true"
- tox-environment: integration-e2e
tls: "false"
- tox-environment: integration-e2e
tls: "true"
- tox-environment: integration-e2e-backup
tls: "false"
tox-environment:
- integration-terraform
kraft-mode:
- single
- multi
juju:
- snap_channel: "3.4/stable"
agent: "3.4.2"
- snap_channel: "3.6/stable"
agent: "3.6.0"
name: ${{ matrix.tests.tox-environment }}_${{ matrix.tests.tls }}_${{ matrix.juju.agent || matrix.juju.snap_channel }}
agent: "3.6.10"
runs-on: [self-hosted, linux, AMD64, X64, xlarge, noble]
name: ${{ matrix.tox-environment }}_${{ matrix.kraft-mode }}_${{ matrix.juju.agent || matrix.juju.snap_channel }}
needs:
- lint
runs-on: ubuntu-22.04
timeout-minutes: 120
steps:
- name: (GitHub hosted) Free up disk space
timeout-minutes: 5
run: |
printf '\nDisk usage before cleanup\n'
df --human-readable
# Based on https://github.com/actions/runner-images/issues/2840#issuecomment-790492173
rm -r /usr/share/dotnet
rm -r /opt/hostedtoolcache/
printf '\nDisk usage after cleanup\n'
df --human-readable
- name: Checkout
uses: actions/checkout@v4
- name: Setup operator environment
uses: charmed-kubernetes/actions-operator@main
with:
juju-channel: ${{ matrix.juju.snap_channel }}
bootstrap-options: "--agent-version ${{ matrix.juju.agent }}"
provider: microk8s
channel: 1.28-strict/stable
microk8s-group: snap_microk8s
microk8s-addons: "hostpath-storage dns"
run: |
sudo snap install concierge --classic
# calico has issues with strict confinements, so remove -strict
sudo snap install microk8s --channel ${MICROK8S_CHANNEL//"-strict"/} --classic
sudo snap install juju --channel $JUJU_CHANNEL

sudo usermod -a -G microk8s $USER
mkdir -p ~/.kube
chmod 0700 ~/.kube

sudo tee /var/snap/microk8s/current/args/certs.d/docker.io/hosts.toml << EOF
server = "$DOCKERHUB_MIRROR"
[host."${DOCKERHUB_MIRROR#'https://'}"]
capabilities = ["pull", "resolve"]
EOF

sudo microk8s stop
sudo microk8s start

# make juju work with microk8s --classic
sudo mkdir -p /var/snap/juju/current/microk8s/credentials
sudo microk8s config | sudo tee /var/snap/juju/current/microk8s/credentials/client.config
sudo chown -R $USER:$USER /var/snap/juju/current/microk8s/credentials

sudo concierge prepare \
-p microk8s \
--microk8s-channel ${MICROK8S_CHANNEL//"-strict"/} \
--juju-channel $JUJU_CHANNEL \
--extra-debs pipx

IP_ADDR=$(ip -4 -j route get 2.2.2.2 | jq -r '.[] | .prefsrc')
sudo microk8s enable dns
sudo microk8s enable hostpath-storage
sudo microk8s enable metallb:$IP_ADDR-$IP_ADDR

pipx ensurepath
pipx install tox poetry
- name: Install terraform snap
run: |
sudo snap install terraform --channel=latest/stable --classic
- name: Select tests
id: select-tests
run: |
Expand All @@ -84,17 +101,5 @@ jobs:
echo "mark_expression=not unstable" >> $GITHUB_OUTPUT
fi
- name: Run integration tests
run: |
if [[ "${{ matrix.tests.tls }}" == "true" ]]; then
FLAGS="--tls"
else
FLAGS=""
fi

make build TLS=${{ matrix.tests.tls }}
echo "======================"
echo "Bundle being deployed:"
echo "======================"
cat build/bundle.yaml
echo "======================"
tox run -e ${{ matrix.tests.tox-environment }} -- -m '${{ steps.select-tests.outputs.mark_expression }}' $FLAGS
run: |
tox run -e ${{ matrix.tox-environment }} -- -m '${{ steps.select-tests.outputs.mark_expression }}' --keep-models --kraft-mode=${{ matrix.kraft-mode }}
97 changes: 0 additions & 97 deletions .github/workflows/ci_e2e.yaml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/workflows/on_bundle_update_available.yaml

This file was deleted.

30 changes: 0 additions & 30 deletions .github/workflows/release.yaml

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ build/
parts/
prime/
stage/
*.tfstate*
.terraform*

Loading