Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test pulling ops-scenario into ops with history #6

Merged
merged 689 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
689 commits
Select commit Hold shift + click to select a range
d8de741
added docs and more tests
PietroPasotti Nov 15, 2023
b080045
vbump
PietroPasotti Nov 15, 2023
b2b6812
Update README.md
PietroPasotti Nov 16, 2023
30930b5
Update README.md
PietroPasotti Nov 16, 2023
70bb022
Merge pull request #78 from canonical/collect-status-support
PietroPasotti Nov 16, 2023
f149b86
Merge remote-tracking branch 'origin/main' into remove-scripts
PietroPasotti Nov 16, 2023
a3dcd2c
vbump
PietroPasotti Nov 16, 2023
4eac4a5
snapshot warning
PietroPasotti Nov 16, 2023
1c0ff40
fix falsy config defaults
PietroPasotti Nov 16, 2023
f5ac9c8
Merge pull request #80 from canonical/fix-falsy-config-defaults
PietroPasotti Nov 16, 2023
89bc81a
fix secret id canonicalization
PietroPasotti Nov 17, 2023
806a4f4
vbump
PietroPasotti Nov 17, 2023
a6d8efe
Merge remote-tracking branch 'origin/main' into fix-secret-id-canonical
PietroPasotti Nov 17, 2023
e0019f9
vbump
PietroPasotti Nov 17, 2023
31ab9dd
Merge pull request #82 from canonical/fix-secret-id-canonical
PietroPasotti Nov 17, 2023
ae4a8ee
added container fs temporary dir cleanup in Context.clear() --> Conte…
PietroPasotti Nov 17, 2023
b13405b
vbump
PietroPasotti Nov 17, 2023
b2fd95d
Merge remote-tracking branch 'origin/main' into remove-scripts
PietroPasotti Nov 20, 2023
7a4e2cb
Merge pull request #77 from canonical/remove-scripts
PietroPasotti Nov 20, 2023
a8bb04d
uniformed owner 'application'-->'app'
PietroPasotti Nov 20, 2023
43e2b12
lint
PietroPasotti Nov 20, 2023
33cf4ad
factored in ownership
PietroPasotti Nov 20, 2023
0aab2af
some more tests and metadata rule fixes
PietroPasotti Nov 21, 2023
9633380
simplified access control logic
PietroPasotti Nov 22, 2023
811e8ea
Merge branch 'main' into cleanup-container-fs
PietroPasotti Nov 22, 2023
2789c0a
Merge pull request #85 from canonical/cleanup-container-fs
PietroPasotti Nov 22, 2023
25935db
stripped 'granted'
PietroPasotti Nov 22, 2023
0b89543
Doc fixes
PietroPasotti Nov 22, 2023
9100d1b
BC
PietroPasotti Nov 22, 2023
0dea321
extra bindings and network model rework
PietroPasotti Nov 29, 2023
f76cc74
tolerate dead relations
PietroPasotti Nov 29, 2023
d02b8bb
re-rework
PietroPasotti Nov 30, 2023
9cd044f
pyright precommit
PietroPasotti Nov 30, 2023
9928aa9
readme
PietroPasotti Nov 30, 2023
d9c8dd0
rolled back precommit config
PietroPasotti Dec 4, 2023
175b910
fixed tests
PietroPasotti Dec 5, 2023
4669fc1
fixed tests
PietroPasotti Dec 5, 2023
bd28d79
pr comments
PietroPasotti Dec 5, 2023
3af35d0
fixed network tests
PietroPasotti Dec 5, 2023
958d068
Merge pull request #88 from canonical/extra-bindings
PietroPasotti Dec 5, 2023
3ea69aa
install ops on type check tox env
PietroPasotti Dec 5, 2023
e7ea789
Merge branch 'v6.0' into type-checks
PietroPasotti Dec 5, 2023
fe4c741
Merge pull request #89 from canonical/type-checks
PietroPasotti Dec 5, 2023
904c77a
better coverage
PietroPasotti Dec 5, 2023
1d4613b
pr comments
PietroPasotti Jan 3, 2024
4785621
Merge branch 'v60' into secret-ownership-fixes
PietroPasotti Jan 3, 2024
b88efdc
added test fixes
PietroPasotti Jan 3, 2024
863db34
readme fixes
PietroPasotti Jan 4, 2024
d72aac2
removed typer dep
PietroPasotti Jan 4, 2024
bd0baf3
support unified charmcraft model
PietroPasotti Jan 4, 2024
b89930b
vbump
PietroPasotti Jan 4, 2024
e7fb016
addressed pr comments
PietroPasotti Jan 5, 2024
43123f3
removed todo
PietroPasotti Jan 5, 2024
de4a1d0
Merge pull request #91 from canonical/support-unified-charmcraft-yaml
PietroPasotti Jan 5, 2024
0cfc1e4
loosened metadata checks
PietroPasotti Jan 9, 2024
7a2a83f
english
PietroPasotti Jan 9, 2024
ba7972e
fixed once more jujuv check
PietroPasotti Jan 9, 2024
81a9a91
Merge pull request #86 from canonical/secret-ownership-fixes
PietroPasotti Jan 9, 2024
22d48dc
Merge pull request #93 from canonical/fix-metadata-autoload
PietroPasotti Jan 9, 2024
693a262
Fix test in README for container.pebble_ready_event().
tonyandrewmeyer Jan 17, 2024
a5d5054
Merge pull request #96 from tonyandrewmeyer/container-pebble-ready-re…
PietroPasotti Jan 17, 2024
0f8d7d0
Merge branch 'main' of github.com:canonical/ops-scenario into v6.0
PietroPasotti Jan 17, 2024
8a1f6fd
Merge branch 'v6.0' of github.com:canonical/ops-scenario into v6.0
PietroPasotti Jan 17, 2024
a1e99ca
static fixes
PietroPasotti Jan 17, 2024
95ec077
precommit for pyright
PietroPasotti Jan 17, 2024
7cd7f85
precommit for pyright
PietroPasotti Jan 17, 2024
1a41323
pyright vbump
PietroPasotti Jan 17, 2024
828f98c
pyright vbump
PietroPasotti Jan 17, 2024
138a9dd
Merge pull request #90 from canonical/v6.0
PietroPasotti Jan 17, 2024
82269f0
support for broken_relation_id in ops
PietroPasotti Feb 5, 2024
55d3c31
static
PietroPasotti Feb 5, 2024
75a09fd
added default juju data to default remote unit databag
PietroPasotti Feb 7, 2024
3196c5f
and now for sub and peers
PietroPasotti Feb 7, 2024
761b18b
fixed utest
PietroPasotti Feb 7, 2024
87c2c00
better default port
PietroPasotti Feb 8, 2024
f864a26
Merge pull request #99 from canonical/default-data-in-databags
PietroPasotti Feb 8, 2024
63db45c
vbump
PietroPasotti Feb 9, 2024
4a1ec5f
Merge pull request #98 from canonical/broken-event-relation-in-state
PietroPasotti Feb 9, 2024
99653d5
compatibility with ops<2.10
PietroPasotti Feb 9, 2024
55eb93a
vbump
PietroPasotti Feb 9, 2024
406f81b
warn
PietroPasotti Feb 9, 2024
4243b64
static
PietroPasotti Feb 9, 2024
1ca86a5
get
PietroPasotti Feb 9, 2024
0974638
Add .id to ActionEvent.
tonyandrewmeyer Feb 16, 2024
e03b3ee
Adjust per code review.
tonyandrewmeyer Feb 18, 2024
94ff159
Merge pull request #103 from tonyandrewmeyer/actionevent-id-101
PietroPasotti Mar 1, 2024
9592497
vbump
PietroPasotti Mar 1, 2024
d4fb61b
Merge pull request #100 from canonical/older-ops-compat
PietroPasotti Mar 13, 2024
a7c8413
removed rotten inject code
PietroPasotti Mar 19, 2024
2e798df
Merge pull request #104 from canonical/remove-inject
PietroPasotti Mar 19, 2024
4519d06
Use default_factory to provide default UUID and name values for Model.
tonyandrewmeyer Mar 21, 2024
d69e183
Merge pull request #105 from tonyandrewmeyer/fix-model-attr-defaults
PietroPasotti Mar 22, 2024
48831d8
First pass.
tonyandrewmeyer Mar 26, 2024
92de04c
Fix the config consistency checker type checking.
tonyandrewmeyer Mar 27, 2024
bb93896
Update scenario/consistency_checker.py
tonyandrewmeyer Mar 27, 2024
a770726
Avoid unpleasant wrapping, as per review.
tonyandrewmeyer Mar 27, 2024
4b7a783
Update scenario/consistency_checker.py
tonyandrewmeyer Mar 27, 2024
259a974
Add type hints.
tonyandrewmeyer Mar 27, 2024
588a9a4
Add docs for Model.
tonyandrewmeyer Mar 28, 2024
265ac55
Merge pull request #107 from tonyandrewmeyer/readme-cleanup
PietroPasotti Mar 28, 2024
3c513a4
Add support for Pebble notices.
tonyandrewmeyer Mar 28, 2024
61ec65f
Merge branch 'main' into pebble-notices
tonyandrewmeyer Mar 28, 2024
af102aa
Minor tweaks as per code review.
tonyandrewmeyer Apr 1, 2024
f8c48de
Remove the mystery type:attrs disabled code.
tonyandrewmeyer Apr 1, 2024
3029150
Merge pull request #106 from tonyandrewmeyer/config-type-secret
PietroPasotti Apr 2, 2024
db76e53
Adjust examples in doc.
tonyandrewmeyer Apr 3, 2024
653e631
Rename Notice.id to Notice.notice_id.
tonyandrewmeyer Apr 3, 2024
b9daa69
Go back to PebbleNotice.id.
tonyandrewmeyer Apr 4, 2024
38f7071
Adjustments per code review.
tonyandrewmeyer Apr 4, 2024
8071e5f
Update to more generic name.
tonyandrewmeyer Apr 4, 2024
82da906
Notice IDs are unique, so use a set not a list for __contains__.
tonyandrewmeyer Apr 4, 2024
050ebac
Expand the consistent check tests to match new checks.
tonyandrewmeyer Apr 4, 2024
726cc94
Rename Relation.relation_id to Relation.id.
tonyandrewmeyer Apr 4, 2024
354050b
Merge branch 'main' into rename-relation-id
tonyandrewmeyer Apr 4, 2024
b02cf85
feat: add support for cloud spec
IronCore864 Apr 8, 2024
108b1ce
test: add e2e test for cloud spec
IronCore864 Apr 8, 2024
9d58637
chore: fix linting
IronCore864 Apr 8, 2024
65be11b
chore: fix linting
IronCore864 Apr 8, 2024
8a058d1
chore: refactor according to code review
IronCore864 Apr 9, 2024
56e56db
chore: refactor according to code review
IronCore864 Apr 9, 2024
0c25e09
Update scenario/mocking.py
IronCore864 Apr 9, 2024
da8dea3
Update scenario/state.py
IronCore864 Apr 9, 2024
6e81250
refactor: some updates according to code review and standup discussions
IronCore864 Apr 10, 2024
8161af7
Update README.md
tonyandrewmeyer Apr 10, 2024
d738b94
chore: refactor according to code review and standup discussion
IronCore864 Apr 11, 2024
db1f54f
chore: refactor according to code review
IronCore864 Apr 12, 2024
abaaf64
chore: fix static check
IronCore864 Apr 12, 2024
3a9a78d
chore: remove testing code
IronCore864 Apr 12, 2024
318273e
Update README.md
tonyandrewmeyer Apr 12, 2024
115b5bc
chore: make CloudCredential.to_ops_cloud_credential a private function'
IronCore864 Apr 15, 2024
d618391
docs: update readme with cloudspec
IronCore864 Apr 15, 2024
b274440
chore: make to ops methods private
IronCore864 Apr 15, 2024
1bc5e5c
chore: change import ops to import specific things
IronCore864 Apr 15, 2024
8e7dd97
chore: fix linting and ut
IronCore864 Apr 15, 2024
82b109c
chore: rename to ops method after discussion
IronCore864 Apr 15, 2024
77913d1
chore: fixing scenario imports
IronCore864 Apr 15, 2024
389dd65
chore: fix readability issue
IronCore864 Apr 15, 2024
e1bb629
docs: update readme cloudspec code example
IronCore864 Apr 15, 2024
82e8e4c
chore: add a missing type
IronCore864 Apr 15, 2024
52c2c93
Rename PebbleNotice to Notice.
tonyandrewmeyer Apr 5, 2024
1c37b67
Use a simpler name.
tonyandrewmeyer Apr 16, 2024
f9928d0
str(x) only works for enum.StrEnum, not enum.Enum.
tonyandrewmeyer Apr 16, 2024
a35cc2c
Add tests that verify the notice in the event works as expected.
tonyandrewmeyer Apr 16, 2024
3e1acc9
Update scenario/consistency_checker.py
IronCore864 Apr 17, 2024
194f52d
Reset sys.excepthook.
tonyandrewmeyer Apr 18, 2024
97b50f8
Merge pull request #122 from tonyandrewmeyer/reset-sys-excepthook-102
PietroPasotti Apr 18, 2024
e758e78
Merge pull request #113 from tonyandrewmeyer/rename-relation-id
PietroPasotti May 22, 2024
0749de2
Adjust the way that the notice event is selected.
tonyandrewmeyer May 24, 2024
0739003
chore: updating comment for redacted according to review suggestions
IronCore864 May 29, 2024
c56e267
Merge branch 'cloud-spec' of github.com:IronCore864/ops-scenario into…
IronCore864 May 29, 2024
1df85e1
Merge pull request #119 from IronCore864/cloud-spec
PietroPasotti May 29, 2024
da30b05
vbump
PietroPasotti May 29, 2024
fe070f5
Revert "Merge pull request #113 from tonyandrewmeyer/rename-relation-id"
PietroPasotti May 22, 2024
d30205d
rolled back relation id renaming
PietroPasotti May 29, 2024
653470b
Merge pull request #131 from canonical/roll-back-relation-id-rename
PietroPasotti May 29, 2024
d10a533
docs: fix state transition image on PyPI
dimaqq May 30, 2024
2bda00c
Merge pull request #132 from dimaqq/fix-image-on-pypi
PietroPasotti May 30, 2024
b3bb603
Update the add-trailing-comma hook.
tonyandrewmeyer May 31, 2024
71d7f41
Update the add-trailing-comma hook.
tonyandrewmeyer May 31, 2024
b9e3a75
Merge pull request #138 from tonyandrewmeyer/update-trailing-comma-ho…
PietroPasotti May 31, 2024
9523378
Merge branch 'canonical:main' into main
tonyandrewmeyer Jun 6, 2024
895200c
Move the cloud spec to the model, use the ops CloudSpec and CloudCred…
tonyandrewmeyer Jun 6, 2024
c7ed120
Restore the Scenario CloudSpec and CloudCredential classes.
tonyandrewmeyer Jun 7, 2024
7ba3d3d
Make BoundNotice private.
tonyandrewmeyer Jun 7, 2024
b895d36
The trust is really more context than state, per review.
tonyandrewmeyer Jun 7, 2024
f1f58e5
Merge pull request #141 from tonyandrewmeyer/cloud-spec-on-model
tonyandrewmeyer Jun 11, 2024
f52d5d9
Add version bump.
tonyandrewmeyer Jun 11, 2024
cb6cbb2
Avoid unnecessary conversions, per review.
tonyandrewmeyer Jun 11, 2024
e09c9af
Merge branch 'main' into pebble-notices
tonyandrewmeyer Jun 11, 2024
25a8eb9
Merge pull request #108 from tonyandrewmeyer/pebble-notices
tonyandrewmeyer Jun 11, 2024
385bdf0
fixed config mutation in state
PietroPasotti Jun 21, 2024
3a5bda0
vbump
PietroPasotti Jun 21, 2024
77ce447
Merge pull request #145 from canonical/config-persistence
PietroPasotti Jun 21, 2024
c2253b7
docs: basic API reference docs (#128)
tonyandrewmeyer Jul 9, 2024
58e514e
fix: minimal secret fixing, so that secret-remove and secret-expired …
tonyandrewmeyer Jul 17, 2024
1d7987f
fixed juju-info network
PietroPasotti Jul 31, 2024
385dbea
vbump
PietroPasotti Jul 31, 2024
90cd342
fmt
PietroPasotti Jul 31, 2024
7242fdd
Merge pull request #165 from canonical/fix-juju-info-network-get
PietroPasotti Jul 31, 2024
de641ec
ulterior fix
PietroPasotti Jul 31, 2024
a965323
Merge pull request #166 from canonical/fix-juju-info-network-get
PietroPasotti Aug 1, 2024
00ce9b0
fixed comma and test-pebble-push example
PietroPasotti Aug 13, 2024
602f9b9
Merge pull request #173 from canonical/readme-fix-test-pebble-push
PietroPasotti Aug 13, 2024
91fef2a
chore: add compatibility with the next ops release (#178)
tonyandrewmeyer Aug 26, 2024
8277862
Remove Context.clear() and Context.cleanup().
tonyandrewmeyer Apr 1, 2024
57766b4
Remove jsonpatch_delta from the public API.
tonyandrewmeyer Apr 4, 2024
c64301f
Remove _DCBase.
tonyandrewmeyer Apr 4, 2024
ee866dd
Drop tests for unsupported Python, add 3.12.
tonyandrewmeyer Apr 4, 2024
2e9adf0
Remove deprecated functionality.
tonyandrewmeyer Apr 18, 2024
3b8e289
Make RelationBase private (_RelationBase).
tonyandrewmeyer Apr 1, 2024
065cfd2
Add basic StoredState consistency checks.
tonyandrewmeyer Apr 1, 2024
fcd5d9d
Temporarily enable quality checks for the 7.0 branch.
tonyandrewmeyer May 30, 2024
1d0aa9b
Test the code in the README.
tonyandrewmeyer Jun 6, 2024
468cf1a
Remove scenario.sequences (and related tests).
tonyandrewmeyer Jun 6, 2024
aa66be5
Support 'ctx.on.event_name' for specifying events.
tonyandrewmeyer Apr 24, 2024
1461f12
Test the code in the README.
tonyandrewmeyer Jun 6, 2024
7b44615
Support 'ctx.on.event_name' for specifying events.
tonyandrewmeyer Apr 24, 2024
871c0f5
Align with upstream.
tonyandrewmeyer Jun 6, 2024
8c62a1e
Fix merging.
tonyandrewmeyer Jul 2, 2024
c2bd565
Mark upcoming branch as dev or beta version
dimaqq Jul 4, 2024
0c55e64
Require keyword arguments for the state and its components.
tonyandrewmeyer Jul 5, 2024
5285060
feat!: use sets for the state components (#134)
tonyandrewmeyer Jul 9, 2024
f11809a
feat!: add Scenario classes that match the ops status classes (#142)
tonyandrewmeyer Jul 17, 2024
9620260
Make action events more like other events. (#161)
tonyandrewmeyer Jul 24, 2024
df27d57
Use Iterable as the container component type, so that any iterable of…
tonyandrewmeyer Jul 24, 2024
d8c743b
feat: add support for Pebble check events (#151)
tonyandrewmeyer Jul 24, 2024
d5b0de6
feat!: move default network into Network() (#163)
tonyandrewmeyer Jul 25, 2024
8023e85
feat!: simplify testing secret management (#168)
tonyandrewmeyer Aug 7, 2024
f18efd3
feat!: unify run() and run_action() and simplify context managers (#162)
tonyandrewmeyer Aug 8, 2024
62fdfc0
fix: update secret label when getting with both id and label (#172)
tonyandrewmeyer Aug 12, 2024
190d3c0
feat!: simplify creating deferred events (#174)
tonyandrewmeyer Aug 20, 2024
abe24c2
refactor!: rename Container.exec_mocks to Container.execs and extend …
tonyandrewmeyer Aug 20, 2024
33cb2e3
chore!: adjust privacy (#176)
tonyandrewmeyer Aug 29, 2024
1da9684
docs: add instructions for moving from 6.x to 7.x (#143)
tonyandrewmeyer Aug 29, 2024
7f7c07d
docs: expand the reference documentation (#169)
tonyandrewmeyer Aug 30, 2024
537cc0d
Fix merge.
tonyandrewmeyer Sep 2, 2024
150a73b
Let action params be a Mapping rather than strictly a dict.
tonyandrewmeyer Sep 3, 2024
987b824
Allow passing a Mapping for the action params, not just a dict.
tonyandrewmeyer Sep 3, 2024
c848415
chore: add some code to ease the transition from 6.x to 7.0 (#185)
tonyandrewmeyer Sep 4, 2024
f774cb1
Cap ops at 2.16.
tonyandrewmeyer Sep 9, 2024
de9ff88
Bump version.
tonyandrewmeyer Sep 9, 2024
6080dbd
Merge pull request #186 from tonyandrewmeyer/limit-6-to-ops-16
PietroPasotti Sep 9, 2024
f3cc865
Merge branch 'main' into 7.0
tonyandrewmeyer Sep 9, 2024
60010ea
Merge pull request #183 from canonical/7.0
tonyandrewmeyer Sep 9, 2024
21836cd
Inspect __init__ explicitly, for 3.8 compatibility.
tonyandrewmeyer Sep 9, 2024
199581b
Bump version.
tonyandrewmeyer Sep 9, 2024
29a50b7
Merge pull request #188 from tonyandrewmeyer/fix-3.8-inspect-compat
PietroPasotti Sep 9, 2024
ab086fc
Handle the changes coming in ops 2.17
tonyandrewmeyer Sep 12, 2024
505f65f
Remove dependency on ops.testing.
tonyandrewmeyer Sep 10, 2024
842e469
Assume that the adjustment for Secret._canonicalize_id will come befo…
tonyandrewmeyer Sep 12, 2024
69b1be2
Merge pull request #191 from tonyandrewmeyer/support-ops-2-17
tonyandrewmeyer Sep 12, 2024
16137ca
Handle the changes coming in ops 2.17
tonyandrewmeyer Sep 12, 2024
6686bb5
Handle both ops 2.15+ and ops 2.17
tonyandrewmeyer Sep 13, 2024
4e808b5
Merge branch 'main' into remove-ops-testing-dep
tonyandrewmeyer Sep 13, 2024
97501fd
Catch the correct error when a relation doesn't exist.
tonyandrewmeyer Sep 18, 2024
7be495f
Restore test removed by mistake.
tonyandrewmeyer Sep 18, 2024
0581355
Merge pull request #194 from tonyandrewmeyer/fix-get_relation-keyerro…
PietroPasotti Sep 18, 2024
614545a
Add py.typed stub file.
tonyandrewmeyer Sep 18, 2024
0a1b4a8
Bump version.
tonyandrewmeyer Sep 18, 2024
9013f19
Merge pull request #195 from tonyandrewmeyer/add-py-typed
tonyandrewmeyer Sep 18, 2024
2433c1c
Minor doc fixes.
tonyandrewmeyer Sep 19, 2024
3da5747
Merge branch 'main' into remove-ops-testing-dep
tonyandrewmeyer Sep 19, 2024
2b968e5
Merge pull request #190 from tonyandrewmeyer/remove-ops-testing-dep
tonyandrewmeyer Sep 19, 2024
1eaed95
Merge pull request #197 from tonyandrewmeyer/fix-doc-reference
PietroPasotti Sep 19, 2024
7ec526e
Use a slightly more strict type for AnyJson.
tonyandrewmeyer Sep 19, 2024
12b81bd
Merge pull request #198 from tonyandrewmeyer/anyjson-stricter-type
tonyandrewmeyer Sep 19, 2024
e88789b
Expose CharmEvents at the top level.
tonyandrewmeyer Sep 23, 2024
c00f0be
Merge pull request #200 from tonyandrewmeyer/export-charmevents
PietroPasotti Sep 23, 2024
8d26b14
Move everything to a new top-level folder to simplify merging.
tonyandrewmeyer Sep 27, 2024
0a2b124
Merge remote-tracking branch 'source/main' into import-ops-scenario
tonyandrewmeyer Sep 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions ops-scenario/.github/workflows/build_wheels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Build

on:
push:
branches:
- main

jobs:
build_wheel:
name: Build wheel on ubuntu (where else???)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v3

- name: Install build
run: pip install build

- name: Build wheel
run: python -m build

- uses: actions/upload-artifact@v3
with:
path: ./dist/*.whl

- name: Get the version
id: get_version
run: echo "VERSION=$(sed -n 's/^ *version.*=.*"\([^"]*\)".*/\1/p' pyproject.toml)" >> $GITHUB_OUTPUT

- name: release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: false
tag_name: ${{ steps.get_version.outputs.VERSION }}
release_name: ${{ steps.get_version.outputs.VERSION }}

env:
GITHUB_TOKEN: ${{ github.token }}

# - name: Setup upterm session
# uses: lhotari/action-upterm@v1

- name: upload wheel
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/ops_scenario-${{ steps.get_version.outputs.VERSION }}-py3-none-any.whl
asset_name: ops_scenario-${{ steps.get_version.outputs.VERSION }}-py3-none-any.whl
asset_content_type: application/wheel

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
45 changes: 45 additions & 0 deletions ops-scenario/.github/workflows/quality_checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Tests

on:
pull_request:
branches:
- main
- 7.0

jobs:
linting:
name: Linting
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: python -m pip install tox
- name: Run linter
run: tox -vve lint
- name: Run static checks
run: tox -vve static


unit-test:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: python -m pip install tox
- name: Run unit tests
run: tox -vve unit
15 changes: 15 additions & 0 deletions ops-scenario/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
venv/
.venv/
build/
docs/_build/
*.charm
.tox/
.coverage
__pycache__/
*.py[cod]
.idea
*.egg-info
dist/
*.pytest_cache
htmlcov/
.vscode
77 changes: 77 additions & 0 deletions ops-scenario/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
files: ^scenario/
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-ast
- id: check-builtin-literals
- id: check-docstring-first
- id: check-merge-conflict
- id: check-yaml
- id: check-toml
- id: debug-statements
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/add-trailing-comma
rev: v3.1.0
hooks:
- id: add-trailing-comma
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
hooks:
- id: pyupgrade
args: ["--py37-plus"]
exclude: "^(tests/demo_pkg_inline/build.py)$"
- id: pyupgrade
files: "^(tests/demo_pkg_inline/build.py)$"
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
# Run the Ruff linter.
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.2
hooks:
# Run the Ruff linter.
- id: ruff
# Run the Ruff formatter.
- id: ruff-format
- repo: https://github.com/asottile/blacken-docs
rev: 1.13.0
hooks:
- id: blacken-docs
additional_dependencies: [black==23.3]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: rst-backticks
- repo: https://github.com/tox-dev/tox-ini-fmt
rev: "1.3.0"
hooks:
- id: tox-ini-fmt
args: ["-p", "fix"]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v2.7.1"
hooks:
- id: prettier
additional_dependencies:
- [email protected]
- "@prettier/[email protected]"
args: ["--print-width=120", "--prose-wrap=always"]
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.33.0
hooks:
- id: markdownlint
- repo: local
hooks:
- id: changelogs-rst
name: Changelog filenames
language: fail
entry: "changelog files must be named ####.(feature|bugfix|doc|removal|misc).rst"
exclude: ^docs/changelog/(\d+\.(feature|bugfix|doc|removal|misc).rst|template.jinja2)
files: ^docs/changelog/
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes
1 change: 1 addition & 0 deletions ops-scenario/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @pietropasotti
51 changes: 51 additions & 0 deletions ops-scenario/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Contributing

![GitHub License](https://img.shields.io/github/license/canonical/ops-scenario)
![GitHub Commit Activity](https://img.shields.io/github/commit-activity/y/canonical/ops-scenario)
![GitHub Lines of Code](https://img.shields.io/tokei/lines/github/canonical/ops-scenario)
![GitHub Issues](https://img.shields.io/github/issues/canonical/ops-scenario)
![GitHub PRs](https://img.shields.io/github/issues-pr/canonical/ops-scenario)
![GitHub Contributors](https://img.shields.io/github/contributors/canonical/ops-scenario)
![GitHub Watchers](https://img.shields.io/github/watchers/canonical/ops-scenario?style=social)

This documents explains the processes and practices recommended for contributing enhancements to this project.

- Generally, before developing enhancements to this project, you should consider [opening an issue](https://github.com/canonical/ops-scenario/issues) explaining your use case.
- If you would like to chat with us about your use-cases or proposed implementation, you can reach us at [Canonical Mattermost public channel](https://chat.charmhub.io/charmhub/channels/charm-dev) or [Discourse](https://discourse.charmhub.io/).
- Familiarising yourself with the [Charmed Operator Framework](https://juju.is/docs/sdk) library will help you a lot when working on new features or bug fixes.
- All enhancements require review before being merged. Code review typically examines:
- code quality
- test coverage
- user experience
- When evaluating design decisions, we optimize for the following personas, in descending order of priority:
- charm authors and maintainers
- the contributors to this codebase
- juju developers
- Please help us out in ensuring easy to review branches by rebasing your pull request branch onto the `main` branch. This also avoids merge commits and creates a linear Git commit history.

## Notable design decisions

- The `State` object is immutable from the perspective of the test writer.
At the moment there is some hackery here and there (`object.__setattr__`...) to bypass the read-only dataclass for when the charm code mutates the state; at some point it would be nice to refactor the code to make that unnecessary.

- At the moment the mocking operates at the level of `ops.ModelBackend`-mediated hook tool calls. `ModelBackend` would `Popen` hook tool calls, but `Scenario` patches the methods that would call `Popen`, which is therefore never called. Instead, values are returned according to the `State`. We could consider allowing to operate in increasing levels of stricter confinement:
- Actually generate hook tool scripts that read/write from/to `State`, making patching `ModelBackend` unnecessary.
- On top of that, run the whole simulation in a container.

## Developing

To set up the dependencies you can run:
`pip install . ; pip uninstall ops-scenario`

We recommend using the provided `pre-commit` config. For how to set up git pre-commit: [see here](https://pre-commit.com/).
If you dislike that, you can always manually remember to `tox -e lint` before you push.

### Testing
```shell
tox -e fmt # auto-fix your code as much as possible, including formatting and linting
tox -e lint # code style
tox -e unit # unit tests
tox -e lint-tests # lint testing code
tox # runs 'lint', 'lint-tests' and 'unit' environments
```

Loading
Loading