Skip to content

Commit

Permalink
ci: simplify workflows
Browse files Browse the repository at this point in the history
Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>
  • Loading branch information
Kenji Miyake committed Nov 30, 2022
1 parent e284ec8 commit 23a4af8
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 175 deletions.
37 changes: 9 additions & 28 deletions .github/workflows/build-humble-self-hosted.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,14 @@ on:
jobs:
build-humble-self-hosted:
runs-on: [self-hosted, linux, ARM64]
container: ubuntu:22.04
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Trigger workflow
uses: actions/github-script@v6
with:
ref: humble

- name: Run setup script
run: |
./setup-dev-env.sh -y universe
- name: Run vcs import
run: |
mkdir src
vcs import src < autoware.repos
- name: Run vcs export
run: |
vcs export --exact src || true
- name: Run rosdep install
run: |
sudo apt-get -y update
rosdep update
DEBIAN_FRONTEND=noninteractive rosdep install -y --from-paths src --ignore-src --rosdistro humble
- name: Build
run: |
. /opt/ros/humble/setup.sh
colcon build --event-handlers console_cohesion+ --cmake-args -DCMAKE_BUILD_TYPE=Release
script: |
github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'build-main.yaml',
ref: 'humble',
})
42 changes: 9 additions & 33 deletions .github/workflows/build-humble.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,14 @@ on:
jobs:
build-humble:
runs-on: ubuntu-latest
container: ubuntu:22.04
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Trigger workflow
uses: actions/github-script@v6
with:
ref: humble

- name: Run setup script
run: |
./setup-dev-env.sh -y
- name: Set git config
uses: autowarefoundation/autoware-github-actions/set-git-config@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Run vcs import
run: |
mkdir src
vcs import src < autoware.repos
- name: Run vcs export
run: |
vcs export --exact src || true
- name: Run rosdep install
run: |
sudo apt-get -y update
rosdep update
DEBIAN_FRONTEND=noninteractive rosdep install -y --from-paths src --ignore-src --rosdistro humble
- name: Build
run: |
. /opt/ros/humble/setup.sh
colcon build --event-handlers console_cohesion+ --cmake-args -DCMAKE_BUILD_TYPE=Release
script: |
github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'build-main.yaml',
ref: 'humble',
})
37 changes: 31 additions & 6 deletions .github/workflows/build-main-self-hosted.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,43 @@ on:
workflow_dispatch:

jobs:
load-env:
runs-on: ubuntu-latest
outputs:
base-image: ${{ steps.set-env.outputs.base_image }}
rosdistro: ${{ steps.set-env.outputs.rosdistro }}
steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Load env
run: |
cat amd64.env | sed -e "s/^\s*//" -e "/^#/d" >> $GITHUB_ENV
if [ "$(uname -m)" = "aarch64" ]; then
cat arm64.env | sed -e "s/^\s*//" -e "/^#/d" >> $GITHUB_ENV
fi
- name: Set env
run: |
echo "base-image=${{ env.base_image }}" >> $GITHUB_OUTPUT
echo "rosdistro=${{ env.rosdistro }}" >> $GITHUB_OUTPUT
build-main-self-hosted:
needs: load-env
runs-on: [self-hosted, linux, ARM64]
container: ubuntu:20.04
container: ${{ needs.load-env.outputs.base-image }}
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
ref: ""

- name: Run setup script
run: |
./setup-dev-env.sh -y universe
./setup-dev-env.sh -y
- name: Set git config
uses: autowarefoundation/autoware-github-actions/set-git-config@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Run vcs import
run: |
Expand All @@ -32,9 +57,9 @@ jobs:
run: |
sudo apt-get -y update
rosdep update
DEBIAN_FRONTEND=noninteractive rosdep install -y --from-paths src --ignore-src --rosdistro galactic
DEBIAN_FRONTEND=noninteractive rosdep install -y --from-paths src --ignore-src --rosdistro ${{ needs.load-env.outputs.rosdistro }}
- name: Build
run: |
. /opt/ros/galactic/setup.sh
. /opt/ros/${{ needs.load-env.outputs.rosdistro }}/setup.sh
colcon build --event-handlers console_cohesion+ --cmake-args -DCMAKE_BUILD_TYPE=Release
30 changes: 25 additions & 5 deletions .github/workflows/build-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,34 @@ on:
workflow_dispatch:

jobs:
load-env:
runs-on: ubuntu-latest
outputs:
base-image: ${{ steps.set-env.outputs.base_image }}
rosdistro: ${{ steps.set-env.outputs.rosdistro }}
steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Load env
run: |
cat amd64.env | sed -e "s/^\s*//" -e "/^#/d" >> $GITHUB_ENV
if [ "$(uname -m)" = "aarch64" ]; then
cat arm64.env | sed -e "s/^\s*//" -e "/^#/d" >> $GITHUB_ENV
fi
- name: Set env
run: |
echo "base-image=${{ env.base_image }}" >> $GITHUB_OUTPUT
echo "rosdistro=${{ env.rosdistro }}" >> $GITHUB_OUTPUT
build-main:
needs: load-env
runs-on: ubuntu-latest
container: ubuntu:20.04
container: ${{ needs.load-env.outputs.base-image }}
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
ref: ""

- name: Run setup script
run: |
Expand All @@ -37,9 +57,9 @@ jobs:
run: |
sudo apt-get -y update
rosdep update
DEBIAN_FRONTEND=noninteractive rosdep install -y --from-paths src --ignore-src --rosdistro galactic
DEBIAN_FRONTEND=noninteractive rosdep install -y --from-paths src --ignore-src --rosdistro ${{ needs.load-env.outputs.rosdistro }}
- name: Build
run: |
. /opt/ros/galactic/setup.sh
. /opt/ros/${{ needs.load-env.outputs.rosdistro }}/setup.sh
colcon build --event-handlers console_cohesion+ --cmake-args -DCMAKE_BUILD_TYPE=Release
58 changes: 9 additions & 49 deletions .github/workflows/docker-build-and-push-humble-self-hosted.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,54 +12,14 @@ on:
jobs:
docker-build-and-push-humble-self-hosted:
runs-on: [self-hosted, linux, ARM64]
strategy:
fail-fast: false
matrix:
name:
- no-cuda
- cuda
include:
- name: no-cuda
base_image_env: base_image
setup-args: --no-nvidia
additional-tag-suffix: ""
- name: cuda
base_image_env: cuda_base_image
setup-args: --no-cuda-drivers
additional-tag-suffix: -cuda
steps:
# https://github.com/actions/checkout/issues/211
- name: Change permission of workspace
run: |
sudo chown -R $USER:$USER ${{ github.workspace }}
- name: Check out repository
uses: actions/checkout@v3
with:
ref: humble

- name: Free disk space
uses: ./.github/actions/free-disk-space

- name: Load env
run: |
cat amd64.env | sed -e "s/^\s*//" -e "/^#/d" >> $GITHUB_ENV
if [ "$(uname -m)" = "aarch64" ]; then
cat arm64.env | sed -e "s/^\s*//" -e "/^#/d" >> $GITHUB_ENV
fi
- name: Build 'autoware-universe'
uses: ./.github/actions/docker-build-and-push
- name: Trigger workflow
uses: actions/github-script@v6
with:
bake-target: autoware-universe
build-args: |
*.platform=linux/arm64
*.args.ROS_DISTRO=${{ env.rosdistro }}
*.args.BASE_IMAGE=${{ env[format('{0}', matrix.base_image_env)] }}
*.args.SETUP_ARGS=${{ matrix.setup-args }}
tag-prefix: ${{ env.rosdistro }}-
tag-suffix: ${{ matrix.additional-tag-suffix }}-arm64

- name: Show disk space
run: |
df -h
script: |
github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'docker-build-and-push-main-self-hosted.yaml',
ref: 'humble',
})
53 changes: 9 additions & 44 deletions .github/workflows/docker-build-and-push-humble.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,49 +12,14 @@ on:
jobs:
docker-build-and-push-humble:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
name:
- no-cuda
- cuda
include:
- name: no-cuda
base_image_env: base_image
setup-args: --no-nvidia
additional-tag-suffix: ""
- name: cuda
base_image_env: cuda_base_image
setup-args: --no-cuda-drivers
additional-tag-suffix: -cuda
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Trigger workflow
uses: actions/github-script@v6
with:
ref: humble

- name: Free disk space
uses: ./.github/actions/free-disk-space

- name: Load env
run: |
cat amd64.env | sed -e "s/^\s*//" -e "/^#/d" >> $GITHUB_ENV
if [ "$(uname -m)" = "aarch64" ]; then
cat arm64.env | sed -e "s/^\s*//" -e "/^#/d" >> $GITHUB_ENV
fi
- name: Build 'autoware-universe'
uses: ./.github/actions/docker-build-and-push
with:
bake-target: autoware-universe
build-args: |
*.platform=linux/amd64
*.args.ROS_DISTRO=${{ env.rosdistro }}
*.args.BASE_IMAGE=${{ env[format('{0}', matrix.base_image_env)] }}
*.args.SETUP_ARGS=${{ matrix.setup-args }}
tag-prefix: ${{ env.rosdistro }}-
tag-suffix: ${{ matrix.additional-tag-suffix }}-amd64

- name: Show disk space
run: |
df -h
script: |
github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'docker-build-and-push-main.yaml',
ref: 'humble',
})
8 changes: 3 additions & 5 deletions .github/workflows/docker-build-and-push-main-self-hosted.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,12 @@ jobs:
run: |
sudo chown -R $USER:$USER ${{ github.workspace }}
- name: Check out repository
uses: actions/checkout@v3
with:
ref: ""

- name: Free disk space
uses: ./.github/actions/free-disk-space

- name: Check out repository
uses: actions/checkout@v3

- name: Load env
run: |
cat amd64.env | sed -e "s/^\s*//" -e "/^#/d" >> $GITHUB_ENV
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/docker-build-and-push-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,12 @@ jobs:
setup-args: --no-cuda-drivers
additional-tag-suffix: -cuda
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
ref: ""

- name: Free disk space
uses: ./.github/actions/free-disk-space

- name: Check out repository
uses: actions/checkout@v3

- name: Load env
run: |
cat amd64.env | sed -e "s/^\s*//" -e "/^#/d" >> $GITHUB_ENV
Expand Down

0 comments on commit 23a4af8

Please sign in to comment.