-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
152 additions
and
9 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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
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,47 @@ | ||
# This file is centrally managed as a template file in https://github.com/canonical/solutions-engineering-automation | ||
# To update the file: | ||
# - Edit it in the canonical/solutions-engineering-automation repository. | ||
# - Open a PR with the changes. | ||
# - When the PR merges, the soleng-terraform bot will open a PR to the target repositories with the changes. | ||
name: Tests | ||
|
||
on: | ||
workflow_call: | ||
workflow_dispatch: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
branches: [main] | ||
paths-ignore: | ||
- "**.md" | ||
- "**.rst" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Complete git history is required to generate the version from git tags. | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt update | ||
sudo apt install -y yamllint | ||
- name: Lint yaml files | ||
run: | | ||
yamllint .yamllint snap/snapcraft.yaml | ||
build: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Complete git history is required to generate the version from git tags. | ||
|
||
- name: Verify snap builds successfully | ||
uses: snapcore/action-build@v1 |
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,48 @@ | ||
# This file is centrally managed as a template file in https://github.com/canonical/solutions-engineering-automation | ||
# To update the file: | ||
# - Edit it in the canonical/solutions-engineering-automation repository. | ||
# - Open a PR with the changes. | ||
# - When the PR merges, the soleng-terraform bot will open a PR to the target repositories with the changes. | ||
name: Promote snap to default track, standard risk levels. | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
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-snap: | ||
name: Promote snap | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Snapcraft install | ||
run: sudo snap install --classic snapcraft | ||
- name: Get snap name | ||
id: snap | ||
run: echo "name=$(awk '/^name:/ {print $2}' snap/snapcraft.yaml)" >> "$GITHUB_OUTPUT" | ||
- 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: Snapcraft promote snap | ||
env: | ||
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }} | ||
SNAPCRAFT_HAS_TTY: "true" # this is necessary because snapcraft will not allow --yes for promotions of the edge channel https://github.com/canonical/snapcraft/issues/4439 | ||
run: | | ||
# Note: using `yes |` instead of `--yes` because snapcraft will | ||
# refuse to non-interactively promote a snap from the edge | ||
# channel if it is done without any branch qualifiers | ||
yes | snapcraft promote ${{ steps.snap.outputs.name }} \ | ||
--from-channel ${{ steps.set-channels.outputs.origin-channel }} \ | ||
--to-channel ${{ steps.set-channels.outputs.destination-channel }} |
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,39 @@ | ||
# This file is centrally managed as a template file in https://github.com/canonical/solutions-engineering-automation | ||
# To update the file: | ||
# - Edit it in the canonical/solutions-engineering-automation repository. | ||
# - Open a PR with the changes. | ||
# - When the PR merges, the soleng-terraform bot will open a PR to the target repositories with the changes. | ||
name: Publish snap | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
release: | ||
types: [ published ] | ||
|
||
jobs: | ||
check: | ||
uses: ./.github/workflows/check.yaml | ||
secrets: inherit | ||
|
||
release: | ||
runs-on: ubuntu-22.04 | ||
needs: check | ||
outputs: | ||
snap: ${{ steps.build.outputs.snap }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Complete git history is required to generate the version from git tags. | ||
- uses: snapcore/action-build@v1 | ||
id: build | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: snap | ||
path: ${{ steps.build.outputs.snap }} | ||
- uses: snapcore/action-publish@v1 | ||
env: | ||
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }} | ||
with: | ||
snap: ${{ steps.build.outputs.snap }} | ||
release: latest/edge |
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,5 @@ | ||
extends: default | ||
|
||
rules: | ||
line-length: disable | ||
document-start: disable |
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