|
| 1 | +name: Build docker image for CI/CD infra and publish to Docker Hub |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + |
| 5 | +jobs: |
| 6 | + # Use github action for build and push test image to docker hub |
| 7 | + build-docker-image: |
| 8 | + if: github.repository_owner == 'Samsung' |
| 9 | + runs-on: ubuntu-latest |
| 10 | + strategy: |
| 11 | + matrix: |
| 12 | + version: [ 'android-sdk', 'focal', 'jammy', 'noble', 'gbs', 'focal-cross', 'jammy-cross', 'noble-cross', 'lint' ] |
| 13 | + include: |
| 14 | + - version: 'focal-cross' |
| 15 | + platform-add: 'linux/arm64' |
| 16 | + - version: 'jammy-cross' |
| 17 | + platform-add: 'linux/arm64' |
| 18 | + - version: 'noble-cross' |
| 19 | + platform-add: 'linux/arm64' |
| 20 | + fail-fast: false |
| 21 | + |
| 22 | + steps: |
| 23 | + - name: Login to DockerHub |
| 24 | + uses: docker/login-action@v3 |
| 25 | + with: |
| 26 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 27 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 28 | + |
| 29 | + - name: Set up QEMU |
| 30 | + uses: docker/setup-qemu-action@v3 |
| 31 | + |
| 32 | + - name: Install Docker Buildx |
| 33 | + uses: docker/setup-buildx-action@v3 |
| 34 | + |
| 35 | + - name: Build Docker Image |
| 36 | + uses: docker/build-push-action@v6 |
| 37 | + with: |
| 38 | + file: ./infra/docker/${{ matrix.version }}/Dockerfile |
| 39 | + push: true |
| 40 | + tags: nnfw/one-devtools:${{ matrix.version }}-test |
| 41 | + platforms: linux/amd64${{ matrix.platform-add }} |
| 42 | + cache-from: type=gha |
| 43 | + cache-to: type=gha,mode=max |
| 44 | + |
| 45 | + test-cross-image: |
| 46 | + if: github.repository_owner == 'Samsung' |
| 47 | + needs: build-docker-image |
| 48 | + strategy: |
| 49 | + matrix: |
| 50 | + # TODO: noble (not supported rootfs yet) |
| 51 | + ubuntu_code: [ 'focal', 'jammy'] |
| 52 | + fail-fast: false |
| 53 | + runs-on: one-x64-linux |
| 54 | + container: |
| 55 | + image: nnfw/one-devtools:${{ matrix.ubuntu_code }}-cross-test |
| 56 | + options: --user root |
| 57 | + env: |
| 58 | + TARGET_ARCH: armv7l |
| 59 | + BUILD_TYPE: release |
| 60 | + CROSS_BUILD: 1 |
| 61 | + OPTIONS: "-DBUILD_ARMCOMPUTE=OFF" # Disable arm compute library |
| 62 | + |
| 63 | + steps: |
| 64 | + - name: Checkout |
| 65 | + uses: actions/checkout@v4 |
| 66 | + |
| 67 | + - name: Caching externals |
| 68 | + uses: actions/cache@v4 |
| 69 | + with: |
| 70 | + path: externals |
| 71 | + key: external-onert-${{ matrix.ubuntu_code }}-${{ hashFiles('infra/cmake/packages/**/*.cmake') }}-${{ hashFiles('infra/nnfw/cmake/packages/**/*.cmake') }} |
| 72 | + restore-keys: | |
| 73 | + external-onert-${{ matrix.ubuntu_code }}- |
| 74 | + external-onert- |
| 75 | + external- |
| 76 | +
|
| 77 | + - name: Download rootfs for cross build |
| 78 | + uses: dawidd6/action-download-artifact@v7 |
| 79 | + with: |
| 80 | + workflow: generate-rootfs.yml |
| 81 | + branch: master |
| 82 | + name: rootfs_arm_${{ matrix.ubuntu_code }} |
| 83 | + |
| 84 | + # Workaround: symlink for rootfs checker in cmake toolchain file |
| 85 | + - name: Install rootfs for cross build and build |
| 86 | + run: | |
| 87 | + mkdir -p tools/cross/rootfs |
| 88 | + tar -zxf rootfs_arm_${{ matrix.ubuntu_code }}.tar.gz -C tools/cross/rootfs |
| 89 | + pushd tools/cross/rootfs/arm |
| 90 | + ln -sf usr/lib lib |
| 91 | + popd |
| 92 | + make -f Makefile.template |
| 93 | +
|
| 94 | + test-x64-image: |
| 95 | + if: github.repository_owner == 'Samsung' |
| 96 | + needs: build-docker-image |
| 97 | + strategy: |
| 98 | + matrix: |
| 99 | + ubuntu_code: [ 'focal', 'jammy', 'noble' ] |
| 100 | + fail-fast: false |
| 101 | + runs-on: one-x64-linux |
| 102 | + container: |
| 103 | + image: nnfw/one-devtools:${{ matrix.ubuntu_code }}-test |
| 104 | + options: --user root |
| 105 | + env: |
| 106 | + BUILD_TYPE: release |
| 107 | + |
| 108 | + steps: |
| 109 | + - name: Checkout |
| 110 | + uses: actions/checkout@v4 |
| 111 | + |
| 112 | + - name: Caching externals |
| 113 | + uses: actions/cache@v4 |
| 114 | + with: |
| 115 | + path: externals |
| 116 | + key: external-onert-${{ matrix.ubuntu_code }}-${{ hashFiles('infra/cmake/packages/**/*.cmake') }}-${{ hashFiles('infra/nnfw/cmake/packages/**/*.cmake') }} |
| 117 | + restore-keys: | |
| 118 | + external-onert-${{ matrix.ubuntu_code }}- |
| 119 | + external-onert- |
| 120 | + external- |
| 121 | +
|
| 122 | + - name: Build |
| 123 | + run: make -f Makefile.template |
| 124 | + |
| 125 | + test-android-sdk-image: |
| 126 | + if: github.repository_owner == 'Samsung' |
| 127 | + needs: build-docker-image |
| 128 | + runs-on: one-x64-linux |
| 129 | + container: |
| 130 | + image: nnfw/one-devtools:android-sdk-test |
| 131 | + options: --user root |
| 132 | + env: |
| 133 | + BUILD_TYPE: release |
| 134 | + CROSS_BUILD: 1 |
| 135 | + TARGET_OS: android |
| 136 | + |
| 137 | + steps: |
| 138 | + - name: Checkout |
| 139 | + uses: actions/checkout@v4 |
| 140 | + |
| 141 | + - name: Caching externals |
| 142 | + uses: actions/cache@v4 |
| 143 | + with: |
| 144 | + path: externals |
| 145 | + key: external-onert-ndk-${{ hashFiles('infra/cmake/packages/**/*.cmake') }}-${{ hashFiles('infra/nnfw/cmake/packages/**/*.cmake') }} |
| 146 | + restore-keys: | |
| 147 | + external-onert-ndk- |
| 148 | + external-onert- |
| 149 | + external- |
| 150 | +
|
| 151 | + - name: Build onert |
| 152 | + run: make -f Makefile.template |
| 153 | + |
| 154 | + test-arm64-image: |
| 155 | + if: github.repository_owner == 'Samsung' |
| 156 | + needs: build-docker-image |
| 157 | + strategy: |
| 158 | + matrix: |
| 159 | + ubuntu_code: [ 'focal', 'jammy', 'noble' ] |
| 160 | + fail-fast: false |
| 161 | + runs-on: one-arm-linux |
| 162 | + container: |
| 163 | + image: nnfw/one-devtools:focal-cross-test |
| 164 | + options: --user root |
| 165 | + env: |
| 166 | + BUILD_TYPE: release |
| 167 | + CROSS_BUILD: 1 |
| 168 | + TARGET_ARCH: aarch64 |
| 169 | + OPTIONS: "-DBUILD_ARMCOMPUTE=OFF" # Disable arm compute library |
| 170 | + |
| 171 | + steps: |
| 172 | + - name: Checkout |
| 173 | + uses: actions/checkout@v4 |
| 174 | + |
| 175 | + - name: Caching externals |
| 176 | + uses: actions/cache@v4 |
| 177 | + with: |
| 178 | + path: externals |
| 179 | + key: external-onert-${{ matrix.ubuntu_code }}-${{ hashFiles('infra/cmake/packages/**/*.cmake') }}-${{ hashFiles('infra/nnfw/cmake/packages/**/*.cmake') }} |
| 180 | + restore-keys: | |
| 181 | + external-onert-${{ matrix.ubuntu_code }}- |
| 182 | + external-onert- |
| 183 | + external- |
| 184 | +
|
| 185 | + - name: Build onert |
| 186 | + run: | |
| 187 | + make -f Makefile.template |
| 188 | +
|
| 189 | + # Don't test gbs, lint image - not used on CI/CD |
| 190 | + |
| 191 | + publish-image: |
| 192 | + if: github.repository_owner == 'Samsung' |
| 193 | + needs: test-cross-image, test-x64-image, test-android-sdk-image, test-arm64-image |
| 194 | + strategy: |
| 195 | + matrix: |
| 196 | + version: [ 'android-sdk', 'focal', 'jammy', 'noble', 'gbs', 'focal-cross', 'jammy-cross', 'noble-cross', 'lint' ] |
| 197 | + include: |
| 198 | + - version: 'focal-cross' |
| 199 | + platform-add: 'linux/arm64' |
| 200 | + - version: 'jammy-cross' |
| 201 | + platform-add: 'linux/arm64' |
| 202 | + - version: 'noble-cross' |
| 203 | + platform-add: 'linux/arm64' |
| 204 | + fail-fast: false |
| 205 | + runs-on: ubuntu-latest |
| 206 | + steps: |
| 207 | + - name: Login to DockerHub |
| 208 | + uses: docker/login-action@v3 |
| 209 | + with: |
| 210 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 211 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 212 | + |
| 213 | + - name: Set up QEMU |
| 214 | + uses: docker/setup-qemu-action@v3 |
| 215 | + |
| 216 | + - name: Install Docker Buildx |
| 217 | + uses: docker/setup-buildx-action@v3 |
| 218 | + |
| 219 | + - name: Build Docker Image |
| 220 | + uses: docker/build-push-action@v6 |
| 221 | + with: |
| 222 | + file: ./infra/docker/${{ matrix.version }}/Dockerfile |
| 223 | + push: true |
| 224 | + tags: nnfw/one-devtools:${{ matrix.version }} |
| 225 | + platforms: linux/amd64${{ matrix.platform-add }} |
| 226 | + cache-from: type=gha |
| 227 | + cache-to: type=gha,mode=max |
0 commit comments