Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ModeSevenIndustrialSolutions authored Dec 22, 2023
0 parents commit 6fbb7dc
Show file tree
Hide file tree
Showing 41 changed files with 2,664 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# .coveragerc to control coverage.py
[run]
branch = True
source = osc_data_extractor
# omit = bad_file.py

[paths]
source =
src/
*/site-packages/

[report]
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover

# Don't complain about missing debug-only code:
def __repr__
if self\.debug

# Don't complain if tests don't hit defensive assertion code:
raise AssertionError
raise NotImplementedError

# Don't complain if non-runnable code isn't run:
if 0:
if __name__ == .__main__.:
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
# prettier-ignore
- package-ecosystem: "pip" # See documentation for possible values
# prettier-ignore
directory: "/" # Location of package manifests
commit-message:
prefix: "[dependabot] Chore:"
open-pull-requests-limit: 1
schedule:
interval: "weekly"
63 changes: 63 additions & 0 deletions .github/workflows/bootstrap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
name: "♻️ Update shared DevOps tooling"

# yamllint disable-line rule:truthy
on:
workflow_dispatch:
schedule:
- cron: "0 8 * * MON"

jobs:
update-actions:
name: "Update DevOps tooling"
runs-on: ubuntu-latest
permissions:
# IMPORTANT: mandatory to update content/actions/PRs
contents: write
actions: write
pull-requests: write

steps:
- name: "Checkout primary repository"
uses: actions/checkout@v4
with:
# Note: Requires a specific/defined Personal Access Token
token: ${{ secrets.ACTIONS_WORKFLOW }}

- name: "Pull workflows from central repository"
uses: actions/checkout@v4
with:
repository: "os-climate/devops-toolkit"
path: ".devops"

- name: "Update repository workflows and create PR"
env:
GH_TOKEN: ${{ github.token }}
run: |
# Remove update-devops-tooling branch if it exists
git branch -d update-devops-tooling || true
git push origin --delete update-devops-tooling || true
git config user.name "github-actions[bot]"
git config user.email \
"41898282+github-actions[bot]@users.noreply.github.com"
git checkout -b "update-devops-tooling"
FOLDERS=".github .github/workflows scripts"
FILES=".pre-commit-config.yaml .prettierignore .gitignore"
for FOLDER in ${FOLDERS}; do
# If necessary, create target folder
if [ ! -d "$FOLDER" ]; then
mkdir "$FOLDER"
fi
# Update folder contents
cp -a .devops/"$FOLDER"/. "$FOLDER"
done
# Copy specified files into repository root
for FILE in ${FILES}; do
cp .devops/"$FILE" "$FILE"
done
git add .
git commit -m "Chore: Update DevOps tooling from central repository"
git push --set-upstream origin update-devops-tooling
gh pr create --title \
"Chore: Pull DevOps tooling from upstream repository" \
--body 'This process automated by a GitHub workflow: bootstrap.yaml'
60 changes: 60 additions & 0 deletions .github/workflows/builds.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
name: "🧪 Test builds (matrix)"

# yamllint disable-line rule:truthy
on:
workflow_dispatch:
pull_request:
types: [opened, reopened, edited, synchronize]
branches:
- "*"
- "!update-devops-tooling"

jobs:
pre-release:
# Don't run if pull request is NOT merged
# if: github.event.pull_request.merged == true
runs-on: "ubuntu-latest"
continue-on-error: true
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]
steps:
- name: "Populate environment variables"
id: setenv
run: |
echo "Action triggered by user: ${GITHUB_TRIGGERING_ACTOR}"
set -x
datetime=$(date +'%Y%m%d%H%M')
export datetime
echo "datetime=${datetime}" >> "$GITHUB_OUTPUT"
vernum="${{ matrix.python-version }}.${datetime}"
echo "vernum=${vernum}" >> "$GITHUB_OUTPUT"
- name: "Checkout repository"
uses: actions/checkout@v4

- name: "Set up Python ${{ matrix.python-version }}"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: "Install dependencies"
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: "Tag for test release"
# Delete all local tags, then create a synthetic tag for testing
# Use the date/time to avoid conflicts uploading to Test PyPI
run: |
scripts/dev-versioning.sh "${{ steps.setenv.outputs.vernum }}"
git tag | xargs -L 1 | xargs git tag --delete
git tag "v${{ steps.setenv.outputs.vernum }}"
git checkout "tags/v${{ steps.setenv.outputs.vernum }}"
grep version pyproject.toml
- name: "Build with TOX"
run: |
tox -e build
36 changes: 36 additions & 0 deletions .github/workflows/dependencies.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: "⛔️ Update dependencies"

# yamllint disable-line rule:truthy
on:
workflow_dispatch:
schedule:
- cron: "0 8 * * FRI"

jobs:
update-dependencies:
name: "Update Python modules"
runs-on: ubuntu-latest
permissions:
# IMPORTANT: mandatory to raise the PR
id-token: write
pull-requests: write
repository-projects: write
contents: write

env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v4

- name: Update dependencies
uses: ModeSevenIndustrialSolutions/update-deps-action@v1
with:
sign-off-commit: "true"
token: ${{ secrets.GH_TOKEN }}
commit-message: "Chore: Update dependencies and pdm.lock"
pr-title: "Update Python module dependencies"
update-strategy: eager
# Whether to install PDM plugins before update
install-plugins: "false"
60 changes: 60 additions & 0 deletions .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
name: "🗒️ Build documentation"

# yamllint disable-line rule:truthy
on:
workflow_dispatch:
pull_request:
types: [closed]
branches:
- "*"
- "!update-devops-tooling"

jobs:
build_and_deploy:
# Don't run if pull request is NOT merged
if: github.event.pull_request.merged == true
name: "Rebuild documentation"
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
python-version: ["3.11"]
permissions:
# IMPORTANT: mandatory for documentation updates; used in final step
id-token: write
pull-requests: write
contents: write
repository-projects: write
steps:
- name: "Checkout repository"
uses: actions/checkout@v4

- name: "Set up Python ${{ matrix.python-version }}"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: "Setup PDM for build commands"
uses: pdm-project/setup-pdm@v3

- name: "Install dependencies"
run: |
python -m pip install --upgrade pip
pdm lock
pdm export -o requirements.txt
if [ -f docs/requirements.txt ]; then
pip install -r docs/requirements.txt; fi
- name: "Build documentation: (tox/sphinx)"
run: |
tox -e docs
- name: "Publish documentation"
if: success()
uses: peaceiris/actions-gh-pages@v3
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/html/
keep_files: true
Loading

0 comments on commit 6fbb7dc

Please sign in to comment.