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@v3
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/[email protected]
35
26
36
27
unit-test :
37
- name : Unit tests
28
+ name : Unit test charm
38
29
runs-on : ubuntu-latest
39
30
timeout-minutes : 5
40
31
steps :
41
32
- name : Checkout
42
- uses : actions/checkout@v3
43
- - name : Install tox
44
- # TODO: Consider replacing with custom image on self-hosted runner OR pinning version
45
- run : python3 -m pip install tox
33
+ uses : actions/checkout@v4
34
+ - name : Install tox & poetry
35
+ run : |
36
+ pipx install tox
37
+ pipx install poetry
46
38
- name : Run tests
47
39
run : tox run -e unit
48
40
- name : Upload Coverage to Codecov
49
41
uses : codecov/codecov-action@v3
50
42
51
43
build :
52
- name : Build charms
53
- uses : canonical/data-platform-workflows/.github/workflows/build_charms_with_cache.yaml@v2
44
+ name : Build charm
45
+ uses :
canonical/data-platform-workflows/.github/workflows/[email protected]
46
+ permissions :
47
+ actions : write # Needed to manage GitHub Actions cache
54
48
55
- integration-test :
49
+ gh-hosted- integration-test :
56
50
strategy :
57
51
fail-fast : false
58
- max-parallel : 6
59
52
matrix :
60
- tox-environments :
53
+ tox-environment :
61
54
- backup-integration
62
55
- charm-integration
56
+ - database-relation-integration
63
57
- db-relation-integration
58
+ - db-admin-relation-integration
64
59
- ha-replication-integration
65
60
- ha-self-healing-integration
66
61
- ha-restore-cluster-integration
@@ -69,22 +64,21 @@ jobs:
69
64
- tls-integration
70
65
- upgrade-integration
71
66
- upgrade-from-stable-integration
72
- agent-versions :
73
- - " 2.9.45 " # renovate: latest juju 2
74
- - " 3.1.6 " # renovate: latest juju 3
75
- free-disk-space :
76
- - false
67
+ juju-snap-channel : ["2.9/stable", "3.1/stable"]
68
+ exclude :
69
+ # Admin tests need landscape on juju 2
70
+ - tox-environment : db-admin-relation-integration
71
+ juju-snap-channel : " 3.1/stable "
77
72
include :
78
- - tox-environments : database-relation-integration
79
- agent-versions : " 2.9.45" # renovate: latest juju 2
80
- free-disk-space : true
81
- - tox-environments : database-relation-integration
82
- agent-versions : " 3.1.6" # renovate: latest juju 3
83
- free-disk-space : true
84
- - tox-environments : db-admin-relation-integration
85
- agent-versions : " 2.9.45" # renovate: latest juju 2
86
- free-disk-space : true
87
- name : ${{ matrix.tox-environments }} | ${{ matrix.agent-versions }}
73
+ - juju-snap-channel : " 3.1/stable"
74
+ agent-version : " 3.1.6"
75
+ libjuju-version : " 3.2.2"
76
+ exclude-mark : " juju2"
77
+ - juju-snap-channel : " 2.9/stable"
78
+ agent-version : " 2.9.45"
79
+ libjuju-version : " 2.9.45.0"
80
+ exclude-mark : " juju3"
81
+ name : ${{ matrix.juju-snap-channel }} - (GH hosted) ${{ matrix.tox-environment }}
88
82
needs :
89
83
- lint
90
84
- unit-test
@@ -93,48 +87,49 @@ jobs:
93
87
timeout-minutes : 120
94
88
steps :
95
89
- name : Checkout
96
- uses : actions/checkout@v3
97
- - name : Free disk space
98
- if : ${{ matrix.free-disk-space == true }}
90
+ uses : actions/checkout@v4
91
+ - name : Install tox & poetry
99
92
run : |
100
- sudo docker rmi $(docker image ls -aq) >/dev/null 2>&1 || true
101
- sudo rm -rf \
102
- /usr/share/dotnet /usr/local/lib/android /opt/ghc \
103
- /usr/local/share/powershell /usr/share/swift /usr/local/.ghcup \
104
- /usr/lib/jvm || true
105
- - name : Set channel
93
+ pipx install tox
94
+ pipx install poetry
95
+ - name : Free up disk space
106
96
run : |
107
- juju_channel=$(echo "${{ matrix.agent-versions }}" | cut -c 1-3)
108
- echo "channel=${juju_channel}/stable" >> "$GITHUB_ENV"
109
- juju_major=$(echo "${{ matrix.agent-versions }}" | cut -c 1)
110
- echo "libjuju=juju${juju_major}" >> "$GITHUB_ENV"
97
+ # From https://github.com/actions/runner-images/issues/2840#issuecomment-790492173
98
+ sudo rm -rf /usr/share/dotnet
99
+ sudo rm -rf /opt/ghc
100
+ sudo rm -rf /usr/local/share/boost
101
+ sudo rm -rf "$AGENT_TOOLSDIRECTORY"
111
102
- name : Setup operator environment
112
- # TODO: Replace with custom image on self-hosted runner
113
103
uses : charmed-kubernetes/actions-operator@main
114
104
with :
115
105
provider : lxd
116
- bootstrap-options : " --agent-version ${{ matrix.agent-versions }}"
117
- juju-channel : " ${{ env.channel }}"
106
+ bootstrap-options : " --agent-version ${{ matrix.agent-version }}"
107
+ juju-channel : ${{ matrix.juju-snap-channel }}
108
+ - name : Update python-libjuju version
109
+ if : ${{ matrix.juju-snap-channel == '2.9/stable' }}
110
+ run : poetry add --lock --group integration juju@'${{ matrix.libjuju-version }}'
118
111
- name : Download packed charm(s)
119
112
uses : actions/download-artifact@v3
120
113
with :
121
114
name : ${{ needs.build.outputs.artifact-name }}
122
- - name : Select tests
123
- id : select-tests
115
+ - name : Select test stability level
116
+ id : select-test-stability
124
117
run : |
125
- if [ "${{ github.event_name }}" == "schedule" ]
118
+ if [[ "${{ github.event_name }}" == "schedule" ] ]
126
119
then
127
120
echo Running unstable and stable tests
128
- echo "mark_expression=" >> $GITHUB_OUTPUT
121
+ echo "mark_expression=" >> " $GITHUB_OUTPUT"
129
122
else
130
123
echo Skipping unstable tests
131
- echo "mark_expression=and not unstable" >> $GITHUB_OUTPUT
124
+ echo "mark_expression=and not unstable" >> " $GITHUB_OUTPUT"
132
125
fi
133
126
- name : Run integration tests
134
- run : tox run -e ${{ matrix.tox-environments }}-${{ env.libjuju }} -- -m 'not not ${{ env.libjuju }} ${{ steps.select-tests .outputs.mark_expression }}' --keep-models
127
+ run : tox run -e ${{ matrix.tox-environment }} -- -m 'not ${{ matrix.exclude-mark }} ${{ steps.select-test-stability .outputs.mark_expression }}' --keep-models
135
128
env :
136
- AWS_ACCESS_KEY : " ${{ secrets.AWS_ACCESS_KEY }}"
137
- AWS_SECRET_KEY : " ${{ secrets.AWS_SECRET_KEY }}"
138
- GCP_ACCESS_KEY : " ${{ secrets.GCP_ACCESS_KEY }}"
139
- GCP_SECRET_KEY : " ${{ secrets.GCP_SECRET_KEY }}"
140
- CI_PACKED_CHARMS : ${{ needs.build.outputs.charms }}
129
+ SECRETS_FROM_GITHUB : |
130
+ {
131
+ "AWS_ACCESS_KEY": "${{ secrets.AWS_ACCESS_KEY }}",
132
+ "AWS_SECRET_KEY": "${{ secrets.AWS_SECRET_KEY }}",
133
+ "GCP_ACCESS_KEY": "${{ secrets.GCP_ACCESS_KEY }}",
134
+ "GCP_SECRET_KEY": "${{ secrets.GCP_SECRET_KEY }}",
135
+ }
0 commit comments