generated from canonical/is-charms-template-repo
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build charms before running the integration tests
- Loading branch information
Showing
2 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Copyright 2023 Canonical Ltd. | ||
# See LICENSE file for licensing details. | ||
|
||
name: Build Charms | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
runs-on: | ||
type: string | ||
description: Image runner for building the images | ||
default: ubuntu-22.04 | ||
working-directory: | ||
type: string | ||
description: The working directory for jobs | ||
default: "./" | ||
|
||
jobs: | ||
build-charms: | ||
name: Build and push charms | ||
runs-on: ${{ inputs.runs-on }} | ||
steps: | ||
- uses: actions/[email protected] | ||
- uses: canonical/[email protected] | ||
- name: Extract charm name | ||
working-directory: ${{ inputs.working-directory }} | ||
run: echo "CHARM_NAME=$([ -f metadata.yaml ] && yq '.name' metadata.yaml || echo UNKNOWN)" >> $GITHUB_ENV | ||
- name: Pack charm | ||
if: ${{ env.CHARM_NAME != 'UNKNOWN' && !cancelled() }} | ||
working-directory: ${{ inputs.working-directory }}/${{ matrix.path }} | ||
run: | | ||
sudo snap install charmcraft --classic --channel latest/stable | ||
charmcraft pack -v | ||
echo "CHARM_FILE=$(ls ${{matrix.name}}_*.charm)" >> $GITHUB_ENV | ||
- name: Upload charm artifact | ||
if: ${{ env.CHARM_NAME != 'UNKNOWN' && !cancelled() }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: charm-artifacts | ||
path: ${{ inputs.working-directory }}/${{ env.CHARM_FILE }} | ||
if-no-files-found: error |
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