Allow selection of CPU architecture for build #420
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
name: CI | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: [ main ] | |
paths-ignore: | |
- '*.repos' | |
- rosdep.yaml | |
- README.md | |
- .github/workflows/docker*.yaml | |
- .github/docker/* | |
env: | |
DEBS_PATH: ${{ vars.DEBS_PATH || '~/debs' }} | |
TERM: xterm # needed for colored output of unittests | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
sanity: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install shellcheck | |
run: sudo apt-get install shellcheck | |
- uses: pre-commit/[email protected] | |
id: precommit | |
- name: Upload pre-commit changes | |
if: failure() && steps.precommit.outcome == 'failure' | |
uses: rhaschke/upload-git-patch-action@main | |
with: | |
name: pre-commit | |
unittests: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- run: ./test/bats/bin/bats --formatter pretty test/*.bats | |
- name: Check that *.js scripts are all identical to main.js | |
run: | | |
err=0 | |
for f in $(find . -iname "*.js" -not -path "./node_modules/*"); do | |
if ! diff -q $f main.js; then | |
echo "::warning:: $f differs from main.js" | |
err=1 | |
fi | |
done | |
exit $err | |
build: | |
needs: unittests | |
name: "${{ matrix.DEB_DISTRO }}, ${{ matrix.ROS_SOURCES }}\ | |
${{ matrix.VERBOSE && format(', verbose={0}', matrix.VERBOSE) || '' }}\ | |
${{ matrix.BUILD_TIMEOUT && format(', timeout={0}', matrix.BUILD_TIMEOUT) || '' }}\ | |
${{ matrix.CONTINUE_ON_ERROR && ', cont-on-err' || '' }}" | |
strategy: | |
fail-fast: false | |
matrix: | |
DEB_DISTRO: [ bookworm, jammy ] | |
BUILD_TIMEOUT: [ 0 ] | |
include: | |
# defaults (can be overriden with values from include w/o adding jobs) | |
- { ROS_SOURCES: 'good', DEBS: false, VERBOSE: false } | |
# override/add settings for specific distros | |
- { DEB_DISTRO: bookworm, DEBS: true, VERBOSE: bloom } | |
- { DEB_DISTRO: jammy, VERBOSE: true } | |
- { DEB_DISTRO: jammy, BUILD_TIMEOUT: 3, ROS_SOURCES: 'good', DEBS: true, EXPECT_EXIT_CODE: 143 } | |
# add failing jobs | |
- { DEB_DISTRO: focal, ROS_SOURCES: broken, EXPECT_EXIT_CODE: 2, CONTINUE_ON_ERROR: false, DEBS: true } | |
- { DEB_DISTRO: focal, ROS_SOURCES: broken, EXPECT_EXIT_CODE: 1, CONTINUE_ON_ERROR: true, COLCON_PKG_SELECTION: '--packages-up-to rostime' } | |
uses: ./.github/workflows/build.yaml | |
with: | |
DEB_DISTRO: ${{ matrix.DEB_DISTRO }} | |
ROS_DISTRO: ${{ matrix.ROS_DISTRO }} | |
ROS_SOURCES: .github/workflows/${{ matrix.ROS_SOURCES }}.repos | |
INSTALL_TO_CHROOT: ${{ matrix.BUILD_TIMEOUT > 0 }} # slow down for timeout test | |
VERBOSE: ${{ matrix.VERBOSE && matrix.VERBOSE || false }} | |
BUILD_TIMEOUT: ${{ matrix.BUILD_TIMEOUT && matrix.BUILD_TIMEOUT || 10 }} | |
CONTINUE_ON_ERROR: ${{ matrix.CONTINUE_ON_ERROR && matrix.CONTINUE_ON_ERROR || false }} | |
DOWNLOAD_DEBS: false | |
DEBS_ARTIFACT_NAME: ${{ matrix.DEBS && matrix.DEB_DISTRO || 'skip' }} | |
EXPECT_EXIT_CODE: ${{ matrix.EXPECT_EXIT_CODE || 0 }} | |
deploy: | |
needs: build | |
name: "${{ matrix.NAME }} ${{ matrix.PUSH_MODE }}" | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# Having more than two jobs will cause the 2nd queued to be cancelled if the 3rd arrives | |
# https://github.com/orgs/community/discussions/41518 | |
# - { NAME: focal, PUSH_MODE: push, CONTENT_MODE: replace } | |
- { NAME: bookworm, PUSH_MODE: squash, CONTENT_MODE: newer } | |
- { NAME: jammy, PUSH_MODE: push, CONTENT_MODE: newer } | |
if: ${{ !cancelled() }} | |
uses: ubi-agni/ros-builder-action/.github/workflows/deploy.yaml@main | |
with: | |
DEBS_ARTIFACT_NAME: ${{ matrix.NAME }} | |
DEPLOY_URL: self#ci | |
PUSH_MODE: ${{ matrix.PUSH_MODE }} | |
MESSAGE: "ci: ${{ matrix.NAME }} ${{ matrix.PUSH_MODE }}" |