Skip to content

Merge pull request #126 from YoheiKakiuchi/pr_fix_act_info #42

Merge pull request #126 from YoheiKakiuchi/pr_fix_act_info

Merge pull request #126 from YoheiKakiuchi/pr_fix_act_info #42

name: BuildTestDeploy
on:
workflow_dispatch:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
strategy:
matrix:
ubuntu: [22.04, 20.04]
runs-on: self-hosted
env:
IMAGE_NAME: choreonoid_robot_assembler_plugin
LOCAL_NAME: actions/robot_assembler_plugin
# DOCKER_LOCAL: ghcr.io/
DOCKER_LOCAL: repo.irsl.eiiris.tut.ac.jp/
DOCKER_DEPLOY: repo.irsl.eiiris.tut.ac.jp/
DOCKER_TAG: ${{ matrix.ubuntu }}
steps:
- run: echo "🚩 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "πŸ”Ž The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Check out repository code
uses: actions/checkout@v3
- name: Build a Docker image
run: >
docker build -f .github/workflows/Dockerfile.testbuild
--build-arg BUILD_IMAGE=${{ env.DOCKER_LOCAL }}xeus:${{ env.DOCKER_TAG }}
--build-arg BASE_IMAGE=${{ env.DOCKER_LOCAL }}choreonoid_src:${{ env.DOCKER_TAG }}
-t ${{ env.LOCAL_NAME }}:${{ github.sha }} ..
- run: echo "πŸŽ‰ Successfully built a Docker image."
- run: echo "πŸ’ͺ Running Google Test in the Docker image."
- name: Google Test
run: docker run --rm ${{ env.LOCAL_NAME }}:${{ github.sha }} /bin/bash -c "/choreonoid_src/build/bin/test-sample"
- run: echo "βœ… Congratulations! All tests passed."
- name: Deploy the Docker image
if: github.event_name == 'push'
run: |
docker tag ${{ env.LOCAL_NAME }}:${{ github.sha }} ${{ env.DOCKER_DEPLOY }}${{ env.IMAGE_NAME }}:${{ env.DOCKER_TAG }}
docker push ${{ env.DOCKER_DEPLOY }}${{ env.IMAGE_NAME }}:${{ env.DOCKER_TAG }}
- run: echo "🐳 Successfully pushed the Docker image to ${{ env.DOCKER_DEPLOY }}."
- name: Dispatch
if: github.event_name == 'push' && matrix.ubuntu == '20.04'
env:
GITHUB_TOKEN: ${{ secrets.IRSL_PAT_CLS }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.IRSL_PAT_CLS }}
script: |
github.rest.actions.createWorkflowDispatch({
owner: 'IRSL-tut',
repo: 'irsl_docker_irsl_system',
ref: 'main',
workflow_id: 'build-irsl-system.yaml',
inputs: {
event_type: 'build_all',
source: 'robot_assembler_plugin',
hash: '${{ github.sha }}'
}
})
- run: echo "🍏 This job's status is ${{ job.status }}."