Skip to content

feat: optionally install Scenario with ops[testing] and expose the names in ops.testing #3040

feat: optionally install Scenario with ops[testing] and expose the names in ops.testing

feat: optionally install Scenario with ops[testing] and expose the names in ops.testing #3040

name: Hello Charm Tests
on:
push:
branches:
- main
pull_request:
workflow_call:
jobs:
hello-charm-tests:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- charm-repo: jnsgruk/hello-kubecon
commit: dbd133466dde59ee64f20a732a8f3d2e560ec3b8 # 2023-07-03T14:09:38Z
- charm-repo: juju/hello-juju-charm
commit: 046b8ce758660d5aa9cf05207e2370fcbab688d0 # 2021-12-16T10:10:24Z
steps:
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Checkout the ${{ matrix.charm-repo }} repository
uses: actions/checkout@v4
with:
repository: ${{ matrix.charm-repo }}
ref: ${{ matrix.commit }}
- name: Remove 'ops' from charm requirements.txt
run: |
sed -i -e "/^ops[ ><=]/d" -e "/canonical\/operator/d" -e "/#egg=ops/d" requirements.txt
TEST_OPS="git+$GITHUB_SERVER_URL/$GITHUB_REPOSITORY@$GITHUB_SHA#egg=ops"
echo -e "\n${TEST_OPS}" >> requirements.txt
- name: Install dependencies
run: pip install -r requirements-dev.txt
- name: Run the charm tests
run: |
export PYTHONPATH="lib:src:$PYTHONPATH"
python3 -m unittest