Skip to content

Commit

Permalink
Merge branch 'main' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
rhaschke committed Feb 22, 2025
2 parents b9938e9 + 108b40f commit faea83c
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: scheduled
name: nightly

on:
workflow_dispatch:
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/packages.build.yaml
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
24 changes: 24 additions & 0 deletions .github/workflows/packages.yaml
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 }}
4 changes: 4 additions & 0 deletions ros-one.repos
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,10 @@ repositories:
type: git
url: https://github.com/ros-perception/open_karto.git
version: melodic-devel
opencv_apps:
type: git
url: https://github.com/ros-perception/opencv_apps.git
version: indigo
openni2_camera:
type: git
url: https://github.com/ros-o/openni2_camera.git
Expand Down
48 changes: 48 additions & 0 deletions src/scripts/pkg_diffs.py
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)

0 comments on commit faea83c

Please sign in to comment.