cstar-ocean 0.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. cstar_ocean-0.0.0/.github/PULL_RELEASE_TEMPLATE.md +9 -0
  2. cstar_ocean-0.0.0/.github/workflows/close_jira_ticket.yaml +56 -0
  3. cstar_ocean-0.0.0/.github/workflows/create_jira_tickets.sh +180 -0
  4. cstar_ocean-0.0.0/.github/workflows/integration_tests.yaml +59 -0
  5. cstar_ocean-0.0.0/.github/workflows/open_jira_ticket.yaml +34 -0
  6. cstar_ocean-0.0.0/.github/workflows/pre-commit.yaml +18 -0
  7. cstar_ocean-0.0.0/.github/workflows/pypipublish.yaml +83 -0
  8. cstar_ocean-0.0.0/.github/workflows/sphinx.yaml +30 -0
  9. cstar_ocean-0.0.0/.github/workflows/unit_tests.yaml +58 -0
  10. cstar_ocean-0.0.0/.gitignore +135 -0
  11. cstar_ocean-0.0.0/.pre-commit-config.yaml +44 -0
  12. cstar_ocean-0.0.0/.readthedocs.yaml +26 -0
  13. cstar_ocean-0.0.0/LICENSE +191 -0
  14. cstar_ocean-0.0.0/MANIFEST.in +1 -0
  15. cstar_ocean-0.0.0/PKG-INFO +111 -0
  16. cstar_ocean-0.0.0/README.md +80 -0
  17. cstar_ocean-0.0.0/ci/environment.yml +28 -0
  18. cstar_ocean-0.0.0/ci/environment_hpc.yml +23 -0
  19. cstar_ocean-0.0.0/codecov.yml +20 -0
  20. cstar_ocean-0.0.0/coverage.toml +7 -0
  21. cstar_ocean-0.0.0/cstar/__init__.py +19 -0
  22. cstar_ocean-0.0.0/cstar/additional_files/env_files/darwin_arm64.env +3 -0
  23. cstar_ocean-0.0.0/cstar/additional_files/env_files/derecho.env +4 -0
  24. cstar_ocean-0.0.0/cstar/additional_files/env_files/expanse.env +3 -0
  25. cstar_ocean-0.0.0/cstar/additional_files/env_files/linux_x86.env +3 -0
  26. cstar_ocean-0.0.0/cstar/additional_files/env_files/perlmutter.env +4 -0
  27. cstar_ocean-0.0.0/cstar/additional_files/lmod_lists/derecho.lmod +3 -0
  28. cstar_ocean-0.0.0/cstar/additional_files/lmod_lists/expanse.lmod +4 -0
  29. cstar_ocean-0.0.0/cstar/additional_files/lmod_lists/perlmutter.lmod +3 -0
  30. cstar_ocean-0.0.0/cstar/base/__init__.py +13 -0
  31. cstar_ocean-0.0.0/cstar/base/additional_code.py +212 -0
  32. cstar_ocean-0.0.0/cstar/base/base_model.py +304 -0
  33. cstar_ocean-0.0.0/cstar/base/component.py +196 -0
  34. cstar_ocean-0.0.0/cstar/base/datasource.py +87 -0
  35. cstar_ocean-0.0.0/cstar/base/discretization.py +53 -0
  36. cstar_ocean-0.0.0/cstar/base/environment.py +337 -0
  37. cstar_ocean-0.0.0/cstar/base/input_dataset.py +183 -0
  38. cstar_ocean-0.0.0/cstar/base/system.py +127 -0
  39. cstar_ocean-0.0.0/cstar/base/utils.py +302 -0
  40. cstar_ocean-0.0.0/cstar/case.py +630 -0
  41. cstar_ocean-0.0.0/cstar/marbl/__init__.py +7 -0
  42. cstar_ocean-0.0.0/cstar/marbl/base_model.py +74 -0
  43. cstar_ocean-0.0.0/cstar/marbl/component.py +69 -0
  44. cstar_ocean-0.0.0/cstar/roms/__init__.py +23 -0
  45. cstar_ocean-0.0.0/cstar/roms/base_model.py +116 -0
  46. cstar_ocean-0.0.0/cstar/roms/component.py +1215 -0
  47. cstar_ocean-0.0.0/cstar/roms/discretization.py +80 -0
  48. cstar_ocean-0.0.0/cstar/roms/input_dataset.py +205 -0
  49. cstar_ocean-0.0.0/cstar/tests/__init__.py +0 -0
  50. cstar_ocean-0.0.0/cstar/tests/integration_tests/__init__.py +0 -0
  51. cstar_ocean-0.0.0/cstar/tests/integration_tests/blueprints/__init__.py +0 -0
  52. cstar_ocean-0.0.0/cstar/tests/integration_tests/blueprints/cstar_blueprint_with_netcdf_datasets_template.yaml +63 -0
  53. cstar_ocean-0.0.0/cstar/tests/integration_tests/blueprints/cstar_blueprint_with_yaml_datasets_template.yaml +63 -0
  54. cstar_ocean-0.0.0/cstar/tests/integration_tests/blueprints/fixtures.py +64 -0
  55. cstar_ocean-0.0.0/cstar/tests/integration_tests/config.py +69 -0
  56. cstar_ocean-0.0.0/cstar/tests/integration_tests/conftest.py +36 -0
  57. cstar_ocean-0.0.0/cstar/tests/integration_tests/fixtures.py +153 -0
  58. cstar_ocean-0.0.0/cstar/tests/integration_tests/test_cstar_test_blueprints.py +82 -0
  59. cstar_ocean-0.0.0/cstar/tests/integration_tests/test_fixtures.py +147 -0
  60. cstar_ocean-0.0.0/cstar/tests/unit_tests/__init__.py +0 -0
  61. cstar_ocean-0.0.0/cstar/tests/unit_tests/base/__init__.py +0 -0
  62. cstar_ocean-0.0.0/cstar/tests/unit_tests/base/test_additional_code.py +570 -0
  63. cstar_ocean-0.0.0/cstar/tests/unit_tests/base/test_base_model.py +448 -0
  64. cstar_ocean-0.0.0/cstar/tests/unit_tests/base/test_datasource.py +140 -0
  65. cstar_ocean-0.0.0/cstar/tests/unit_tests/base/test_discretization.py +28 -0
  66. cstar_ocean-0.0.0/cstar/tests/unit_tests/base/test_environment.py +516 -0
  67. cstar_ocean-0.0.0/cstar/tests/unit_tests/base/test_input_dataset.py +585 -0
  68. cstar_ocean-0.0.0/cstar/tests/unit_tests/base/test_system.py +134 -0
  69. cstar_ocean-0.0.0/cstar/tests/unit_tests/base/test_utils.py +600 -0
  70. cstar_ocean-0.0.0/cstar/tests/unit_tests/marbl/__init__.py +0 -0
  71. cstar_ocean-0.0.0/cstar/tests/unit_tests/marbl/test_marbl_base_model.py +143 -0
  72. cstar_ocean-0.0.0/cstar/tests/unit_tests/roms/__init__.py +0 -0
  73. cstar_ocean-0.0.0/cstar/tests/unit_tests/roms/test_roms_base_model.py +201 -0
  74. cstar_ocean-0.0.0/cstar/tests/unit_tests/roms/test_roms_discretization.py +44 -0
  75. cstar_ocean-0.0.0/cstar/tests/unit_tests/roms/test_roms_input_dataset.py +498 -0
  76. cstar_ocean-0.0.0/cstar_ocean.egg-info/PKG-INFO +111 -0
  77. cstar_ocean-0.0.0/cstar_ocean.egg-info/SOURCES.txt +101 -0
  78. cstar_ocean-0.0.0/cstar_ocean.egg-info/dependency_links.txt +1 -0
  79. cstar_ocean-0.0.0/cstar_ocean.egg-info/requires.txt +11 -0
  80. cstar_ocean-0.0.0/cstar_ocean.egg-info/top_level.txt +3 -0
  81. cstar_ocean-0.0.0/docs/1_building_a_case_and_exporting_it_as_a_blueprint.ipynb +887 -0
  82. cstar_ocean-0.0.0/docs/2_importing_and_running_a_case_from_a_blueprint.ipynb +1055 -0
  83. cstar_ocean-0.0.0/docs/3_restarting_and_continuing_a_case.ipynb +589 -0
  84. cstar_ocean-0.0.0/docs/4_preparing_roms_input_datasets.ipynb +14103 -0
  85. cstar_ocean-0.0.0/docs/Makefile +23 -0
  86. cstar_ocean-0.0.0/docs/_templates/autosummary/class.rst +31 -0
  87. cstar_ocean-0.0.0/docs/api.rst +63 -0
  88. cstar_ocean-0.0.0/docs/conf.py +87 -0
  89. cstar_ocean-0.0.0/docs/contributing.md +67 -0
  90. cstar_ocean-0.0.0/docs/disclaimer.md +6 -0
  91. cstar_ocean-0.0.0/docs/images/cstar_schematic.png +0 -0
  92. cstar_ocean-0.0.0/docs/index.rst +54 -0
  93. cstar_ocean-0.0.0/docs/installation.md +33 -0
  94. cstar_ocean-0.0.0/docs/machines.md +13 -0
  95. cstar_ocean-0.0.0/docs/make.bat +35 -0
  96. cstar_ocean-0.0.0/docs/releases.rst +29 -0
  97. cstar_ocean-0.0.0/docs/terminology.md +40 -0
  98. cstar_ocean-0.0.0/examples/alpha_example/cstar_blueprint_alpha_example.yaml +64 -0
  99. cstar_ocean-0.0.0/examples/cstar_blueprint_roms_marbl_example.yaml +118 -0
  100. cstar_ocean-0.0.0/examples/cstar_example.py +21 -0
  101. cstar_ocean-0.0.0/examples/cstar_example_notebook.ipynb +1233 -0
  102. cstar_ocean-0.0.0/pyproject.toml +78 -0
  103. cstar_ocean-0.0.0/setup.cfg +4 -0
@@ -0,0 +1,9 @@
1
+ <!-- Feel free to remove check-list items aren't relevant to your change -->
2
+
3
+ - [ ] Closes #xxxx
4
+ - [ ] Tests added
5
+ - [ ] Tests passing
6
+ - [ ] Full type hint coverage
7
+ - [ ] Changes are documented in `docs/releases.rst`
8
+ - [ ] New functions/methods are listed in `api.rst`
9
+ - [ ] New functionality has documentation
@@ -0,0 +1,56 @@
1
+ name: Close Jira Ticket on Issue Close
2
+
3
+ on:
4
+ issues:
5
+ types: [closed]
6
+
7
+ jobs:
8
+ close-jira-ticket:
9
+ runs-on: ubuntu-latest
10
+ if: contains(github.event.issue.labels.*.name, 'jira-story')
11
+ steps:
12
+ - name: Extract Jira Story Key from Issue Comment
13
+ id: extract_story_key
14
+ uses: actions/github-script@v6
15
+ with:
16
+ script: |
17
+ // Fetch all comments on the closed issue
18
+ const { data: comments } = await github.rest.issues.listComments({
19
+ owner: context.repo.owner,
20
+ repo: context.repo.repo,
21
+ issue_number: context.issue.number
22
+ });
23
+
24
+ // Find the comment containing the Jira link
25
+ const jiraComment = comments.find(comment => comment.body.includes('This issue has been linked to Jira story'));
26
+ if (!jiraComment) {
27
+ core.setFailed("No Jira comment found with story key.");
28
+ return;
29
+ }
30
+
31
+ // Extract the Jira story key from the comment
32
+ const match = jiraComment.body.match(/\[(.*?)\]\(https:\/\/cworthy\.atlassian\.net\/browse\/.*?\)/);
33
+ if (!match || match.length < 2) {
34
+ core.setFailed("Jira story key not found in the comment.");
35
+ return;
36
+ }
37
+ const storyKey = match[1];
38
+
39
+ // Print the extracted story key
40
+ console.log("Extracted STORY_KEY:", storyKey);
41
+
42
+ core.setOutput("story_key", storyKey);
43
+
44
+ - name: Close Jira Ticket
45
+ env:
46
+ JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN_DAFYDD }}
47
+ JIRA_EMAIL: ${{ secrets.JIRA_EMAIL_DAFYDD }}
48
+ STORY_KEY: ${{ steps.extract_story_key.outputs.story_key }}
49
+ run: |
50
+ story_key="${{ steps.extract_story_key.outputs.story_key }}"
51
+ jira_domain="https://cworthy.atlassian.net"
52
+
53
+ curl -s -w "%{http_code}" -o response.json -X POST -u "$JIRA_EMAIL:$JIRA_API_TOKEN" \
54
+ -H "Content-Type: application/json" \
55
+ --data '{"transition": {"id": "31"}}' \
56
+ "$jira_domain/rest/api/3/issue/$story_key/transitions"
@@ -0,0 +1,180 @@
1
+ #!/bin/bash
2
+
3
+ ######################################
4
+ # FORMAT THE TICKET SUMMARY:
5
+
6
+ # Escape double quotes in ISSUE_TITLE
7
+ ESCAPED_TITLE="${ISSUE_TITLE//\"/\\\"}"
8
+
9
+ ##############################
10
+ # FORMAT THE TICKET DESCRIPTION:
11
+
12
+ ## Escape double quotes and newlines in ISSUE_BODY
13
+ ESCAPED_BODY="${ISSUE_BODY//\"/\\\"}"
14
+
15
+ ## This is literally the only way to replace newlines with spaces that the Jira API accepts:
16
+ IFS=' ' read -r -d '' ESCAPED_BODY <<<"$ESCAPED_BODY"
17
+
18
+ ## Add link back to original GitHub URL
19
+ ESCAPED_BODY="${ESCAPED_BODY} --- [View the original GitHub issue|$GITHUB_ISSUE_URL]"
20
+
21
+ ##############################
22
+ # DETERMINE ASSIGNEES
23
+
24
+ # Trim and set GITHUB_ASSIGNEE_USERNAME if needed
25
+ GITHUB_ASSIGNEE_USERNAME=$(echo "$GITHUB_ASSIGNEE_USERNAME" | xargs)
26
+
27
+ # Map GitHub username to Jira account ID directly
28
+ declare -A JIRA_IDS=(
29
+ ["TomNicholas"]="712020:035c37ae-65d0-49c2-aa10-89ecfde5257a"
30
+ ["NoraLoose"]="712020:383dc845-6121-46b3-a5f9-3b90a54478a5"
31
+ ["dafyddstephenson"]="712020:41094963-a473-4408-9c16-c445f195fd65"
32
+ )
33
+
34
+ JIRA_ASSIGNEE_ID="${JIRA_IDS[$GITHUB_ASSIGNEE_USERNAME]}"
35
+
36
+ ##############################
37
+ # CREATE THE STORY
38
+
39
+ # Create the JSON payload, adding assignee if there is one
40
+ if [[ -n "$JIRA_ASSIGNEE_ID" ]]; then
41
+ cat > payload.json <<EOF
42
+ {
43
+ "fields": {
44
+ "project": { "key": "CW" },
45
+ "summary": "$ESCAPED_TITLE",
46
+ "description": "$ESCAPED_BODY",
47
+ "issuetype": { "name": "Story" },
48
+ "assignee": { "accountId": "$JIRA_ASSIGNEE_ID" }
49
+ }
50
+ }
51
+ EOF
52
+ else
53
+ cat > payload.json <<EOF
54
+ {
55
+ "fields": {
56
+ "project": { "key": "CW" },
57
+ "summary": "$ESCAPED_TITLE",
58
+ "description": "$ESCAPED_BODY",
59
+ "issuetype": { "name": "Story" }
60
+ }
61
+ }
62
+ EOF
63
+ fi
64
+
65
+ # Display the JSON content for verification
66
+ echo "Generated JSON payload:"
67
+ cat payload.json
68
+
69
+ # Make the API request to create the main story
70
+ RESPONSE=$(curl -s -w "%{http_code}" -o response.json -X POST -u "$JIRA_EMAIL_DAFYDD:$JIRA_API_TOKEN_DAFYDD" \
71
+ -H "Content-Type: application/json" \
72
+ -d @payload.json \
73
+ "https://cworthy.atlassian.net/rest/api/2/issue")
74
+
75
+ echo "Jira response (Code $RESPONSE):"
76
+ cat response.json
77
+
78
+ # Check if curl was successful
79
+ if [[ $? -ne 0 || "$RESPONSE" -ne 201 ]]; then
80
+ echo "Error: Failed to make a request to Jira API."
81
+ exit 1
82
+ fi
83
+
84
+ ##############################
85
+ # FORMAT SUBTASKS:
86
+
87
+ # Extract the ID of the story created above
88
+ STORY_ID=$(jq -r '.key' response.json)
89
+
90
+ # Verify STORY_ID is not empty
91
+ if [[ -z "$STORY_ID" ]]; then
92
+ echo "Error: STORY_ID is empty. Failed to retrieve a valid story ID."
93
+ exit 1
94
+ fi
95
+
96
+ # Use readarray to populate TASKS array directly from matching lines in ISSUE_BODY
97
+ readarray -t TASKS < <(echo "$ISSUE_BODY" | grep -E '^- \[[ x]\] ')
98
+
99
+ # If there are tasks, create subtasks
100
+ if [[ ${#TASKS[@]} -gt 0 ]]; then
101
+ echo "Creating subtasks for tasks found in the issue..."
102
+
103
+ for TASK in "${TASKS[@]}"; do
104
+ # Remove the `- [ ]` or `- [x]` prefix from each TASK
105
+ CLEANED_TASK=$(echo "$TASK" | sed 's/^- \[[ x]\] //')
106
+
107
+ # Check for presence of colon and split based on that
108
+ if [[ "$CLEANED_TASK" == *:* ]]; then
109
+ # Split into summary and description based on the first colon
110
+ TASK_SUMMARY="${CLEANED_TASK%%:*}"
111
+ TASK_DESCRIPTION="${CLEANED_TASK#*:}"
112
+ else
113
+ # If no colon, treat the whole line as the summary and leave description empty
114
+ TASK_SUMMARY="$CLEANED_TASK"
115
+ TASK_DESCRIPTION=""
116
+ fi
117
+
118
+
119
+ ## Trim any extra whitespace or newlines in summary and description
120
+ TASK_SUMMARY=$(echo "$TASK_SUMMARY" | tr -d '\n' | tr -d '\r' | xargs)
121
+ TASK_DESCRIPTION=$(echo "$TASK_DESCRIPTION" | tr -d '\n' | tr -d '\r' | xargs)
122
+
123
+ ## Escape double quotes in the summary and description
124
+ ESCAPED_TASK_SUMMARY="${TASK_SUMMARY//\"/\\\"}"
125
+ ESCAPED_TASK_DESCRIPTION="${TASK_DESCRIPTION//\"/\\\"}"
126
+ ESCAPED_TASK_SUMMARY="${ESCAPED_TASK_SUMMARY//$'\n'/ }"
127
+ ESCAPED_TASK_DESCRIPTION="${ESCAPED_TASK_DESCRIPTION//$'\n'/ }"
128
+
129
+ # Create JSON payload for each subtask with summary and description
130
+ # issuetype id 10009 corresponds to subtask
131
+
132
+
133
+ if [[ -n "$JIRA_ASSIGNEE_ID" ]]; then
134
+ cat > subtask.json <<EOF
135
+ {
136
+ "fields": {
137
+ "project": { "key": "CW" },
138
+ "summary": "$ESCAPED_TASK_SUMMARY",
139
+ "description": "$ESCAPED_TASK_DESCRIPTION",
140
+ "issuetype": { "id": "10009" },
141
+ "parent": { "key": "$STORY_ID" },
142
+ "assignee": { "accountId": "$JIRA_ASSIGNEE_ID" }
143
+ }
144
+ }
145
+ EOF
146
+ else
147
+ cat > subtask.json <<EOF
148
+ {
149
+ "fields": {
150
+ "project": { "key": "CW" },
151
+ "summary": "$ESCAPED_TASK_SUMMARY",
152
+ "description": "$ESCAPED_TASK_DESCRIPTION",
153
+ "issuetype": { "id": "10009" },
154
+ "parent": { "key": "$STORY_ID" }
155
+ }
156
+ }
157
+ EOF
158
+ fi
159
+ echo "Generated JSON payload for subtask:"
160
+ cat subtask.json
161
+
162
+ # Make the API request to create each subtask
163
+ SUBTASK_RESPONSE=$(curl -s -w "%{http_code}" -o subtask_response.json -X POST -u "$JIRA_EMAIL_DAFYDD:$JIRA_API_TOKEN_DAFYDD" \
164
+ -H "Content-Type: application/json" \
165
+ -d @subtask.json \
166
+ "https://cworthy.atlassian.net/rest/api/2/issue")
167
+
168
+ # Check if subtask creation was successful
169
+ if [[ $? -ne 0 || "$SUBTASK_RESPONSE" -ne 201 ]]; then
170
+ echo "Error: Failed to create subtask for '$TASK_SUMMARY'. Response:"
171
+ cat subtask_response.json
172
+ exit 1
173
+ else
174
+ echo "Subtask created successfully for '$TASK_SUMMARY'."
175
+ cat subtask_response.json
176
+ fi
177
+ done
178
+ else
179
+ echo "No tasks found in the issue body. No subtasks created."
180
+ fi
@@ -0,0 +1,59 @@
1
+ name: integration_tests
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - '*'
7
+ pull_request:
8
+ branches:
9
+ - '*'
10
+
11
+ jobs:
12
+
13
+ test:
14
+ name: integration-${{ matrix.python-version }}
15
+ runs-on: ubuntu-latest
16
+ strategy:
17
+ matrix:
18
+ python-version: ["3.12",]
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+
22
+ - name: Create conda environment
23
+ uses: mamba-org/setup-micromamba@v1
24
+ with:
25
+ cache-downloads: true
26
+ cache-environment: true
27
+ micromamba-version: 'latest'
28
+ environment-file: ci/environment.yml
29
+ create-args: |
30
+ python=${{ matrix.python-version }}
31
+
32
+ - name: Environment info
33
+ shell: micromamba-shell {0}
34
+ run: |
35
+ conda info
36
+ printenv
37
+
38
+ - name: Install C-Star
39
+ shell: micromamba-shell {0}
40
+ run: |
41
+ python - V
42
+ python -m pip install -e . --force-reinstall
43
+
44
+ - name: Running Tests
45
+ shell: micromamba-shell {0}
46
+ run: |
47
+ python -V
48
+ coverage run --rcfile=coverage.toml -m pytest -s --verbose cstar/tests/integration_tests/*
49
+
50
+ - name: Get coverage report
51
+ shell: micromamba-shell {0}
52
+ run: |
53
+ coverage report -m ; coverage xml
54
+
55
+ - name: Upload coverage reports to Codecov
56
+ uses: codecov/codecov-action@v4.0.1
57
+ with:
58
+ token: ${{ secrets.CODECOV_TOKEN }}
59
+ files: ./coverage.xml
@@ -0,0 +1,34 @@
1
+ name: Create Jira Ticket on Label
2
+
3
+ on:
4
+ issues:
5
+ types: [labeled]
6
+
7
+ jobs:
8
+ create_jira_ticket:
9
+ if: contains(github.event.label.name, 'jira-story')
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: Checkout Repository
13
+ uses: actions/checkout@v2
14
+
15
+ - name: Run Jira Ticket Creation Script
16
+ env:
17
+ JIRA_EMAIL_DAFYDD: ${{ secrets.JIRA_EMAIL_DAFYDD }}
18
+ JIRA_API_TOKEN_DAFYDD: ${{ secrets.JIRA_API_TOKEN_DAFYDD }}
19
+ ISSUE_TITLE: "${{ github.event.issue.title }}"
20
+ ISSUE_BODY: "${{ github.event.issue.body }}"
21
+ GITHUB_ISSUE_URL: "https://github.com/${{ github.repository }}/issues/${{ github.event.issue.number }}"
22
+ GITHUB_ASSIGNEE_USERNAME: "${{ github.event.issue.assignee.login }}"
23
+ run: |
24
+ .github/workflows/create_jira_tickets.sh
25
+ STORY_KEY=$(jq -r '.key' response.json)
26
+ echo "STORY_KEY=$STORY_KEY" >> $GITHUB_ENV
27
+ - name: Comment on GitHub Issue
28
+ run: |
29
+ # Comment on the GitHub issue with the Jira story key
30
+ COMMENT_BODY="This issue has been linked to Jira story [$STORY_KEY](https://cworthy.atlassian.net/browse/$STORY_KEY)."
31
+ curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
32
+ -H "Accept: application/vnd.github.v3+json" \
33
+ -d "{\"body\": \"$COMMENT_BODY\"}" \
34
+ "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments"
@@ -0,0 +1,18 @@
1
+ name: pre-commit
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [main]
7
+
8
+ jobs:
9
+ pre-commit:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - uses: actions/setup-python@v4
14
+ - name: Install specific pre-commit version
15
+ run: pip install pre-commit==3.8.0
16
+ - uses: pre-commit/action@v3.0.1
17
+ with:
18
+ extra_args: --all-files
@@ -0,0 +1,83 @@
1
+ name: Build distribution
2
+ on:
3
+ release:
4
+ types:
5
+ - published
6
+ push:
7
+ branches:
8
+ - main
9
+ pull_request:
10
+ branches:
11
+ - main
12
+
13
+ concurrency:
14
+ group: ${{ github.workflow }}-${{ github.ref }}
15
+ cancel-in-progress: true
16
+
17
+ jobs:
18
+ build-artifacts:
19
+ runs-on: ubuntu-latest
20
+ if: github.repository == 'CWorthy-ocean/C-Star'
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+ with:
24
+ fetch-depth: 0
25
+ - uses: actions/setup-python@v4
26
+ name: Install Python
27
+ with:
28
+ python-version: 3.13
29
+
30
+ - name: Install dependencies
31
+ run: |
32
+ python -m pip install --upgrade pip
33
+ python -m pip install build
34
+
35
+ - name: Build tarball and wheels
36
+ run: |
37
+ git clean -xdf
38
+ git restore -SW .
39
+ python -m build --sdist --wheel .
40
+
41
+ - uses: actions/upload-artifact@v4
42
+ with:
43
+ name: releases
44
+ path: dist
45
+
46
+ test-built-dist:
47
+ needs: build-artifacts
48
+ runs-on: ubuntu-latest
49
+ steps:
50
+ - uses: actions/setup-python@v4
51
+ name: Install Python
52
+ with:
53
+ python-version: '3.13'
54
+ - uses: actions/download-artifact@v4
55
+ with:
56
+ name: releases
57
+ path: dist
58
+ - name: List contents of built dist
59
+ run: |
60
+ ls -ltrh
61
+ ls -ltrh dist
62
+ - name: Verify the built dist/wheel is valid
63
+ run: |
64
+ python -m pip install --upgrade pip
65
+ python -m pip install dist/cstar*.whl
66
+ python -c "import cstar; print(cstar.__version__)"
67
+
68
+ upload-to-pypi:
69
+ needs: test-built-dist
70
+ if: github.event_name == 'release'
71
+ runs-on: ubuntu-latest
72
+ environment:
73
+ name: pypi
74
+ url: https://pypi.org/p/cstar-ocean
75
+ permissions:
76
+ id-token: write
77
+ steps:
78
+ - uses: actions/download-artifact@v4
79
+ with:
80
+ name: releases
81
+ path: dist
82
+ - name: Publish package to PyPI
83
+ uses: pypa/gh-action-pypi-publish@v1.8.10
@@ -0,0 +1,30 @@
1
+
2
+ name: Build Documentation
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - "*"
7
+
8
+ jobs:
9
+ docs:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - name: Create conda environment
14
+ uses: mamba-org/setup-micromamba@v1
15
+ with:
16
+ cache-downloads: true
17
+ cache-environment: true
18
+ micromamba-version: 'latest'
19
+ environment-file: ci/environment.yml
20
+ create-args: |
21
+ python=${{ matrix.python-version }}
22
+ - name: Install C-Star
23
+ shell: micromamba-shell {0}
24
+ run: |
25
+ python - V
26
+ python -m pip install -e . --force-reinstall
27
+ - name: Build Docs
28
+ shell: bash -l {0}
29
+ run: |
30
+ cd docs ; make fresh; make html
@@ -0,0 +1,58 @@
1
+ name: unit_tests
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - '*'
7
+ pull_request:
8
+ branches:
9
+ - '*'
10
+
11
+ jobs:
12
+ test:
13
+ name: unit-${{ matrix.python-version }}
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ matrix:
17
+ python-version: ["3.12",]
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+
21
+ - name: Create conda environment
22
+ uses: mamba-org/setup-micromamba@v1
23
+ with:
24
+ cache-downloads: true
25
+ cache-environment: true
26
+ micromamba-version: 'latest'
27
+ environment-file: ci/environment.yml
28
+ create-args: |
29
+ python=${{ matrix.python-version }}
30
+
31
+ - name: Environment info
32
+ shell: micromamba-shell {0}
33
+ run: |
34
+ conda info
35
+ printenv
36
+
37
+ - name: Install C-Star
38
+ shell: micromamba-shell {0}
39
+ run: |
40
+ python - V
41
+ python -m pip install -e . --force-reinstall
42
+
43
+ - name: Running Tests
44
+ shell: micromamba-shell {0}
45
+ run: |
46
+ python -V
47
+ coverage run --rcfile=coverage.toml -m pytest -s --verbose cstar/tests/unit_tests/*
48
+
49
+ - name: Get coverage report
50
+ shell: micromamba-shell {0}
51
+ run: |
52
+ coverage report -m ; coverage xml
53
+
54
+ - name: Upload coverage reports to Codecov
55
+ uses: codecov/codecov-action@v4.0.1
56
+ with:
57
+ token: ${{ secrets.CODECOV_TOKEN }}
58
+ files: ./coverage.xml
@@ -0,0 +1,135 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ target/
76
+
77
+ # Jupyter Notebook
78
+ .ipynb_checkpoints
79
+
80
+ # IPython
81
+ profile_default/
82
+ ipython_config.py
83
+
84
+ # pyenv
85
+ .python-version
86
+
87
+ # pipenv
88
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
90
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
91
+ # install all needed dependencies.
92
+ #Pipfile.lock
93
+
94
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95
+ __pypackages__/
96
+
97
+ # Celery stuff
98
+ celerybeat-schedule
99
+ celerybeat.pid
100
+
101
+ # SageMath parsed files
102
+ *.sage.py
103
+
104
+ # Environments
105
+ .env
106
+ .venv
107
+ env/
108
+ venv/
109
+ ENV/
110
+ env.bak/
111
+ venv.bak/
112
+
113
+ # Spyder project settings
114
+ .spyderproject
115
+ .spyproject
116
+
117
+ # Rope project settings
118
+ .ropeproject
119
+
120
+ # mkdocs documentation
121
+ /site
122
+
123
+ # mypy
124
+ .mypy_cache/
125
+ .dmypy.json
126
+ dmypy.json
127
+
128
+ # Pyre type checker
129
+ .pyre/
130
+
131
+ # Dask
132
+ dask-worker-space/
133
+
134
+ # Vscode
135
+ .vscode/