Skip to content

[infra] Install ccache to docker images #76

[infra] Install ccache to docker images

[infra] Install ccache to docker images #76

name: Build docker image for CI/CD infra on PR
on:
pull_request:
branches:
- master
paths:
- '.github/workflows/build-dev-docker.yml'
- 'infra/docker/**'
# Cancel previous running jobs when pull request is updated
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
filtering:
runs-on: ubuntu-latest
outputs:
ubuntu-target: ${{ steps.ubuntu-filter.outputs.changes }}
android: ${{ steps.android-filter.outputs.android }}
steps:
- uses: dorny/paths-filter@v3
id: ubuntu-filter
with:
filters: |
focal:
- '.github/**'
- 'infra/docker/focal/Dockerfile'
jammy:
- '.github/**'
- 'infra/docker/jammy/Dockerfile'
noble:
- '.github/**'
- 'infra/docker/noble/Dockerfile'
- uses: dorny/paths-filter@v3
id: android-filter
with:
filters: |
android:
- '.github/**'
- 'infra/docker/android-sdk/**'
# Build on docker CLI for PR test without login
build-ubuntu:
needs: filtering
if: github.repository_owner == 'Samsung' && needs.filtering.outputs.ubuntu-target != '[]'
runs-on: one-x64-linux
strategy:
matrix:
version: ${{ fromJSON(needs.filtering.outputs.ubuntu-target) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build Docker Image
run: |
docker build --file infra/docker/${{ matrix.version }}/Dockerfile --tag one-test .
- name: Test onert build
if: matrix.version != 'focal' # not supported
env:
DOCKER_IMAGE_NAME: one-test
run: |
docker run --rm -v $PWD:$PWD -w $PWD -u root one-test ccache -p
docker run --rm -v $PWD:$PWD -w $PWD -u root one-test ccache -p make -f Makefile.template
docker run --rm -v $PWD:$PWD -w $PWD -u root one-test ccache -p Product/out/test/onert-test unittest
- name: Download rootfs for cross build
uses: dawidd6/action-download-artifact@v7
if: matrix.version != 'focal' # not supported
with:
workflow: generate-rootfs.yml
branch: master
name: rootfs_arm_${{ matrix.version }}
# Workaround: symlink for rootfs checker in cmake toolchain file
- name: Install rootfs and cross build
if: matrix.version != 'focal' # not supported
env:
DOCKER_IMAGE_NAME: one-test
DOCKER_ENV_VARS: '-e CROSS_BUILD=1 -e TARGET_ARCH=armv7l'
run: |
mkdir -p tools/cross/rootfs
tar -zxf rootfs_arm_${{ matrix.version }}.tar.gz -C tools/cross/rootfs
pushd tools/cross/rootfs/arm
ln -sf usr/lib lib
popd
./nnas docker-run --user make -f Makefile.template
build-android:
needs: filtering
if: github.repository_owner == 'Samsung' && needs.filtering.outputs.android == 'true'
runs-on: one-x64-linux
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build Docker Image
run: |
docker build --file infra/docker/android-sdk/Dockerfile --tag one-test .
- name: Test onert build
env:
DOCKER_IMAGE_NAME: one-test
DOCKER_ENV_VARS: '-e CROSS_BUILD=1 -e TARGET_OS=android -e BUILD_TYPE=release'
run: |
docker run --rm -v $PWD:$PWD -w $PWD -u root one-test make -f Makefile.template