1
0
Fork 0
onnx-web/.gitlab-ci.yml

223 lines
4.2 KiB
YAML
Raw Normal View History

2023-01-05 19:12:36 +00:00
stages:
- build
- package
.build-base:
tags:
- platform:k8s
- runner:shared
.build-node:
extends:
- .build-base
image: docker.io/node:18
artifacts:
expire_in: 1 day
paths:
- gui/out/
reports:
coverage_report:
coverage_format: cobertura
path: gui/out/coverage/cobertura-coverage.xml
junit: gui/out/test-results.xml
cache:
key:
files:
- gui/yarn.lock
2023-01-05 19:12:36 +00:00
paths:
- gui/node_modules/
policy: pull-push
.build-oci:
extends:
- .build-base
image: docker.io/docker:20.10
services:
- docker.io/docker:20.10-dind
allow_failure: false
before_script:
- mkdir ${HOME}/.docker
- echo "${DOCKER_SECRET}" | base64 -d > ${HOME}/.docker/config.json
after_script:
- rm -rfv ${HOME}/.docker
variables:
DOCKER_CERT_PATH: "/shared/docker/client"
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://localhost:2376
DOCKER_NAME: "${CI_PROJECT_PATH}"
DOCKER_TLS_CERTDIR: "/shared/docker"
DOCKER_TLS_VERIFY: 1
VERSION_TAG: "${CI_COMMIT_REF_SLUG}"
2023-01-06 18:50:31 +00:00
.build-python:
2023-01-05 19:12:36 +00:00
extends:
- .build-base
2023-01-06 18:50:31 +00:00
image: docker.io/python:3.10
cache:
key:
files:
- api/requirements.txt
paths:
- api/onnx_env/
policy: pull-push
2023-01-05 19:12:36 +00:00
.build-curl:
extends:
- .build-python
cache: {}
build-api-coverage:
extends:
- .build-python
stage: build
script:
- cd api
- ${CI_PROJECT_DIR}/common/scripts/make-venv.sh
- make ci
2023-01-06 18:50:31 +00:00
build-gui-bundle:
2023-01-05 19:12:36 +00:00
extends:
- .build-node
stage: build
script:
- cd gui
- make ci
# packages, various
.package-api-oci:
2023-01-06 18:50:31 +00:00
extends:
- .build-oci
stage: package
needs:
- build-api-coverage
- build-gui-bundle
2023-01-06 18:50:31 +00:00
script:
- mv -v gui/out/config.json gui/out/index.html api/gui/
- mv -v gui/out/bundle/main.js api/gui/bundle/
2023-01-06 18:50:31 +00:00
- cd api
- ${CI_PROJECT_DIR}/common/scripts/image-build.sh --push
variables:
IMAGE_ROOT: "${CI_PROJECT_DIR}/api"
IMAGE_SUFFIX: api
2023-01-06 18:50:31 +00:00
.package-gui-oci:
2023-01-05 19:12:36 +00:00
extends:
- .build-oci
2023-01-05 19:12:36 +00:00
stage: package
needs:
2023-01-06 18:50:31 +00:00
- build-gui-bundle
2023-01-05 19:12:36 +00:00
script:
- cd gui
- ${CI_PROJECT_DIR}/common/scripts/image-build.sh --push
variables:
IMAGE_ROOT: "${CI_PROJECT_DIR}/gui"
IMAGE_SUFFIX: gui
2023-01-05 19:12:36 +00:00
2023-01-06 19:58:19 +00:00
# no API image for alpine: https://github.com/microsoft/onnxruntime/issues/2909#issuecomment-593591317
package-api-oci:
2023-01-07 15:55:30 +00:00
extends:
- .package-api-oci
parallel:
matrix:
- IMAGE_ARCH: cpu-buster
IMAGE_FILE: Containerfile.cpu.buster
- IMAGE_ARCH: cuda-ubuntu
IMAGE_FILE: Containerfile.cuda.ubuntu
2023-02-05 03:53:03 +00:00
# TODO: ROCm image build keeps running out of disk
# IMAGE_ARCH: rocm-ubuntu
# IMAGE_FILE: Containerfile.rocm.ubuntu
package-gui-oci:
extends:
- .package-gui-oci
parallel:
matrix:
- IMAGE_ARCH: nginx-alpine
IMAGE_FILE: Containerfile.nginx.alpine
- IMAGE_ARCH: nginx-bullseye
IMAGE_FILE: Containerfile.nginx.bullseye
- IMAGE_ARCH: node-alpine
IMAGE_FILE: Containerfile.node.alpine
- IMAGE_ARCH: node-buster
IMAGE_FILE: Containerfile.node.buster
# language-specific packages
package-api-twine:
extends:
- .build-python
stage: package
needs:
- build-api-coverage
only:
- tags
script:
- cd api
- python -m build
- twine check dist/*
- twine upload dist/*
artifacts:
expire_in: 7 days
paths:
- dist/
package-api-twine-dry:
extends:
2023-02-12 03:21:47 +00:00
- package-api-twine
2023-02-12 03:26:19 +00:00
only: ~
except:
- tags
script:
- cd api
- python -m build
- twine check dist/*
package-gui-npm:
2023-01-05 19:12:36 +00:00
extends:
- .build-node
stage: package
needs:
2023-02-12 03:25:03 +00:00
- build-gui-bundle
2023-01-05 19:12:36 +00:00
only:
- tags
script:
- cd gui
2023-01-05 19:12:36 +00:00
- npm publish
artifacts:
expire_in: 7 days
paths:
- apextoaster-onnx-web-*.tgz
package-gui-npm-dry:
extends:
2023-02-12 03:25:03 +00:00
- package-gui-npm
2023-02-12 03:26:19 +00:00
only: ~
except:
- tags
script:
- cd gui
- npm pack
# commit status
github-pending:
stage: .pre
extends:
- .build-curl
script:
- ./common/scripts/github-status.sh pending
github-failure:
stage: .post
extends:
- .build-curl
when: on_failure
script:
- ./common/scripts/github-status.sh failure
github-success:
stage: .post
extends:
- .build-curl
when: on_success
script:
- ./common/scripts/github-status.sh success