Skip to content

Commit

Permalink
Update workflows to follow latest templates (#43)
Browse files Browse the repository at this point in the history
- remove sonar (we no longer use it)
- update to latest check, promote, and release workflow templates
  • Loading branch information
samuelallan72 authored Aug 19, 2024
1 parent 9a69e1f commit 8701eca
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 56 deletions.
63 changes: 47 additions & 16 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: Check workflow running lint checkers, unit and functional tests
name: Tests

on:
workflow_call:
workflow_dispatch:
pull_request:
types: [ opened, synchronize, reopened ]
branches: [ master, main ]
types: [opened, synchronize, reopened]
branches: [main]
paths-ignore:
- '**.md'
- '**.rst'
- "**.md"
- "**.rst"

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
Expand All @@ -25,18 +25,49 @@ jobs:
python-version: ${{ matrix.python-version }}

func:
uses: canonical/bootstack-actions/.github/workflows/func.yaml@v2
needs: lint-unit
name: functional tests
runs-on: ${{ matrix.runs-on }}
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
include:
- command: "FUNC_ARGS='--series focal' make functional"
- command: "FUNC_ARGS='--series jammy' make functional"
with:
command: ${{ matrix.command }}
juju-channel: "3.4/stable"
nested-containers: false
provider: "lxd"
python-version: "3.10"
timeout-minutes: 120
runs-on: [[ubuntu-latest]]
test-func-args:
- "--series focal"
- "--series jammy"
steps:

- uses: actions/checkout@v4
with:
submodules: true

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Setup Juju environment
uses: charmed-kubernetes/actions-operator@main
with:
provider: "lxd"
juju-channel: "3.4/stable"
charmcraft-channel: "2.x/stable"

- name: Show juju information
run: |
juju version
juju controllers | grep Version -A 1 | awk '{print $9}'
# This is used by zaza in the functional tests for non-amd64 architectures (if applicable)
- name: Set zaza juju model constraints for architecture
run: |
if [ "$(uname -m)" = "aarch64" ]; then
echo "TEST_MODEL_CONSTRAINTS=arch=arm64" >> "$GITHUB_ENV"
fi
- name: Run tests
run: "make functional"
env:
TEST_JUJU3: "1" # https://github.com/openstack-charmers/zaza/pull/653
FUNC_ARGS: ${{ matrix.test-func-args }}
28 changes: 19 additions & 9 deletions .github/workflows/promote.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,35 @@
name: Promote charm to other tracks and channels
name: Promote charm to default track, standard risk levels.

on:
workflow_dispatch:
inputs:
destination-channel:
description: 'Destination Channel, e.g. latest/candidate'
required: true
origin-channel:
description: 'Origin Channel, e.g. latest/edge'
channel-promotion:
description: 'Channel Promotion, e.g. latest/edge -> latest/candidate'
required: true
type: choice
options:
- 'latest/edge -> latest/candidate'
- 'latest/candidate -> latest/stable'

jobs:
promote-charm:
name: Promote charm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set channels
id: set-channels
run: |
channel_promotion="${{ github.event.inputs.channel-promotion }}"
origin=$(echo "$channel_promotion" | sed 's/\s*->.*//')
destination=$(echo "$channel_promotion" | sed 's/.*->\s*//')
echo "destination-channel=$destination" >> $GITHUB_OUTPUT
echo "origin-channel=$origin" >> $GITHUB_OUTPUT
- name: Release charm to channel
uses: canonical/charming-actions/release-charm@2.4.0
uses: canonical/charming-actions/release-charm@2.6.2
with:
credentials: ${{ secrets.CHARMHUB_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
destination-channel: ${{ github.event.inputs.destination-channel }}
origin-channel: ${{ github.event.inputs.origin-channel }}
destination-channel: ${{ steps.set-channels.outputs.destination-channel }}
origin-channel: ${{ steps.set-channels.outputs.origin-channel }}
charmcraft-channel: "2.x/stable"
21 changes: 15 additions & 6 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,26 @@ jobs:

release:
needs: check
runs-on: ubuntu-latest
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
runs-on: [[ubuntu-latest]]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true

- name: Initialize lxd # This should dropped once it's implemented on charming-actions itself. https://github.com/canonical/charming-actions/issues/140
uses: canonical/[email protected]
- name: Upload charm to charmhub
uses: canonical/charming-actions/[email protected]
# revision is latest main at time of writing; using because it contains a fix to https://github.com/canonical/setup-lxd/issues/19
uses: canonical/setup-lxd@2aa6f7caf7d1484298a64192f7f63a6684e648a4

- name: Pack and upload to charmhub
uses: canonical/charming-actions/[email protected]
with:
charmcraft-channel: "2.x/stable"
credentials: "${{ secrets.CHARMHUB_TOKEN }}"
github-token: "${{ secrets.GITHUB_TOKEN }}"
channel: "latest/edge"
# Note(rgildein): Right now we are not using destructive-mode, since our charmcraft.yaml is designed with a single build-on and the ability to run-on multiple bases. Running with destructive-mode would require aligning the base defined in this job with the one defined in charmcraft.yaml (build-on).
# Ensure the charm is built in an isolated environment and on the correct base in an lxd container.
destructive-mode: false
17 changes: 0 additions & 17 deletions .github/workflows/sonar.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions sonar-project.properties

This file was deleted.

0 comments on commit 8701eca

Please sign in to comment.