Split dev packages #205
Workflow file for this run
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: build | |
on: | |
pull_request: | |
branches: | |
- master | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
env: | |
- ALPINE_VERSION=3.17 ROS_DISTRO=noetic ROS_DISTRIBUTION_TYPE=ros1 | |
- ALPINE_VERSION=3.17 ROS_DISTRO=humble ROS_DISTRIBUTION_TYPE=ros2 | |
- ALPINE_VERSION=3.20 ROS_DISTRO=noetic ROS_DISTRIBUTION_TYPE=ros1 SPLIT_DEV=true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build image | |
run: | | |
eval ${{ matrix.env }} | |
image="ros-abuild:${ALPINE_VERSION}-${ROS_DISTRO}" | |
docker build -t ${image} \ | |
--build-arg ALPINE_VERSION=${ALPINE_VERSION} \ | |
--build-arg ROS_DISTRO=${ROS_DISTRO} \ | |
. | |
- name: Prepare test data | |
id: test-data | |
run: | | |
eval ${{ matrix.env }} | |
if [[ ${ROS_DISTRIBUTION_TYPE} == "ros1" ]]; then | |
pkg_name="rospack" | |
git clone --depth=1 -b ${ROS_DISTRO}-devel https://github.com/ros/${pkg_name} /tmp/${pkg_name} | |
else | |
git clone --depth=1 -b ${ROS_DISTRO} https://github.com/ament/ament_index/ /tmp/ament_index | |
pkg_name="ament_index_cpp" | |
# keep only one package for testing | |
mv /tmp/ament_index/${pkg_name} /tmp/${pkg_name} | |
rm -rf /tmp/ament_index | |
fi | |
echo "image=ros-abuild:${ALPINE_VERSION}-${ROS_DISTRO}" | tee -a ${GITHUB_OUTPUT} | |
echo "split-dev=${SPLIT_DEV}" | tee -a ${GITHUB_OUTPUT} | |
echo "pkg-name=${pkg_name}" | tee -a ${GITHUB_OUTPUT} | |
echo "apk-pkg-name=ros-${ROS_DISTRO}-${pkg_name//_/-}" | tee -a ${GITHUB_OUTPUT} | |
- name: Build sample package | |
run: | | |
mkdir -p /tmp/apks | |
chmod a+w /tmp/apks | |
docker run --rm \ | |
-v /tmp/${{ steps.test-data.outputs.pkg-name }}:/src/${{ steps.test-data.outputs.pkg-name }}:ro \ | |
-v /tmp/apks:/packages \ | |
${{ steps.test-data.outputs.image }} | |
- name: Test | |
run: | |
ls -l /tmp/apks/*/* | |
echo "Checking -dbg subpackage" | |
ls -l /tmp/apks/*/* | grep -e "${{ steps.test-data.outputs.apk-pkg-name }}-dbg-[[:alnum:]\._git]\+-r0.apk" | |
echo "Checking -doc subpackage" | |
ls -l /tmp/apks/*/* | grep -e "${{ steps.test-data.outputs.apk-pkg-name }}-doc-[[:alnum:]\._git]\+-r0.apk" | |
echo "Checking main package" | |
ls -l /tmp/apks/*/* | grep -e "${{ steps.test-data.outputs.apk-pkg-name }}-[[:alnum:]\._git]\+-r0.apk" | |
- name: Test split-dev | |
if: steps.test-data.outputs.split-dev | |
run: | | |
echo "Checking dev package" | |
ls -l /tmp/apks/*/* | grep -e "${{ steps.test-data.outputs.apk-pkg-name }}-dev-[[:alnum:]\._git]\+-r0.apk" | |
- name: Login to GitHub Container Registry | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Deploy | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} | |
run: | | |
eval ${{ matrix.env }} | |
image="ros-abuild:${ALPINE_VERSION}-${ROS_DISTRO}" | |
docker tag ${image} ghcr.io/${{ github.repository_owner }}/${image} | |
docker push ghcr.io/${{ github.repository_owner }}/${image} |