Skip to content

Commit

Permalink
Migrate build to ubuntu 22 04 (#12)
Browse files Browse the repository at this point in the history
* define bundles

* update readme

* migrate build to ubuntu 22.04

* update charmcratf.yaml

* update publishing job

* use ubuntu-latest for unit,fmt,lint

* support linting

* migrate setting output

* bump action version

* bump publish actions versions
  • Loading branch information
RafalSiwek authored Feb 22, 2024
1 parent c4d7139 commit c135d40
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 19 deletions.
16 changes: 7 additions & 9 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ on:
jobs:
lib-check:
name: Check libraries
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check libs
Expand All @@ -28,7 +28,7 @@ jobs:

steps:
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install dependencies
run: sudo apt-get install python3-pip tox
Expand All @@ -38,11 +38,11 @@ jobs:

unit:
name: Unit Test
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install dependencies
run: sudo apt-get install python3-pip tox
Expand All @@ -52,7 +52,7 @@ jobs:

integration:
name: Integration tests (microk8s)
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Workflow Telemetry
uses: catchpoint/workflow-telemetry-action@v1.8.7
Expand All @@ -67,7 +67,7 @@ jobs:
remove-android: "true"
remove-codeql: "true"
remove-docker-images: "true"
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup operator environment
uses: charmed-kubernetes/actions-operator@1.1.0
with:
Expand All @@ -82,11 +82,9 @@ jobs:
# On failure, capture debugging resources
- name: Get all
run: kubectl get all -A
if: failure()

- name: Get juju status
run: juju status
if: failure()

- name: Get juju debug logs
run: juju debug-log --limit 100
Expand Down
89 changes: 83 additions & 6 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,92 @@
# reusable workflow for publishing all charms in this repo
# reusable workflow for publishing all charms in a repo
name: Publish

on:
workflow_call:
inputs:
source_branch:
description: Github branch from this repo to publish. If blank, will use the default branch
default: ""
required: false
type: string
secrets:
CHARMCRAFT_CREDENTIALS:
required: true
workflow_dispatch:
inputs:
destination_channel:
description: CharmHub channel to publish to
required: false
default: "latest/edge"
type: string
source_branch:
description: Github branch from this repo to publish. If blank, will use the default branch
required: false
default: ""
type: string

jobs:
publish:
name: Publish
uses: canonical/charmed-kubeflow-workflows/.github/workflows/_publish.yaml@main
secrets:
CHARMCRAFT_CREDENTIALS: ${{ secrets.CHARMCRAFT_CREDENTIALS }}
get-charm-paths:
# forks don't have access to keyrings and cannot publish, we just skip these jobs from forks
if: github.event.pull_request.head.repo.fork == false

name: Generate the Charm Matrix content (bash)
runs-on: ubuntu-22.04
outputs:
charm_paths: ${{ steps.get-charm-paths.outputs.charm-paths }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get paths for all charms in this repo
id: get-charm-paths
uses: ca-scribner/github-actions-recipes/get-charm-paths@master

publish-charm:
name: Publish Charm
runs-on: ubuntu-22.04
needs: get-charm-paths
strategy:
fail-fast: false
matrix:
charm-path: ${{ fromJson(needs.get-charm-paths.outputs.charm_paths) }}

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ inputs.source_branch }}

- name: Select charmhub channel
uses: canonical/charming-actions/channel@2.4.0
id: select-channel
if: ${{ inputs.destination_channel == '' }}

# Combine inputs from different sources to a single canonical value so later steps don't
# need logic for picking the right one
- name: Parse and combine inputs
id: parse-inputs
run: |
# destination_channel
destination_channel="${{ inputs.destination_channel || steps.select-channel.outputs.name }}"
echo "setting output of destination_channel=$destination_channel"
echo "destination_channel=$destination_channel" >> $GITHUB_OUTPUT
# tag_prefix
# if charm_path = ./ --> tag_prefix = '' (null)
# if charm_path != ./some-charm (eg: a charm in a ./charms dir) --> tag_prefix = 'some-charm'
if [ ${{ matrix.charm-path }} == './' ]; then
tag_prefix=''
else
tag_prefix=$(basename ${{ matrix.charm-path }} )
fi
echo "setting output of tag_prefix=$tag_prefix"
echo "tag_prefix=$tag_prefix" >> $GITHUB_OUTPUT
- name: Upload charm to charmhub
uses: canonical/charming-actions/upload-charm@2.4.0
with:
credentials: ${{ secrets.CHARMCRAFT_CREDENTIALS }}
github-token: ${{ secrets.GITHUB_TOKEN }}
charm-path: ${{ matrix.charm-path }}
channel: ${{ steps.parse-inputs.outputs.destination_channel }}
tag-prefix: ${{ steps.parse-inputs.outputs.tag_prefix }}
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
jobs:
promote-charm:
name: Promote charm
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Release charm to channel
Expand Down
6 changes: 3 additions & 3 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
type: "charm"
type: charm
bases:
- build-on:
- name: "ubuntu"
channel: "20.04"
channel: "22.04"
run-on:
- name: "ubuntu"
channel: "20.04"
channel: "22.04"
parts:
charm:
charm-python-packages: [setuptools, pip]

0 comments on commit c135d40

Please sign in to comment.