refactor: fix the testing src-layout structure and use relative imports #2039
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Data Charm Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_call: | |
jobs: | |
db-charm-tests: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- charm-repo: canonical/postgresql-operator | |
commit: 7219d1ed1a118abbfca23aeacf3b7bf67e81a937 # rev480 rev479 2024-09-23T16:12:27Z | |
- charm-repo: canonical/postgresql-k8s-operator | |
commit: 5c2ae046546a7d163b9d040d6a12d1abc0ca1f70 # rev398 rev397 2024-09-24T19:23:37Z | |
- charm-repo: canonical/mysql-operator | |
commit: 9fe60aa9f0a00636e06902d0849d36e1e1525df2 # 2024-09-22 | |
- charm-repo: canonical/mysql-k8s-operator | |
commit: 61db833ba8318773de565d7d9b56031baf3e75f7 # 2024-09-19T11:48:20Z | |
steps: | |
- name: Checkout the ${{ matrix.charm-repo }} repository | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ matrix.charm-repo }} | |
ref: ${{ matrix.commit }} | |
- name: Checkout the operator repository | |
uses: actions/checkout@v4 | |
with: | |
path: myops | |
- name: Install patch dependencies | |
run: pip install poetry~=1.6 | |
- name: Update 'ops' dependency in test charm to latest | |
run: | | |
if [ -e "requirements.txt" ]; then | |
sed -i -e "/^ops[ ><=]/d" -e "/canonical\/operator/d" -e "/#egg=ops/d" requirements.txt | |
echo -e "\ngit+$GITHUB_SERVER_URL/$GITHUB_REPOSITORY@$GITHUB_SHA#egg=ops" >> requirements.txt | |
else | |
sed -i -e "s/^ops[ ><=].*/ops = {path = \"myops\"}/" pyproject.toml | |
poetry lock --no-update | |
fi | |
- name: Install dependencies | |
run: pip install tox~=4.2 | |
- name: Run the charm's unit tests | |
run: tox -vve unit |