1
+ # Copyright 2022 Canonical Ltd.
2
+ # See LICENSE file for licensing details.
1
3
name : Tests
4
+
2
5
on :
3
6
pull_request :
7
+ schedule :
8
+ - cron : ' 53 0 * * *' # Daily at 00:53 UTC
9
+ # Triggered on push to branch "main" by .github/workflows/release.yaml
4
10
workflow_call :
5
11
6
12
jobs :
@@ -10,136 +16,74 @@ jobs:
10
16
steps :
11
17
- name : Checkout
12
18
uses : actions/checkout@v3
13
- - name : Install dependencies
19
+ - name : Install tox
20
+ # TODO: Consider replacing with custom image on self-hosted runner OR pinning version
14
21
run : python3 -m pip install tox
15
22
- name : Run linters
16
- run : tox -e lint
23
+ run : tox run -e lint
17
24
18
25
unit-test :
19
26
name : Unit tests
20
27
runs-on : ubuntu-latest
21
28
steps :
22
29
- name : Checkout
23
30
uses : actions/checkout@v3
24
- - name : Install dependencies
25
- run : python -m pip install tox
31
+ - name : Install tox
32
+ # TODO: Consider replacing with custom image on self-hosted runner OR pinning version
33
+ run : python3 -m pip install tox
26
34
- name : Run tests
27
- run : tox -e unit
35
+ run : tox run -e unit
28
36
- name : Upload Coverage to Codecov
29
37
uses : codecov/codecov-action@v3
30
38
31
- integration-test-lxd-charm :
32
- name : Integration tests for charm deployment (lxd)
33
- needs :
34
- - lint
35
- - unit-test
36
- runs-on : ubuntu-latest
37
- steps :
38
- - name : Checkout
39
- uses : actions/checkout@v3
40
- - name : Setup operator environment
41
- uses : charmed-kubernetes/actions-operator@main
42
- with :
43
- provider : lxd
44
- - name : Run integration tests
45
- run : tox -e charm-integration
46
-
47
- integration-test-lxd-database-relation :
48
- name : Integration tests for database relation (lxd)
49
- needs :
50
- - lint
51
- - unit-test
52
- runs-on : ubuntu-latest
53
- steps :
54
- - name : Checkout
55
- uses : actions/checkout@v3
56
- - name : Setup operator environment
57
- uses : charmed-kubernetes/actions-operator@main
58
- with :
59
- provider : lxd
60
- # This is needed until https://bugs.launchpad.net/juju/+bug/1992833 is fixed.
61
- bootstrap-options : " --agent-version 2.9.34"
62
- - name : Run integration tests
63
- run : tox -e database-relation-integration
64
-
65
- integration-test-lxd-db-relation :
66
- name : Integration tests for db relation (lxd)
67
- needs :
68
- - lint
69
- - unit-test
70
- runs-on : ubuntu-latest
71
- steps :
72
- - name : Checkout
73
- uses : actions/checkout@v3
74
- - name : Setup operator environment
75
- uses : charmed-kubernetes/actions-operator@main
76
- with :
77
- provider : lxd
78
- - name : Run integration tests
79
- run : tox -e db-relation-integration
80
-
81
- integration-test-lxd-db-admin-relation :
82
- name : Integration tests for db-admin relation (lxd)
83
- needs :
84
- - lint
85
- - unit-test
86
- runs-on : ubuntu-latest
87
- steps :
88
- - name : Checkout
89
- uses : actions/checkout@v3
90
- - name : Setup operator environment
91
- uses : charmed-kubernetes/actions-operator@main
92
- with :
93
- provider : lxd
94
- - name : Run integration tests
95
- run : tox -e db-admin-relation-integration
39
+ build :
40
+ name : Build charms
41
+ uses : canonical/data-platform-workflows/.github/workflows/build_charms_with_cache.yaml@v1
96
42
97
- integration-test-ha-self-healing-rotation :
98
- name : Integration tests for high availability self healing (lxd)
43
+ integration-test :
44
+ strategy :
45
+ fail-fast : false
46
+ matrix :
47
+ tox-environments :
48
+ - charm-integration
49
+ - database-relation-integration
50
+ - db-relation-integration
51
+ - db-admin-relation-integration
52
+ - ha-self-healing-integration
53
+ - password-rotation-integration
54
+ - tls-integration
55
+ name : ${{ matrix.tox-environments }}
99
56
needs :
100
57
- lint
101
58
- unit-test
59
+ - build
102
60
runs-on : ubuntu-latest
103
61
steps :
104
62
- name : Checkout
105
63
uses : actions/checkout@v3
106
64
- name : Setup operator environment
65
+ # TODO: Replace with custom image on self-hosted runner
107
66
uses : charmed-kubernetes/actions-operator@main
108
67
with :
109
68
provider : lxd
110
69
# This is needed until https://bugs.launchpad.net/juju/+bug/1992833 is fixed.
111
70
bootstrap-options : " --agent-version 2.9.34"
112
- - name : Run integration tests
113
- run : tox -e ha-self-healing-integration
114
-
115
- integration-test-lxd-password-rotation :
116
- name : Integration tests for password rotation (lxd)
117
- needs :
118
- - lint
119
- - unit-test
120
- runs-on : ubuntu-latest
121
- steps :
122
- - name : Checkout
123
- uses : actions/checkout@v3
124
- - name : Setup operator environment
125
- uses : charmed-kubernetes/actions-operator@main
126
- with :
127
- provider : lxd
128
- - name : Run integration tests
129
- run : tox -e password-rotation-integration
130
-
131
- integration-test-lxd-tls :
132
- name : Integration tests for TLS (lxd)
133
- needs :
134
- - lint
135
- - unit-test
136
- runs-on : ubuntu-latest
137
- steps :
138
- - name : Checkout
139
- uses : actions/checkout@v3
140
- - name : Setup operator environment
141
- uses : charmed-kubernetes/actions-operator@main
71
+ - name : Download packed charm(s)
72
+ uses : actions/download-artifact@v3
142
73
with :
143
- provider : lxd
74
+ name : ${{ needs.build.outputs.artifact-name }}
75
+ - name : Select tests
76
+ id : select-tests
77
+ run : |
78
+ if [ "${{ github.event_name }}" == "schedule" ]
79
+ then
80
+ echo Running unstable and stable tests
81
+ echo "mark_expression=" >> $GITHUB_OUTPUT
82
+ else
83
+ echo Skipping unstable tests
84
+ echo "mark_expression=not unstable" >> $GITHUB_OUTPUT
85
+ fi
144
86
- name : Run integration tests
145
- run : tox -e tls-integration
87
+ run : tox run -e ${{ matrix.tox-environments }} -- -m '${{ steps.select-tests.outputs.mark_expression }}'
88
+ env :
89
+ CI_PACKED_CHARMS : ${{ needs.build.outputs.charms }}
0 commit comments