@@ -21,22 +21,24 @@ jobs:
21
21
steps :
22
22
- name : Checkout
23
23
uses : actions/checkout@v3
24
- - name : Install tox
25
- # TODO: Consider replacing with custom image on self-hosted runner OR pinning version
26
- run : python3 -m pip install tox
24
+ - name : Install tox & poetry
25
+ run : |
26
+ pipx install tox
27
+ pipx install poetry
27
28
- name : Run linters
28
29
run : tox run -e lint
29
30
30
31
unit-test :
31
- name : Unit tests
32
+ name : Unit test charm
32
33
runs-on : ubuntu-latest
33
34
timeout-minutes : 5
34
35
steps :
35
36
- name : Checkout
36
37
uses : actions/checkout@v3
37
- - name : Install tox
38
- # TODO: Consider replacing with custom image on self-hosted runner OR pinning version
39
- run : python3 -m pip install tox
38
+ - name : Install tox & poetry
39
+ run : |
40
+ pipx install tox
41
+ pipx install poetry
40
42
- name : Run tests
41
43
run : tox run -e unit
42
44
- name : Upload Coverage to Codecov
@@ -61,57 +63,86 @@ jobs:
61
63
62
64
build :
63
65
name : Build charms
64
- uses : canonical/data-platform-workflows/.github/workflows/build_charms_with_cache.yaml@v2
66
+ uses :
canonical/data-platform-workflows/.github/workflows/[email protected]
67
+ with :
68
+ charmcraft-snap-revision : 1349 # version 2.3.0
65
69
permissions :
66
70
actions : write # Needed to manage GitHub Actions cache
67
71
68
- integration-test :
72
+ gh-hosted-collect-integration-tests :
73
+ name : (GH hosted) Collect integration test groups
74
+ needs :
75
+ - lint
76
+ - unit-test
77
+ runs-on : ubuntu-latest
78
+ steps :
79
+ - name : Checkout
80
+ uses : actions/checkout@v3
81
+ - name : Install tox & poetry
82
+ run : |
83
+ pipx install tox
84
+ pipx install poetry
85
+ - name : Select test stability level
86
+ id : select-test-stability
87
+ run : |
88
+ if [[ "${{ github.event_name }}" == "schedule" ]]
89
+ then
90
+ echo Running unstable and stable tests
91
+ echo "mark_expression=" >> "$GITHUB_OUTPUT"
92
+ else
93
+ echo Skipping unstable tests
94
+ echo "mark_expression=not unstable" >> "$GITHUB_OUTPUT"
95
+ fi
96
+ - name : Collect test groups
97
+ id : collect-groups
98
+ run : tox run -e integration -- tests/integration -m '${{ steps.select-test-stability.outputs.mark_expression }}' --collect-groups
99
+ outputs :
100
+ groups : ${{ steps.collect-groups.outputs.groups }}
101
+
102
+ gh-hosted-integration-test :
69
103
strategy :
70
104
fail-fast : false
71
105
matrix :
72
- tox-environments :
73
- # TODO: uncomment when the following bug is resolved:
74
- # https://bugs.launchpad.net/charm-keystone/+bug/1990243
75
- # - integration-shared-db
76
- - integration-database
106
+ groups : ${{ fromJSON(needs.gh-hosted-collect-integration-tests.outputs.groups) }}
77
107
ubuntu-versions :
78
108
# Update whenever charmcraft.yaml is changed
79
109
- series : focal
80
110
bases-index : 0
81
111
- series : jammy
82
112
bases-index : 1
83
- name : ${{ matrix.tox-environments }} | ${{ matrix.ubuntu-versions.series }}
113
+ name : (GH hosted) ${{ matrix.groups.job_name }} | ${{ matrix.ubuntu-versions.series }}
84
114
needs :
85
115
- lint
86
116
- unit-test
87
117
- build
118
+ - gh-hosted-collect-integration-tests
88
119
runs-on : ubuntu-latest
89
120
timeout-minutes : 120
90
121
steps :
91
122
- name : Checkout
92
123
uses : actions/checkout@v3
124
+ - name : Install tox & poetry
125
+ run : |
126
+ pipx install tox
127
+ pipx install poetry
93
128
- name : Setup operator environment
94
- # TODO: Replace with custom image on self-hosted runner
95
129
uses : charmed-kubernetes/actions-operator@main
96
130
with :
97
131
provider : lxd
98
- bootstrap-options : " --agent-version 2.9.42"
99
132
- name : Download packed charm(s)
100
133
uses : actions/download-artifact@v3
101
134
with :
102
135
name : ${{ needs.build.outputs.artifact-name }}
103
- - name : Select tests
104
- id : select-tests
136
+ - name : Select test stability level
137
+ id : select-test-stability
105
138
run : |
106
- if [ "${{ github.event_name }}" == "schedule" ]
139
+ if [[ "${{ github.event_name }}" == "schedule" ] ]
107
140
then
108
141
echo Running unstable and stable tests
109
- echo "mark_expression=" >> $GITHUB_OUTPUT
142
+ echo "mark_expression=" >> " $GITHUB_OUTPUT"
110
143
else
111
144
echo Skipping unstable tests
112
- echo "mark_expression=not unstable" >> $GITHUB_OUTPUT
145
+ echo "mark_expression=not unstable" >> " $GITHUB_OUTPUT"
113
146
fi
114
147
- name : Run integration tests
115
- run : tox run -e ${{ matrix.tox-environments }} -- -m '${{ steps.select-tests.outputs.mark_expression }}' --mysql-router-charm-series=${{ matrix.ubuntu-versions.series }} --mysql-router-charm-bases-index=${{ matrix.ubuntu-versions.bases-index }}
116
- env :
117
- CI_PACKED_CHARMS : ${{ needs.build.outputs.charms }}
148
+ run : tox run -e integration -- "${{ matrix.groups.path_to_test_file }}" --group="${{ matrix.groups.group_number }}" -m '${{ steps.select-test-stability.outputs.mark_expression }}' --mysql-router-charm-series=${{ matrix.ubuntu-versions.series }} --mysql-router-charm-bases-index=${{ matrix.ubuntu-versions.bases-index }}
0 commit comments