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

Several small updates to the metadata templates #22

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions repometadata/templates/.github/workflows/workflow.yml.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ${{ '{{' }} matrix.os {{ '}}' }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, macos-13, windows-latest]
python-version: ["3.8", "3.10"]
defaults:
run:
Expand All @@ -28,9 +28,9 @@ jobs:
uses: actions/checkout@v4

- name: Set up conda
uses: conda-incubator/setup-miniconda@v4
uses: conda-incubator/setup-miniconda@v3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't we use the latest version?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably could. I had those commits lying around for a while and guess v4 was just not released yet when I did the work. I'll just leave this open for now and update when I find time.

with:
python-version: ${{ matrix.python-version }}
python-version: ${{ '{{' }} matrix.python-version {{ '}}' }}
auto-update-conda: true
activate-environment: conda-environment
environment-file: .github/environment.yml
Expand Down
1 change: 0 additions & 1 deletion repometadata/templates/README.md.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
| Description | Badge |
| --- | --- |
| Tests | [![Build status](https://github.com/ubermag/{{ package }}/workflows/workflow/badge.svg)](https://github.com/ubermag/{{ package }}/actions?query=workflow%3Aworkflow) |
| | [![conda](https://github.com/ubermag/{{ package }}/workflows/conda/badge.svg)](https://github.com/ubermag/{{ package }}/actions?query=workflow%3Aconda) |
| Linting | [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/ubermag/{{ package }}/master.svg)](https://results.pre-commit.ci/latest/github/ubermag/{{ package }}/master) |
| | [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) |
| Releases | [![PyPI version](https://badge.fury.io/py/{{ package }}.svg)](https://badge.fury.io/py/{{ package }}) |
Expand Down
19 changes: 11 additions & 8 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,16 @@ def uninstall(c):
'create-branch': ('Create the specified branch. Overwrites existing'
' branches [git option -B is used].'),
'commit_message': 'Optionally pass a custom commit message.',
'push': 'Push changes; defaults to true.'},
'commit': 'Commit changes; defaults to true',
'push': 'Push changes (requires creating a commit); defaults to true.'},
iterable=['file', 'repo'])
def update_repometadata(c,
repo,
file,
branch,
create_branch=False,
commit_message='Update repository metadata',
commit=True,
push=True):
"""Update repo-metadata locally.

Expand Down Expand Up @@ -157,13 +159,14 @@ def update_repometadata(c,
dirs_exist_ok=True)

shutil.rmtree(f'repometadata/{r}')
with c.cd(f'{REPODIR}/{r}'):
for f in modified:
c.run(f'git add {os.path.relpath(f)}')
c.run(f'git commit -m "{commit_message}"')
if push:
push = f'-u origin {branch}' if branch is not None else ''
c.run(f'git push {push}')
if commit:
with c.cd(f'{REPODIR}/{r}'):
for f in modified:
c.run(f'git add {os.path.relpath(f)}')
c.run(f'git commit -m "{commit_message}"')
if push:
push = f'-u origin {branch}' if branch is not None else ''
c.run(f'git push {push}')


def _clone_repos(c, protocol, repolist):
Expand Down