Redo CI to run on armv6
I've refactored the CI substantially, using the new `extends` keyword to tidy it up a lot. I have also changed from running the Python tests on Python:3.7 to using a Raspberry Pi OS from the Balena project. This means we are now ONLY locking dependencies for the Pi, and we are no longer expecting the Pipfile to work on non-arm systems.
This commit is contained in:
parent
fdafeca446
commit
d0aad6633c
1 changed files with 26 additions and 83 deletions
109
.gitlab-ci.yml
109
.gitlab-ci.yml
|
|
@ -6,8 +6,12 @@ stages:
|
||||||
- deploy
|
- deploy
|
||||||
|
|
||||||
# Re-usable block to install (and cache) Poetry and openflexure-microscope-server
|
# Re-usable block to install (and cache) Poetry and openflexure-microscope-server
|
||||||
.python-install-template: &python-install
|
.python:
|
||||||
|
image: balenalib/raspberry-pi:buster
|
||||||
|
retry: 1
|
||||||
before_script:
|
before_script:
|
||||||
|
- apt-get update
|
||||||
|
- apt-get install python3 python3-pip python3-venv
|
||||||
- python3 -m venv .venv # NB this does not overwrite an existing cached venv
|
- python3 -m venv .venv # NB this does not overwrite an existing cached venv
|
||||||
- source .venv/bin/activate
|
- source .venv/bin/activate
|
||||||
- pip install pipenv # Should be cached after first run
|
- pip install pipenv # Should be cached after first run
|
||||||
|
|
@ -17,9 +21,14 @@ stages:
|
||||||
paths:
|
paths:
|
||||||
- .cache/pip
|
- .cache/pip
|
||||||
- .venv
|
- .venv
|
||||||
|
only:
|
||||||
|
- branches
|
||||||
|
- merge_requests
|
||||||
|
- tags
|
||||||
|
- web
|
||||||
|
|
||||||
# Re-usable block to install (and cache) openflexure-microscope-server static app
|
.javascript:
|
||||||
.node-install-template: &node-install
|
image: node:15
|
||||||
before_script:
|
before_script:
|
||||||
- cd webapp
|
- cd webapp
|
||||||
- npm install
|
- npm install
|
||||||
|
|
@ -27,95 +36,54 @@ stages:
|
||||||
key: "${CI_COMMIT_REF_SLUG}"
|
key: "${CI_COMMIT_REF_SLUG}"
|
||||||
paths:
|
paths:
|
||||||
- webapp/node_modules
|
- webapp/node_modules
|
||||||
|
|
||||||
# Python static analysis with PyLint
|
|
||||||
pylint:
|
|
||||||
stage: analysis
|
|
||||||
image: python:3.7
|
|
||||||
retry: 1
|
|
||||||
|
|
||||||
<<: *python-install
|
|
||||||
|
|
||||||
script:
|
|
||||||
- poe pylint
|
|
||||||
|
|
||||||
only:
|
only:
|
||||||
- branches
|
- branches
|
||||||
- merge_requests
|
- merge_requests
|
||||||
- tags
|
- tags
|
||||||
- web
|
- web
|
||||||
|
|
||||||
|
# Python static analysis with PyLint
|
||||||
|
pylint:
|
||||||
|
stage: analysis
|
||||||
|
extends: .python
|
||||||
|
script:
|
||||||
|
- poe pylint
|
||||||
|
|
||||||
# Python type checking with Mypy
|
# Python type checking with Mypy
|
||||||
mypy:
|
mypy:
|
||||||
stage: analysis
|
stage: analysis
|
||||||
image: python:3.7
|
extends: .python
|
||||||
retry: 1
|
|
||||||
|
|
||||||
<<: *python-install
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- poe mypy
|
- poe mypy
|
||||||
|
|
||||||
artifacts:
|
artifacts:
|
||||||
reports:
|
reports:
|
||||||
coverage_report:
|
coverage_report:
|
||||||
coverage_format: cobertura
|
coverage_format: cobertura
|
||||||
path: openflexure_microscope/cobertura.xml
|
path: openflexure_microscope/cobertura.xml
|
||||||
|
|
||||||
only:
|
|
||||||
- branches
|
|
||||||
- merge_requests
|
|
||||||
- tags
|
|
||||||
- web
|
|
||||||
|
|
||||||
# Python style analysis with Black
|
# Python style analysis with Black
|
||||||
black:
|
black:
|
||||||
stage: analysis
|
stage: analysis
|
||||||
image: python:3.7
|
|
||||||
retry: 1
|
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
|
extends: .python
|
||||||
<<: *python-install
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
# Run static build script
|
|
||||||
- poe black_check
|
- poe black_check
|
||||||
|
|
||||||
only:
|
|
||||||
- branches
|
|
||||||
- merge_requests
|
|
||||||
- tags
|
|
||||||
- web
|
|
||||||
|
|
||||||
# Python unit tests with PyTest
|
# Python unit tests with PyTest
|
||||||
pytest:
|
pytest:
|
||||||
stage: testing
|
stage: testing
|
||||||
image: python:3.7
|
extends: .python
|
||||||
retry: 1
|
|
||||||
|
|
||||||
<<: *python-install
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- poe test
|
- poe test
|
||||||
|
|
||||||
only:
|
|
||||||
- branches
|
|
||||||
- merge_requests
|
|
||||||
- tags
|
|
||||||
- web
|
|
||||||
|
|
||||||
artifacts:
|
artifacts:
|
||||||
when: always
|
when: always
|
||||||
reports:
|
reports:
|
||||||
junit: pytest_report.xml
|
junit: pytest_report.xml
|
||||||
|
|
||||||
|
# Generate and validate OpenAPI description
|
||||||
openapi:
|
openapi:
|
||||||
stage: testing
|
stage: testing
|
||||||
image: python:3.7
|
extends: .python
|
||||||
retry: 1
|
|
||||||
|
|
||||||
<<: *python-install
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- mkdir -p docs/build/
|
- mkdir -p docs/build/
|
||||||
- ofm-generate-openapi -o docs/build/swagger.yaml --validate
|
- ofm-generate-openapi -o docs/build/swagger.yaml --validate
|
||||||
|
|
@ -126,52 +94,27 @@ openapi:
|
||||||
paths:
|
paths:
|
||||||
- "./docs/build/swagger.yaml"
|
- "./docs/build/swagger.yaml"
|
||||||
|
|
||||||
only:
|
|
||||||
- branches
|
|
||||||
- merge_requests
|
|
||||||
- tags
|
|
||||||
- web
|
|
||||||
|
|
||||||
# JavaScript linting with ESLint (via Vue CLI)
|
# JavaScript linting with ESLint (via Vue CLI)
|
||||||
eslint:
|
eslint:
|
||||||
stage: analysis
|
stage: analysis
|
||||||
image: node:15
|
extends: .javascript
|
||||||
|
|
||||||
<<: *node-install
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
# Build JS application for production
|
# Build JS application for production
|
||||||
- npm run lint
|
- npm run lint
|
||||||
|
|
||||||
only:
|
|
||||||
- branches
|
|
||||||
- merge_requests
|
|
||||||
- tags
|
|
||||||
- web
|
|
||||||
|
|
||||||
# Build JS app
|
# Build JS app
|
||||||
build:
|
build:
|
||||||
stage: build
|
stage: build
|
||||||
image: node:15
|
extends: .javascript
|
||||||
|
|
||||||
<<: *node-install
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
# Build JS application for production
|
# Build JS application for production
|
||||||
- npm run build
|
- npm run build
|
||||||
|
|
||||||
artifacts:
|
artifacts:
|
||||||
name: "dist"
|
name: "dist"
|
||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
paths:
|
paths:
|
||||||
- "openflexure_microscope/api/static/dist/"
|
- "openflexure_microscope/api/static/dist/"
|
||||||
|
|
||||||
only:
|
|
||||||
- master
|
|
||||||
- merge_requests
|
|
||||||
- tags
|
|
||||||
- web
|
|
||||||
|
|
||||||
# Package application into distribution tarball
|
# Package application into distribution tarball
|
||||||
package:
|
package:
|
||||||
stage: package
|
stage: package
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue