22
22
jobs :
23
23
lint :
24
24
name : Lint
25
- runs-on : ubuntu-latest
26
- timeout-minutes : 5
27
- steps :
28
- - name : Checkout
29
- uses : actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
30
- - name : Install tox
31
- # TODO: Consider replacing with custom image on self-hosted runner OR pinning version
32
- run : python3 -m pip install tox
33
- - name : Run linters
34
- run : tox run -e lint
25
+ uses : canonical/data-platform-workflows/.github/workflows/lint.yaml@v5.1.2
35
26
36
27
unit-test :
37
- name : Unit tests
38
- runs-on : ubuntu-latest
39
- timeout-minutes : 5
28
+ name : Unit test charm
40
29
strategy :
41
30
matrix :
42
31
juju-version :
43
32
- " juju2"
44
33
- " juju3"
34
+ runs-on : ubuntu-latest
35
+ timeout-minutes : 5
45
36
steps :
46
37
- name : Checkout
47
- uses : actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
48
- - name : Install tox
49
- # TODO: Consider replacing with custom image on self-hosted runner OR pinning version
50
- run : python3 -m pip install tox
38
+ uses : actions/checkout@v4
39
+ - name : Install tox & poetry
40
+ run : |
41
+ pipx install tox
42
+ pipx install poetry
51
43
- name : Run tests
52
44
run : tox run -e unit-${{ matrix.juju-version }}
53
45
54
46
build :
55
- name : Build charms
56
- uses : canonical/data-platform-workflows/.github/workflows/build_charms_with_cache.yaml@v2
47
+ name : Build charm
48
+ uses : canonical/data-platform-workflows/.github/workflows/build_charms_with_cache.yaml@v5.1.2
49
+ permissions :
50
+ actions : write # Needed to manage GitHub Actions cache
57
51
58
- integration-test :
52
+ gh-hosted- integration-test :
59
53
strategy :
60
54
fail-fast : false
61
- max-parallel : 6
62
55
matrix :
63
- tox-environments :
56
+ tox-environment :
64
57
- backup-integration
65
58
- charm-integration
66
59
- database-relation-integration
@@ -73,10 +66,17 @@ jobs:
73
66
- tls-integration
74
67
- upgrade-integration
75
68
- upgrade-from-stable-integration
76
- agent-versions :
77
- - " 2.9.45" # renovate: latest juju 2
78
- - " 3.1.6" # renovate: latest juju 3
79
- name : ${{ matrix.tox-environments }} | ${{ matrix.agent-versions }}
69
+ juju-snap-channel : ["2.9/stable", "3.1/stable"]
70
+ include :
71
+ - juju-snap-channel : " 3.1/stable"
72
+ agent-version : " 3.1.6"
73
+ libjuju-version : " 3.2.2"
74
+ exclude-mark : " juju2"
75
+ - juju-snap-channel : " 2.9/stable"
76
+ agent-version : " 2.9.45"
77
+ libjuju-version : " 2.9.45.0"
78
+ exclude-mark : " juju3"
79
+ name : ${{ matrix.juju-snap-channel }} - (GH hosted) ${{ matrix.tox-environment }}
80
80
needs :
81
81
- lint
82
82
- unit-test
@@ -85,41 +85,43 @@ jobs:
85
85
timeout-minutes : 120
86
86
steps :
87
87
- name : Checkout
88
- uses : actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
89
- - name : Set channel
88
+ uses : actions/checkout@v4
89
+ - name : Install tox & poetry
90
90
run : |
91
- juju_channel=$(echo "${{ matrix.agent-versions }}" | cut -c 1-3)
92
- echo "channel=${juju_channel}/stable" >> "$GITHUB_ENV"
93
- juju_major=$(echo "${{ matrix.agent-versions }}" | cut -c 1)
94
- echo "libjuju=juju${juju_major}" >> "$GITHUB_ENV"
91
+ pipx install tox
92
+ pipx install poetry
95
93
- name : Setup operator environment
96
- # TODO: Replace with custom image on self-hosted runner
97
94
uses : charmed-kubernetes/actions-operator@main
98
95
with :
99
96
provider : microk8s
100
97
channel : " 1.28-strict/stable"
101
- bootstrap-options : " --agent-version ${{ matrix.agent-versions }}"
102
- juju-channel : " ${{ env.channel }}"
98
+ bootstrap-options : " --agent-version ${{ matrix.agent-version }}"
99
+ juju-channel : ${{ matrix.juju-snap-channel }}
100
+ - name : Update python-libjuju version
101
+ if : ${{ matrix.juju-snap-channel == '2.9/stable' }}
102
+ run : poetry add --lock --group integration juju@'${{ matrix.libjuju-version }}'
103
103
- name : Download packed charm(s)
104
104
uses : actions/download-artifact@v3
105
105
with :
106
106
name : ${{ needs.build.outputs.artifact-name }}
107
- - name : Select tests
108
- id : select-tests
107
+ - name : Select test stability level
108
+ id : select-test-stability
109
109
run : |
110
- if [ "${{ github.event_name }}" == "schedule" ]
110
+ if [[ "${{ github.event_name }}" == "schedule" ] ]
111
111
then
112
112
echo Running unstable and stable tests
113
- echo "mark_expression=" >> $GITHUB_OUTPUT
113
+ echo "mark_expression=" >> " $GITHUB_OUTPUT"
114
114
else
115
115
echo Skipping unstable tests
116
- echo "mark_expression=and not unstable" >> $GITHUB_OUTPUT
116
+ echo "mark_expression=and not unstable" >> " $GITHUB_OUTPUT"
117
117
fi
118
118
- name : Run integration tests
119
- run : tox run -e ${{ matrix.tox-environments }}-${{ env.libjuju }} -- -m 'not not ${{ env.libjuju }} ${{ steps.select-tests .outputs.mark_expression }}' --keep-models
119
+ run : tox run -e ${{ matrix.tox-environment }} -- -m 'not ${{ matrix.exclude-mark }} ${{ steps.select-test-stability .outputs.mark_expression }}' --keep-models
120
120
env :
121
- AWS_ACCESS_KEY : " ${{ secrets.AWS_ACCESS_KEY }}"
122
- AWS_SECRET_KEY : " ${{ secrets.AWS_SECRET_KEY }}"
123
- GCP_ACCESS_KEY : " ${{ secrets.GCP_ACCESS_KEY }}"
124
- GCP_SECRET_KEY : " ${{ secrets.GCP_SECRET_KEY }}"
125
- CI_PACKED_CHARMS : ${{ needs.build.outputs.charms }}
121
+ SECRETS_FROM_GITHUB : |
122
+ {
123
+ "AWS_ACCESS_KEY": "${{ secrets.AWS_ACCESS_KEY }}",
124
+ "AWS_SECRET_KEY": "${{ secrets.AWS_SECRET_KEY }}",
125
+ "GCP_ACCESS_KEY": "${{ secrets.GCP_ACCESS_KEY }}",
126
+ "GCP_SECRET_KEY": "${{ secrets.GCP_SECRET_KEY }}",
127
+ }
0 commit comments