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

Manage repository with cruft #667

Merged
merged 7 commits into from
May 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 4 additions & 3 deletions renovate.json5 → .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"automerge": true,
"automergeType": "branch",
"matchUpdateTypes": ["minor", "patch"]
},
}
],
"regexManagers": [
{
Expand All @@ -23,7 +23,8 @@
"extractVersionTemplate": "^v?(?<version>.*)$",
}
],
"pre-commit": {
"enabled": true,
"pip_requirements": {
"fileMatch": ["requirements_dev.txt"]
},
"pre-commit": {"enabled": true}
}
79 changes: 79 additions & 0 deletions .github/workflows/cruft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
name: Update repository with Cruft
permissions:
contents: write
pull-requests: write
on:
schedule:
- cron: "0 0 * * *"

env:
PYTHON_VERSION: 3.12

jobs:
update:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
include:
- add-paths: .
body: Use this to merge the changes to this repository.
branch: cruft/update
commit-message: "chore: accept new Cruft update"
title: New updates detected with Cruft
- add-paths: .cruft.json
body: Use this to reject the changes in this repository.
branch: cruft/reject
commit-message: "chore: reject new Cruft update"
title: Reject new updates detected with Cruft
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install Cruft
run: pip3 install cruft

- name: Check if update is available
continue-on-error: false
id: check
run: |
CHANGES=0
if [ -f .cruft.json ]; then
if ! cruft check; then
CHANGES=1
fi
else
echo "No .cruft.json file"
fi

echo "has_changes=$CHANGES" >> "$GITHUB_OUTPUT"

- name: Run update if available
if: steps.check.outputs.has_changes == '1'
run: |
git config --global user.email "[email protected]"
git config --global user.name "Allen Porter"

cruft update --skip-apply-ask --refresh-private-variables
git restore --staged .


- name: Create pull request
if: steps.check.outputs.has_changes == '1'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
add-paths: ${{ matrix.add-paths }}
commit-message: ${{ matrix.commit-message }}
branch: ${{ matrix.branch }}
delete-branch: true
branch-suffix: timestamp
title: ${{ matrix.title }}
body: |
This is an autogenerated PR. ${{ matrix.body }}

[Cruft](https://cruft.github.io/cruft/) has detected updates from the Cookiecutter repository.
48 changes: 34 additions & 14 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,47 @@ name: Lint
on:
push:
branches:
- main
- main
pull_request:
branches:
- main
- main

env:
PYTHON_VERSION: 3.12

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false

steps:
- uses: actions/checkout@v4
- uses: codespell-project/actions-codespell@master
with:
skip: ./tests/tool/__snapshots__/test_diagnostics.ambr,./tests/testdata/cluster9/clusters/dev/flux-system/gotk-components.yaml
- uses: chartboost/[email protected]
- name: Run yamllint
uses: ibiqlik/action-yamllint@v3
with:
file_or_dir: "./"
config_file: "./.yaml-lint.yaml"
strict: true
- uses: actions/checkout@v4
- uses: chartboost/[email protected]
- uses: codespell-project/[email protected]
with:
check_hidden: false
exclude_file: ./tests/testdata/cluster9/clusters/dev/flux-system/gotk-components.yaml

- name: Run yamllint
uses: ibiqlik/action-yamllint@v3
with:
file_or_dir: "./"
config_file: "./.yaml-lint.yaml"
strict: true

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "pip"
cache-dependency-path: "**/requirements_dev.txt"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements_dev.txt

- name: Static typing with mypy
run: |
mypy --install-types --non-interactive --no-warn-unused-ignores .
17 changes: 9 additions & 8 deletions .github/workflows/pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,26 @@
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches:
- main

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
actions: read

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

env:
PYTHON_VERSION: 3.12

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
Expand All @@ -33,13 +31,16 @@ jobs:
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
python-version: ${{ env.PYTHON_VERSION }}
cache: "pip"
cache-dependency-path: "**/requirements_dev.txt"
- name: Install dependencies
run: |
pip install -r requirements.txt
python -m pip install --upgrade pip
pip install -r requirements_dev.txt
- run: pdoc ./flux_local -o docs/
- name: Setup Pages
uses: actions/configure-pages@v5
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
name: Upload Python Package

on:
release:
types: [created]

env:
PYTHON_VERSION: 3.12

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build --user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/flux_local
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
52 changes: 0 additions & 52 deletions .github/workflows/python-package.yaml

This file was deleted.

32 changes: 0 additions & 32 deletions .github/workflows/python-publish.yaml

This file was deleted.

Loading
Loading