Set ROS_VERSION environment vairable #147
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: | |
matrix: | |
env: | |
- ALPINE_VERSION=3.14 ROS_DISTRO=noetic ROS_DISTRIBUTION_TYPE=ros1 | |
- ALPINE_VERSION=3.17 ROS_DISTRO=noetic ROS_DISTRIBUTION_TYPE=ros1 | |
- ALPINE_VERSION=3.17 ROS_DISTRO=humble ROS_DISTRIBUTION_TYPE=ros2 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- 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: Test | |
run: | | |
eval ${{ matrix.env }} | |
image="ros-abuild:${ALPINE_VERSION}-${ROS_DISTRO}" | |
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 | |
mkdir -p /tmp/apks | |
chmod a+w /tmp/apks | |
docker run --rm \ | |
-v /tmp/${pkg_name}:/src/${pkg_name}:ro \ | |
-v /tmp/apks:/packages \ | |
${image} | |
pkg_name=${pkg_name//_/-} | |
ls -l /tmp/apks/*/* | |
echo "Checking -dbg subpackage" | |
ls -l /tmp/apks/*/* | grep -e "ros-${ROS_DISTRO}-${pkg_name}-dbg-[[:alnum:]\._git]\+-r0.apk" | |
echo "Checking -doc subpackage" | |
ls -l /tmp/apks/*/* | grep -e "ros-${ROS_DISTRO}-${pkg_name}-doc-[[:alnum:]\._git]\+-r0.apk" | |
echo "Checking main package" | |
ls -l /tmp/apks/*/* | grep -e "ros-${ROS_DISTRO}-${pkg_name}-[[:alnum:]\._git]\+-r0.apk" | |
- name: Login to GitHub Container Registry | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} | |
uses: docker/login-action@v2 | |
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} |