Skip to content

Commit 3653005

Browse files
Polish CI/CD workflows (#31)
* Polish CI/CD workflows Signed-off-by: Michel Hidalgo <[email protected]> * Update .github/workflows/cd.yml Co-authored-by: Andrew Messing <[email protected]> * Update .github/workflows/cd.yml Co-authored-by: Andrew Messing <[email protected]> * Update .github/workflows/mirror.yml Co-authored-by: Andrew Messing <[email protected]> * Update .github/workflows/mirror-release.yml Co-authored-by: Andrew Messing <[email protected]> --------- Signed-off-by: Michel Hidalgo <[email protected]> Co-authored-by: Andrew Messing <[email protected]>
1 parent 8b07094 commit 3653005

File tree

4 files changed

+21
-20
lines changed

4 files changed

+21
-20
lines changed

.github/workflows/cd.yml

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# This workflow automatically releases binaries upon tagging.
12
name: bosdyn_msgs CD
23

34
on:
@@ -10,7 +11,6 @@ concurrency:
1011
cancel-in-progress: true
1112

1213
env:
13-
# Use docker.io for Docker Hub if empty
1414
REGISTRY: ghcr.io
1515
# github.repository as <account>/<repo>
1616
BUNDLER_IMAGE_NAME: bdaiinstitute/bosdyn_msgs_bundler
@@ -39,7 +39,7 @@ jobs:
3939
uses: actions/checkout@v3
4040
with:
4141
submodules: true
42-
- name: Set up QEMU
42+
- name: Set up QEMU # as virtualization is necessary to build container images
4343
uses: docker/setup-qemu-action@v3
4444
- name: Setup Docker buildx # to workaround: https://github.com/docker/build-push-action/issues/461
4545
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
@@ -49,7 +49,7 @@ jobs:
4949
registry: ${{ env.REGISTRY }}
5050
username: ${{ github.actor }}
5151
password: ${{ secrets.GITHUB_TOKEN }}
52-
- name: Build and push by digest (may be cached)
52+
- name: Build and push by digest (may be cached) # instead of tagging -- images will be merged in the next job
5353
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a # https://github.com/docker/build-push-action
5454
id: build
5555
with:
@@ -71,7 +71,7 @@ jobs:
7171
path: /tmp/digests/*
7272
if-no-files-found: error
7373
retention-days: 1
74-
merge-container-images:
74+
merge-container-images: # so that a unique tag + platform dictate which container image is used
7575
name: Merge all bundler images
7676
runs-on: ubuntu-latest
7777
needs: [build-container-images]
@@ -109,7 +109,7 @@ jobs:
109109
docker buildx imagetools create \
110110
$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< '${{ steps.meta.outputs.json }}') \
111111
$(printf '${{ env.REGISTRY }}/${{ env.BUNDLER_IMAGE_NAME }}@sha256:%s ' *)
112-
build-bundles:
112+
build-bundles: # using containers on native architectures for speed
113113
strategy:
114114
matrix:
115115
config:
@@ -141,7 +141,6 @@ jobs:
141141
- name: Download bundles
142142
uses: actions/download-artifact@v4
143143
with:
144-
# With no `name` specified all artifacts for the run are downloaded.
145144
pattern: '*-bundle-artifact'
146145
merge-multiple: true
147146
- name: Release bundles to Github

.github/workflows/ci.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: bosdyn_msgs CI
22

33
on:
44
pull_request:
5+
branches:
6+
- main
57
push:
68
branches:
79
- main
@@ -20,7 +22,7 @@ jobs:
2022
fail-fast: false
2123
matrix:
2224
config:
23-
- { runner: "ubuntu-22-04-large-runner", image: "ros:humble-ros-base-jammy", arch: "amd64" }
25+
- { runner: "k8s-n1-standard-16", image: "ros:humble-ros-base-jammy", arch: "amd64" }
2426
- { runner: "k8s-t2a-standard-16", image: "arm64v8/ros:humble-ros-base-jammy", arch: "arm64" }
2527
name: Build and test bosdyn_msgs packages for ${{ matrix.config.arch }}
2628
runs-on: ${{ matrix.config.runner }}
@@ -32,16 +34,14 @@ jobs:
3234
with:
3335
path: src/bosdyn_msgs
3436
submodules: true
35-
3637
- name: Install dependencies
3738
run: |
3839
apt update && apt install -y python3-pip
3940
export PIP_CONSTRAINT=src/bosdyn_msgs/pip-constraint.txt
4041
rosdep update && rosdep install -i -y --from-path src
41-
4242
- name: Build and run tests for ${{ matrix.config.arch }}
4343
run: |
4444
source /opt/ros/humble/setup.bash
4545
colcon build --symlink-install --packages-up-to bosdyn_msgs
4646
colcon test --event-handlers console_direct+ --packages-up-to bosdyn_msgs
47-
colcon test-result --all --verbose
47+
colcon test-result --all --verbose # to ensure the job fails if any test does

.github/workflows/mirror-release.yml

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1+
# This workflow keeps the public repository releases in sync with those in the private repository
12
name: bosdyn_msgs release mirroring
23

34
on:
4-
workflow_dispatch:
5-
workflow_run:
5+
workflow_dispatch: # to enable manual release mirroring
6+
workflow_run: # to trigger release mirroring after an automated release
67
workflows: [bosdyn_msgs CD]
78
types: [completed]
8-
release:
9+
release: # to trigger release mirroring after a manual release
910
types: [published]
1011

1112
env:
1213
# github.repository as <account>/<repo>
1314
MIRROR_REPOSITORY: bdaiinstitute/bosdyn_msgs
1415

1516
jobs:
16-
mirror-latest-release:
17+
mirror-latest-release: # only applies to workflow events
1718
name: Mirror latest bosdyn_msgs release
1819
runs-on: ubuntu-latest
1920
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
@@ -24,7 +25,7 @@ jobs:
2425
uses: robinraju/[email protected]
2526
id: download
2627
with:
27-
latest: true
28+
latest: true # release tag unknown, default to latest
2829
fileName: '*.run'
2930
- name: Create mirror release
3031
uses: softprops/action-gh-release@v1
@@ -34,7 +35,7 @@ jobs:
3435
token: ${{ secrets.MIRROR_PAT }}
3536
tag_name: ${{ steps.download.outputs.tag_name }}
3637
files: '*.run'
37-
mirror-published-release:
38+
mirror-published-release: # only applies to release events
3839
name: Mirror published bosdyn_msgs release
3940
runs-on: ubuntu-latest
4041
if: ${{ github.event_name == 'release' }}
@@ -45,7 +46,7 @@ jobs:
4546
uses: robinraju/[email protected]
4647
id: download
4748
with:
48-
tag: ${{ github.ref_name }}
49+
tag: ${{ github.ref_name }} # use the release tag
4950
fileName: '*.run'
5051
- name: Create mirror release
5152
uses: softprops/action-gh-release@v1

.github/workflows/mirror.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# This workflow keeps the public repository commit history in sync with that of the private repository.
12
name: bosdyn_msgs mirroring
23

34
on:
@@ -19,9 +20,9 @@ jobs:
1920
uses: actions/checkout@v3
2021
with:
2122
submodules: true
22-
persist-credentials: false
23-
fetch-depth: 0
24-
fetch-tags: true
23+
persist-credentials: false # to avoid CI credentials from overriding the PAT in secrets
24+
fetch-depth: 0 # to bring the entire repository history on checkout
25+
fetch-tags: true # to bring tags on checkout, not only branches
2526
- name: Push to mirror repository
2627
run: |
2728
git push --tags --follow-tags --recurse-submodules=on-demand \

0 commit comments

Comments
 (0)