Skip to content

Update workflows for all pull request tests in test.yml #1305

Update workflows for all pull request tests in test.yml

Update workflows for all pull request tests in test.yml #1305

Workflow file for this run

name: Test
on:
pull_request:
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x
cache: 'pip'
- name: Install pip packages
run: |
python -m pip install --upgrade pip
- name: flake8
run: |
pip install flake8
flake8 .
- name: pydocstyle
run: |
pip install pydocstyle
pydocstyle .
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x
cache: pip
- name: Verify dockerfiles
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
./generate.py
git diff --exit-code
env-check:
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
push: false
file: ros2/rolling.Dockerfile
target: base
tags: app:local
outputs: |
type=docker,name=app:local
cache-from: |
type=registry,ref=ghcr.io/${{ github.repository_owner }}/ros2:rolling-buildcache
- name: Run environment comparison
run: |
.github/scripts/env-compare.py app:local rolling
changes:
runs-on: ubuntu-latest
permissions:
contents: read # Required to analyze file changes
outputs:
dockerfiles: ${{ steps.filter.outputs.dockerfiles }}
steps:
- name: Filter Changed Dockerfiles
id: filter
uses: dorny/paths-filter@v3
with:
filters: |
dockerfiles:
- '**/*.Dockerfile'
docker-build:
needs: changes
if: ${{ needs.changes.outputs.dockerfiles }}
strategy:
matrix:
dockerfile: ${{ fromJSON(needs.changes.outputs.dockerfiles) }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Test dockerfile build
uses: docker/build-push-action@v6
with:
push: false
file: ${{ matrix.dockerfile }}
cache-from: |
type=registry,ref=ghcr.io/${{ github.repository_owner }}/${{ matrix.label }}:${{ matrix.tag }}-buildcache
type=gha
cache-to:
type=gha,mode=max
complete:
needs:
- lint
- generate
- env-check
- docker-build
runs-on: ubuntu-latest
steps:
- name: Check
run: echo "Completed successfully!"