diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fd8e4ff18..71c02b806 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,28 +2,42 @@ name: CI on: [push, pull_request] +defaults: + run: + shell: bash + jobs: ci: name: ${{ matrix.ros_distro }} if: ${{ github.actor != 'RWT-bot' }} runs-on: ubuntu-latest + container: ros:${{ matrix.ros_distro }}-ros-core strategy: fail-fast: false matrix: ros_distro: [melodic, noetic] node_version: [14] + env: + ROS_DISTRO: ${{ matrix.ros_distro }} steps: - uses: actions/checkout@v3 env: TOKEN: "${{ github.event_name == 'push' && endsWith(github.ref, 'develop') && matrix.ros_distro == 'noetic' && secrets.RWT_BOT_PAT || github.token }}" with: token: ${{ env.TOKEN }} - - name: Docker pull - run: docker pull ros:${{ matrix.ros_distro }}-ros-core - - name: Docker build - run: docker build --build-arg ROS_DISTRO="${{ matrix.ros_distro }}" --build-arg NODE_VERSION="${{ matrix.node_version }}" -t roslibjsdocker . + - uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node_version }} + - name: Own /github/home + run: | + chown -hR $(whoami):$(whoami) /github/home + - name: Install apt dependencies + run: | + apt-get update + apt-get install -y firefox ros-$ROS_DISTRO-rosbridge-server ros-$ROS_DISTRO-tf2-web-republisher ros-$ROS_DISTRO-common-tutorials ros-$ROS_DISTRO-rospy-tutorials ros-$ROS_DISTRO-actionlib-tutorials - name: Tests - run: docker run -v $(pwd):/root/roslibjs --rm roslibjsdocker bash -i -c 'bash /root/roslibjs/test/build.bash' + run: | + bash -c "source /opt/ros/$ROS_DISTRO/setup.bash && bash test/build.bash" - uses: stefanzweifel/git-auto-commit-action@v4 if: ${{ github.event_name == 'push' && endsWith(github.ref, 'develop') && matrix.ros_distro == 'noetic' }} with: diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 72760187a..000000000 --- a/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -ARG ROS_DISTRO=melodic -FROM ros:$ROS_DISTRO-ros-core - -ARG CI=true -ENV CI=$CI - -# Dependencies for rosbridge -RUN apt update && apt-get install -y firefox git wget ros-$ROS_DISTRO-rosbridge-server ros-$ROS_DISTRO-tf2-web-republisher ros-$ROS_DISTRO-common-tutorials ros-$ROS_DISTRO-rospy-tutorials ros-$ROS_DISTRO-actionlib-tutorials - -# Install nvm, Node.js and node-gyp -ARG NODE_VERSION=14 -RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash \ - && . $HOME/.nvm/nvm.sh \ - && nvm install $NODE_VERSION && nvm alias default $NODE_VERSION \ - && npm install -g node-gyp - -RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> $HOME/.bashrc -ENV PATH=/bin/versions/node/$NODE_VERSION/bin:$PATH