Skip to content

Commit

Permalink
Merge pull request autowarefoundation#8 from tier4/sync-upstream
Browse files Browse the repository at this point in the history
chore: sync upstream
  • Loading branch information
tier4-autoware-public-bot[bot] authored Jun 16, 2022
2 parents f7f01cf + ea78092 commit ee67377
Show file tree
Hide file tree
Showing 68 changed files with 1,161 additions and 450 deletions.
107 changes: 107 additions & 0 deletions .github/actions/combine-multi-arch-images/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: combine-multi-arch-images
description: ""

inputs:
package-name:
description: ""
required: true

runs:
using: composite
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}

- name: Set image name
id: set-image-name
run: echo "::set-output name=image-name::ghcr.io/${{ github.repository_owner }}/${{ inputs.package-name }}"
shell: bash

- name: Get all tags
id: get-all-tags
run: |
base_url="https://api.github.com/orgs/${{ github.repository_owner }}/packages/container/${{ inputs.package-name }}/versions"
echo "base_url: $base_url"
all_tags=()
for page in $(seq 1 10); do
page_url="${base_url}?page=$page"
echo -e "\npage_url: $page_url"
page_tags=$(curl -fsSL "$page_url" -H "Authorization: token ${{ github.token }}" | jq ".[].metadata.container.tags[]" | cut -d '"' -f 2)
echo -e "\n[page_tags]\n$page_tags"
if [ "$page_tags" = "" ]; then
echo "No tags found in the page $page."
break
fi
for tag in $(IFS=$'\n'; echo "$page_tags"); do
all_tags+=("$tag")
done
done
all_tags=$(printf "%s\n" ${all_tags[@]})
echo -e "\n[all_tags]\n$all_tags"
echo "::set-output name=tags::$(printf "%s " $all_tags)"
shell: bash

- name: Get base tags
id: get-base-tags
run: |
amd64_tags=$(printf "%s\n" $ALL_TAGS | grep "\-amd64" | sed "s/-amd64$//g")
arm64_tags=$(printf "%s\n" $ALL_TAGS | grep "\-arm64" | sed "s/-arm64$//g")
base_tags=$(printf "%s\n" "$amd64_tags" "$arm64_tags" | sort | uniq)
echo -e "\n[amd64_tags]\n$amd64_tags"
echo -e "\n[arm64_tags]\n$arm64_tags"
echo -e "\n[base_tags]\n$base_tags"
echo "::set-output name=tags::$(printf "%s " $base_tags)"
env:
ALL_TAGS: ${{ steps.get-all-tags.outputs.tags }}
shell: bash

- name: Create Docker manifest
run: |
for base_tag in $BASE_TAGS; do
echo -e "\nbase_tag: $base_tag"
amd64_tag=$(printf "%s\n" $ALL_TAGS | grep "^$base_tag\-amd64" || true)
arm64_tag=$(printf "%s\n" $ALL_TAGS | grep "^$base_tag\-arm64" || true)
echo "amd64_tag: $amd64_tag"
echo "arm64_tag: $arm64_tag"
if [ "$amd64_tag" != "" ]; then
amd64_image="${{ steps.set-image-name.outputs.image-name }}:$amd64_tag"
else
echo "No amd64 tag found for '$base_tag'."
amd64_image=""
fi
if [ "$arm64_tag" != "" ]; then
arm64_image="${{ steps.set-image-name.outputs.image-name }}:$arm64_tag"
else
echo "No arm64 tag found for '$base_tag'."
arm64_image=""
fi
echo "amd64_image: $amd64_image"
echo "arm64_image: $arm64_image"
docker manifest create ${{ steps.set-image-name.outputs.image-name }}:$base_tag \
$amd64_image \
$arm64_image
docker manifest push ${{ steps.set-image-name.outputs.image-name }}:$base_tag
done
env:
ALL_TAGS: ${{ steps.get-all-tags.outputs.tags }}
BASE_TAGS: ${{ steps.get-base-tags.outputs.tags }}
shell: bash
49 changes: 49 additions & 0 deletions .github/actions/create-main-distro-alias/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: create-main-distro-alias
description: ""

inputs:
package-name:
description: ""
required: true
rosdistro:
description: ""
required: true
tag-name:
description: ""
required: true

runs:
using: composite
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}

- name: Set image name
id: set-image-name
run: echo "::set-output name=image-name::ghcr.io/${{ github.repository_owner }}/${{ inputs.package-name }}"
shell: bash

- name: Create Docker manifest for latest
run: |
# Check image existence
distro_image="${{ steps.set-image-name.outputs.image-name }}:${{ inputs.rosdistro }}-${{ inputs.tag-name }}"
if docker manifest inspect "$distro_image-amd64" >/dev/null 2>&1; then
amd64_image="$distro_image-amd64"
fi
if docker manifest inspect "$distro_image-arm64" >/dev/null 2>&1; then
arm64_image="$distro_image-arm64"
fi
echo "amd64_image: $amd64_image"
echo "arm64_image: $arm64_image"
docker manifest create --amend ${{ steps.set-image-name.outputs.image-name }}:${{ inputs.tag-name }} \
$amd64_image \
$arm64_image
docker manifest push ${{ steps.set-image-name.outputs.image-name }}:${{ inputs.tag-name }}
shell: bash
37 changes: 15 additions & 22 deletions .github/actions/docker-build-and-push/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,21 @@ inputs:
bake-target:
description: ""
required: true
platforms:
build-args:
description: ""
required: true
required: false
tag-prefix:
description: ""
required: false
tag-suffix:
description: ""
required: true
required: false

runs:
using: composite
steps:
- name: Get branch name
id: get-branch-name
run: echo "::set-output name=branch::${GITHUB_REF#refs/heads/}"
shell: bash

- name: Check branch of workflow_dispatch
if: ${{ github.event_name == 'workflow_dispatch' && steps.get-branch-name.outputs.branch != github.event.repository.default_branch }}
run: |
echo "workflow_dispatch is allowed only with the branch '${{ github.event.repository.default_branch }}', '${{ steps.get-branch-name.outputs.branch }}' is not allowed."
exit 1
shell: bash

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: Install jq
run: |
Expand Down Expand Up @@ -64,29 +55,31 @@ runs:

- name: Docker meta for devel
id: meta-devel
uses: docker/metadata-action@v3
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }}
tags: ${{ steps.set-docker-tags.outputs.tags }}
bake-target: docker-metadata-action-devel
flavor: |
latest=false
prefix=${{ inputs.tag-prefix }}
suffix=${{ inputs.tag-suffix }}
- name: Docker meta for prebuilt
id: meta-prebuilt
uses: docker/metadata-action@v3
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }}
tags: ${{ steps.set-docker-tags.outputs.tags }}
bake-target: docker-metadata-action-prebuilt
flavor: |
latest=false
prefix=${{ inputs.tag-prefix }}
suffix=-prebuilt${{ inputs.tag-suffix }}
- name: Login to GitHub Container Registry
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
Expand All @@ -102,11 +95,11 @@ runs:
shell: bash

- name: Build and push
uses: docker/bake-action@v1
uses: docker/bake-action@v2
with:
push: ${{ github.event_name != 'pull_request' }}
push: ${{ github.ref_name == github.event.repository.default_branch }}
files: |
docker/${{ inputs.bake-target }}/docker-bake.hcl
bake.json
set: |
*.platform=${{ inputs.platforms }}
${{ inputs.build-args }}
36 changes: 36 additions & 0 deletions .github/workflows/build-humble-self-hosted.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: build-humble-self-hosted

on:
schedule:
- cron: 0 0 * * 0
workflow_dispatch:

jobs:
build-humble-self-hosted:
runs-on: [self-hosted, linux, ARM64]
container: ubuntu:22.04
steps:
- name: Check out repository
uses: actions/checkout@v3
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 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
41 changes: 41 additions & 0 deletions .github/workflows/build-humble.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: build-humble

on:
schedule:
- cron: 0 0 * * 0
workflow_dispatch:

jobs:
build-humble:
runs-on: ubuntu-latest
container: ubuntu:22.04
steps:
- name: Check out repository
uses: actions/checkout@v3
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 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
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
name: build-self-hosted
name: build-main-self-hosted

on:
schedule:
- cron: 0 0 * * 0
workflow_dispatch:

jobs:
build-self-hosted:
build-main-self-hosted:
runs-on: [self-hosted, linux, ARM64]
container: ubuntu:20.04
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
ref: ""

- name: Run setup script
run: |
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/build.yaml → .github/workflows/build-main.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
name: build
name: build-main

on:
schedule:
- cron: 0 0 * * 0
workflow_dispatch:

jobs:
build:
build-main:
runs-on: ubuntu-latest
container: ubuntu:20.04
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 Down
Loading

0 comments on commit ee67377

Please sign in to comment.