Skip to content

Commit dc031cc

Browse files
committed
feature: github actions for rock test on PR and deploy
1 parent d44c516 commit dc031cc

2 files changed

Lines changed: 65 additions & 0 deletions

File tree

.github/workflows/deploy.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Pack and Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- staging
8+
- charmed-snapcraft-io # TODO: REMOVE THIS
9+
workflow_dispatch:
10+
inputs:
11+
environment:
12+
description: 'Environment (Production or Staging)'
13+
required: true
14+
type: choice
15+
options:
16+
- Production
17+
- Staging
18+
jobs:
19+
setup:
20+
runs-on: ubuntu-latest
21+
environment: ${{ github.event.inputs.environment != '' && github.event.inputs.environment || (github.ref == 'refs/heads/main' && 'Production' || 'Staging') }}
22+
outputs:
23+
charm_name: ${{ steps.setup-vars.outputs.charm_name }}
24+
channel: ${{ steps.setup-vars.outputs.channel }}
25+
juju_controller_name: ${{ steps.setup-vars.outputs.juju_controller_name }}
26+
juju_model_name: ${{ steps.setup-vars.outputs.juju_model_name }}
27+
environment: ${{ steps.setup-vars.outputs.environment }}
28+
steps:
29+
- name: setup vars
30+
id: setup-vars
31+
run: |
32+
echo "charm_name=${{ vars.CHARM_NAME }}" >> $GITHUB_OUTPUT
33+
echo "channel=${{ vars.CHANNEL }}" >> $GITHUB_OUTPUT
34+
echo "juju_controller_name=${{ vars.JUJU_CONTROLLER_NAME }}" >> $GITHUB_OUTPUT
35+
echo "juju_model_name=${{ vars.JUJU_MODEL_NAME }}" >> $GITHUB_OUTPUT
36+
echo "environment=${{ github.event.inputs.environment != '' && github.event.inputs.environment || (github.ref == 'refs/heads/main' && 'Production' || 'Staging') }}" >> $GITHUB_OUTPUT
37+
38+
deploy:
39+
needs: setup
40+
name: Deploy
41+
uses: canonical/webteam-devops/.github/workflows/deploy.yaml@main
42+
with:
43+
environment: ${{ needs.setup.outputs.environment }}
44+
charm_name: ${{ needs.setup.outputs.charm_name }}
45+
channel: ${{ needs.setup.outputs.channel }}
46+
juju_controller_name: ${{ needs.setup.outputs.juju_controller_name }}
47+
juju_model_name: ${{ needs.setup.outputs.juju_model_name }}
48+
secrets:
49+
VAULT_APPROLE_ROLE_ID: ${{ secrets.VAULT_APPROLE_ROLE_ID }}
50+
VAULT_APPROLE_SECRET_ID: ${{ secrets.VAULT_APPROLE_SECRET_ID }}
51+
CHARMHUB_TOKEN: ${{ secrets.CHARMHUB_TOKEN }}

.github/workflows/pr.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,20 @@ jobs:
4040
dotrun &
4141
curl --head --fail --retry-delay 3 --retry 30 --retry-connrefused http://localhost:8004
4242
43+
pack-rock:
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@v4
47+
48+
- name: Setup LXD
49+
uses: canonical/setup-lxd@main
50+
51+
- name: Setup rockcraft
52+
run: sudo snap install rockcraft --classic
53+
54+
- name: Pack rock
55+
run: rockcraft pack
56+
4357
lint-python:
4458
runs-on: ubuntu-latest
4559

0 commit comments

Comments
 (0)