Skip to content

Commit

Permalink
Merge pull request #187 from datalad/ghsuite
Browse files Browse the repository at this point in the history
daily-status.py and dispatch-build: Replace PyGithub with ghreq and Pydantic
  • Loading branch information
yarikoptic authored Nov 20, 2023
2 parents 65730d2 + 7e28bc4 commit ef516e2
Show file tree
Hide file tree
Showing 16 changed files with 368 additions and 189 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ jobs:
run: |
# The goal here is for $BUILD_COMMIT to be the HEAD (necessary for
# git-annex's version detection to use the correct git commit) with
# the contents of master — or whatever ref is being used as the
# workflow source — also available.
# the .github/ and patches/ trees from master — or whatever ref is
# being used as the workflow source — also available.
git checkout "$BUILD_COMMIT"
git checkout "$GITHUB_SHA" -- .
git checkout "$GITHUB_SHA" -- .github patches
- name: Get build version
id: build-version
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ jobs:
run: |
# The goal here is for $BUILD_COMMIT to be the HEAD (necessary for
# git-annex's version detection to use the correct git commit) with
# the contents of master — or whatever ref is being used as the
# workflow source — also available.
# the .github/ and patches/ trees from master — or whatever ref is
# being used as the workflow source — also available.
git checkout "$BUILD_COMMIT"
git checkout "$GITHUB_SHA" -- .
git checkout "$GITHUB_SHA" -- .github patches
- name: Get build version
id: build-version
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ jobs:
run: |
# The goal here is for $BUILD_COMMIT to be the HEAD (necessary for
# git-annex's version detection to use the correct git commit) with
# the contents of master — or whatever ref is being used as the
# workflow source — also available.
# the .github/ and patches/ trees from master — or whatever ref is
# being used as the workflow source — also available.
git reset --soft "$BUILD_COMMIT"
# Avoid checking out unnecessary files with paths that are invalid on
# Windows.
git ls-tree --name-only HEAD | grep -v '^doc$' | xargs git checkout HEAD
git checkout HEAD doc/license ':(glob)doc/*.mdwn' ':(glob)doc/logo*'
git checkout "$GITHUB_SHA" -- .
git checkout "$GITHUB_SHA" -- .github patches
- name: Get build version
id: build-version
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/template/build-{{ostype}}.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
build-version: ${{ steps.build-version.outputs.version }}
steps:
- name: Checkout this repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -96,8 +96,8 @@ jobs:
run: |
# The goal here is for $BUILD_COMMIT to be the HEAD (necessary for
# git-annex's version detection to use the correct git commit) with
# the contents of master — or whatever ref is being used as the
# workflow source — also available.
# the .github/ and patches/ trees from master — or whatever ref is
# being used as the workflow source — also available.
{% if ostype == "windows" %}
git reset --soft "$BUILD_COMMIT"
# Avoid checking out unnecessary files with paths that are invalid on
Expand All @@ -107,7 +107,7 @@ jobs:
{% else %}
git checkout "$BUILD_COMMIT"
{% endif %}
git checkout "$GITHUB_SHA" -- .
git checkout "$GITHUB_SHA" -- .github patches

- name: Get build version
id: build-version
Expand Down Expand Up @@ -277,7 +277,7 @@ jobs:
{% if ostype == "ubuntu" %}
- name: Clone datalad/git-annex-ci-client-jobs
if: contains(fromJSON('["schedule", "workflow_dispatch"]'), github.event_name)
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: datalad/git-annex-ci-client-jobs
fetch-depth: 1
Expand Down Expand Up @@ -384,7 +384,7 @@ jobs:
{% endif %}
steps:
- name: Checkout this repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Create pending PR status
if: github.event.inputs.pr != ''
Expand Down Expand Up @@ -539,7 +539,7 @@ jobs:
needs: build-package
steps:
- name: Checkout this repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Create pending PR status
if: github.event.inputs.pr != ''
Expand Down Expand Up @@ -600,7 +600,7 @@ jobs:
fail-fast: false
steps:
- name: Checkout this repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Create pending PR status
if: github.event.inputs.pr != ''
Expand Down Expand Up @@ -732,7 +732,7 @@ jobs:

# needed for ssh certs under ubuntu and tox.ini everywhere
- name: Checkout datalad
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: datalad/datalad
path: datalad
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/template/mkworkflows.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/usr/bin/env python3
from pathlib import Path
from pathlib import Path
import sys
import jinja2
import yaml


def jinja_render(template, context):
"""
Custom renderer, in which we first replace GitHub Actions' ``${{`` with a
Expand All @@ -16,11 +17,12 @@ def jinja_render(template, context):
)
rendered = jinja2.Template(
template.replace("${{", PLACEHOLDER),
trim_blocks = True,
lstrip_blocks = True,
trim_blocks=True,
lstrip_blocks=True,
).render(context)
return rendered.replace(PLACEHOLDER, "${{")


def main():
specs_file, template_file, workflows_dir = map(Path, sys.argv[1:])
with specs_file.open() as fp:
Expand All @@ -31,5 +33,6 @@ def main():
filename = jinja_render(template_file.with_suffix("").name, sp)
(workflows_dir / filename).write_text(workflow + "\n")


if __name__ == "__main__":
main()
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN echo 'Acquire::http::Dl-Limit "1000";' >| /etc/apt/apt.conf.d/20snapshots \
&& echo 'Acquire::https::Dl-Limit "1000";' >> /etc/apt/apt.conf.d/20snapshots \
&& echo 'Acquire::Retries "5";' >> /etc/apt/apt.conf.d/20snapshots

# Notes:
# Notes:
# - in APT for NeuroDebian we have #deb-src for debian-devel, so we need to change
# that too.
# - APT specification switched away from .list to .sources format in bookworm.
Expand Down
Loading

0 comments on commit ef516e2

Please sign in to comment.