-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
131 additions
and
1 deletion.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
.github/workflows/scheduled.yaml → .github/workflows/nightly.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: scheduled | ||
name: nightly | ||
|
||
on: | ||
workflow_dispatch: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: reusable packages workflow | ||
|
||
on: | ||
# make this workflow reusable (and only so) | ||
workflow_call: | ||
inputs: | ||
ARCH: | ||
type: string | ||
description: build architecture | ||
required: true | ||
DEB_DISTRO: | ||
type: string | ||
description: build distribution | ||
required: true | ||
|
||
env: | ||
TERM: xterm # needed for colored output of unittests | ||
|
||
jobs: | ||
build: | ||
name: "${{ inputs.DEB_DISTRO }}-${{ inputs.ARCH }}" | ||
runs-on: ${{ inputs.ARCH == 'x64' && 'ubuntu-22.04' || (inputs.ARCH == 'arm64' && 'ubuntu-22.04-arm' || inputs.ARCH) }} | ||
|
||
steps: | ||
- run: pip install gitpython | ||
- uses: actions/checkout@v4 | ||
- name: fetch ${{ github.base_ref }} | ||
run: | | ||
git fetch --no-tags --depth=1 origin ${{ github.base_ref }} | ||
git checkout ${{ github.base_ref }} | ||
git checkout HEAD@{1} | ||
- name: determine new packages | ||
run: python3 src/scripts/pkg_diffs.py "${{ github.base_ref }}" | ||
- name: Build new packages | ||
uses: ./ | ||
env: | ||
DEB_DISTRO: ${{ inputs.DEB_DISTRO }} | ||
ARCH: ${{ inputs.ARCH }} | ||
ROS_SOURCES: /tmp/diff.repos | ||
INSTALL_GPG_KEYS: | | ||
sudo curl -sSL https://ros.packages.techfak.net/gpg.key -o /etc/apt/keyrings/ros-one-keyring.gpg | ||
sudo mkdir -p /etc/ros/rosdep/sources.list.d | ||
echo "yaml https://ros.packages.techfak.net/ros-one.yaml ${{ inputs.DEB_DISTRO }}" | sudo tee /etc/ros/rosdep/sources.list.d/1-ros-one.list | ||
EXTRA_DEB_SOURCES: "deb [signed-by=/etc/apt/keyrings/ros-one-keyring.gpg] https://ros.packages.techfak.net ${{inputs.DEB_DISTRO}}-testing main" | ||
EXTRA_SBUILD_CONFIG: ${{ vars.EXTRA_SBUILD_CONFIG }} | ||
EXTRA_SBUILD_OPTS: ${{ vars.EXTRA_SBUILD_OPTS }} | ||
DEB_BUILD_OPTIONS: ${{ vars.DEB_BUILD_OPTIONS || 'nocheck' }} | ||
CONTINUE_ON_ERROR: ${{ vars.CONTINUE_ON_ERROR || true }} | ||
SKIP_EXISTING: ${{ vars.SKIP_EXISTING || false }} | ||
SKIP_KNOWN_FAILING: false | ||
INSTALL_TO_CHROOT: false | ||
VERBOSE: ${{ vars.VERBOSE || '' }} | ||
DOWNLOAD_DEBS: false | ||
DEBS_ARTIFACT_NAME: ${{ inputs.DEB_DISTRO }}-${{ inputs.ARCH }}-debs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: packages | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- '*.repos' | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
DEB_DISTRO: [ jammy, noble ] | ||
ARCH: [ x64, arm64 ] | ||
|
||
uses: ./.github/workflows/packages.build.yaml | ||
secrets: inherit | ||
with: | ||
DEB_DISTRO: ${{ matrix.DEB_DISTRO }} | ||
ARCH: ${{ matrix.ARCH }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# /usr/bin/env python3 | ||
|
||
import os | ||
import git | ||
import yaml | ||
import argparse | ||
|
||
|
||
def load_from_commit(repo_path, sha, files): | ||
repo = git.Repo(repo_path) | ||
commit = repo.commit(sha) | ||
content = dict() | ||
for file in files: | ||
file_content = commit.tree / file | ||
content.update(yaml.safe_load(file_content.data_stream.read())) | ||
return content | ||
|
||
|
||
def is_same(left, right): | ||
for key, val in left.items(): | ||
if key not in right or left[key] != right[key]: | ||
return False | ||
return True | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser(description="Determine changed packages") | ||
parser.add_argument("sha", help="commit SHA to compare with") | ||
parser.add_argument( | ||
"files", nargs="*", default=["ros-one.repos"], help=".repos files to consider" | ||
) | ||
args = parser.parse_args() | ||
|
||
old = load_from_commit(os.getcwd(), args.sha, args.files) | ||
new = load_from_commit(os.getcwd(), "HEAD", args.files) | ||
|
||
try: | ||
del new["known_failures"] | ||
except KeyError: | ||
pass | ||
|
||
# Remove entries from new that already exist in old | ||
for key, val in old["repositories"].items(): | ||
if key in new["repositories"] and is_same(new["repositories"][key], val): | ||
del new["repositories"][key] | ||
|
||
with open("/tmp/diff.repos", "w") as f: | ||
yaml.dump(new, f) |