-
Notifications
You must be signed in to change notification settings - Fork 3
99 lines (93 loc) · 2.75 KB
/
main.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: CI
on:
push:
jobs:
lint-report:
name: Lint report
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Install tox
run: pip install tox
- name: Run tests using tox
run: tox -e lint
static-analysis:
name: Static analysis
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Install tox
run: pip install tox
- name: Run tests using tox
run: tox -e static
unit-tests-with-coverage:
name: Unit tests
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Install tox
run: pip install tox
- name: Run tests using tox
run: tox -e unit
integration-test:
name: Integration tests
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup LXD
uses: canonical/setup-lxd@main
with:
channel: 5.17/stable
- name: Setup operator environment
uses: charmed-kubernetes/actions-operator@main
with:
provider: microk8s
- name: Run integration tests
run: tox -e integration
- name: Archive Tested Charm
uses: actions/upload-artifact@v3
if: ${{ github.ref_name == 'main' }}
with:
name: tested-charm
path: .tox/**/httpreq-acme-operator_ubuntu-22.04-amd64.charm
retention-days: 5
- name: Archive charmcraft logs
if: failure()
uses: actions/upload-artifact@v3
with:
name: charmcraft-logs
path: /home/runner/.local/state/charmcraft/log/*.log
- name: Archive juju crashdump
if: failure()
uses: actions/upload-artifact@v3
with:
name: juju-crashdump
path: juju-crashdump-*.tar.xz
publish-charm:
name: Publish Charm
needs:
- lint-report
- static-analysis
- unit-tests-with-coverage
- integration-test
runs-on: ubuntu-22.04
if: ${{ github.ref_name == 'main' }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install charmcraft
run: sudo snap install charmcraft --classic
- name: Fetch Tested Charm
uses: actions/download-artifact@v3
with:
name: tested-charm
- name: Move charm in current directory
run: find ./ -name httpreq-acme-operator_ubuntu-22.04-amd64.charm -exec mv -t ./ {} \;
- name: Select Charmhub channel
uses: canonical/charming-actions/[email protected]
id: channel
- name: Upload charm to Charmhub
env:
CHARMCRAFT_AUTH: "${{ secrets.CHARMHUB_TOKEN }}"
run: charmcraft upload ./httpreq-acme-operator_ubuntu-22.04-amd64.charm --release ${{ steps.channel.outputs.name }}