From 4743ec49539a304693bd02cfcb49be1bf9ed408f Mon Sep 17 00:00:00 2001 From: Philipp Caspers Date: Thu, 13 Jun 2024 07:16:55 +0000 Subject: [PATCH] ci: Use dev container in GitHub Actions --- .github/workflows/ci.yml | 11 ++++++++-- .github/workflows/ci_build.yml | 21 +++++++++++++++++++ .github/workflows/ci_build_dev_container.yml | 22 ++++++++++++++++++++ .github/workflows/ci_lint.yml | 12 ++++++++++- .github/workflows/ci_test.yml | 12 ++++++++++- README.md | 2 ++ 6 files changed, 76 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/ci_build.yml create mode 100644 .github/workflows/ci_build_dev_container.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d88de59..4d8c19c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,14 @@ env: jobs: format_code: uses: ./.github/workflows/ci_format_code.yml - lint: - uses: ./.github/workflows/ci_lint.yml + build_dev_container: + uses: ./.github/workflows/ci_build_dev_container.yml + build: + needs: build_dev_container + uses: ./.github/workflows/ci_build.yml test: + needs: build_dev_container uses: ./.github/workflows/ci_test.yml + lint: + needs: build_dev_container + uses: ./.github/workflows/ci_lint.yml diff --git a/.github/workflows/ci_build.yml b/.github/workflows/ci_build.yml new file mode 100644 index 0000000..c29942b --- /dev/null +++ b/.github/workflows/ci_build.yml @@ -0,0 +1,21 @@ +name: CI Build +'on': + workflow_call: null +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout (GitHub) + uses: actions/checkout@v4 + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Cargo build + uses: devcontainers/ci@v0.3 + with: + cacheFrom: ghcr.io/vorausrobotik/voraus-ros-bridge-dev + runCmd: cargo build --verbose + push: never diff --git a/.github/workflows/ci_build_dev_container.yml b/.github/workflows/ci_build_dev_container.yml new file mode 100644 index 0000000..38e2204 --- /dev/null +++ b/.github/workflows/ci_build_dev_container.yml @@ -0,0 +1,22 @@ +name: CI build dev container +'on': + workflow_call: null +jobs: + build_dev_container: + runs-on: ubuntu-latest + steps: + - name: Checkout (GitHub) + uses: actions/checkout@v4 + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Pre-build dev container image + uses: devcontainers/ci@v0.3 + with: + imageName: ghcr.io/vorausrobotik/voraus-ros-bridge-dev + cacheFrom: ghcr.io/vorausrobotik/voraus-ros-bridge-dev + push: filter + refFilterForPush: refs/heads/main diff --git a/.github/workflows/ci_lint.yml b/.github/workflows/ci_lint.yml index 066dd46..a80ae8d 100644 --- a/.github/workflows/ci_lint.yml +++ b/.github/workflows/ci_lint.yml @@ -7,5 +7,15 @@ jobs: steps: - name: Checkout (GitHub) uses: actions/checkout@v4 + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Cargo Clippy - run: cargo clippy --all-targets --all-features -- -Dwarnings + uses: devcontainers/ci@v0.3 + with: + cacheFrom: ghcr.io/vorausrobotik/voraus-ros-bridge-dev + runCmd: cargo clippy --all-targets --all-features -- -Dwarnings + push: never diff --git a/.github/workflows/ci_test.yml b/.github/workflows/ci_test.yml index 73eb086..4cce533 100644 --- a/.github/workflows/ci_test.yml +++ b/.github/workflows/ci_test.yml @@ -7,5 +7,15 @@ jobs: steps: - name: Checkout (GitHub) uses: actions/checkout@v4 + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Cargo test - run: cargo test --verbose + uses: devcontainers/ci@v0.3 + with: + cacheFrom: ghcr.io/vorausrobotik/voraus-ros-bridge-dev + runCmd: cargo test --verbose + push: never diff --git a/README.md b/README.md index ef2260d..1512661 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![CI](https://github.com/vorausrobotik/voraus-ros-bridge/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/vorausrobotik/voraus-ros-bridge/actions/workflows/ci.yml) + # voraus-ros-bridge Enables `voraus.core` integration within the ROS framework.