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:
Richard Bowman 2023-04-06 15:20:48 +01:00
parent fdafeca446
commit d0aad6633c

View file

@ -6,8 +6,12 @@ stages:
- deploy
# 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:
- apt-get update
- apt-get install python3 python3-pip python3-venv
- python3 -m venv .venv # NB this does not overwrite an existing cached venv
- source .venv/bin/activate
- pip install pipenv # Should be cached after first run
@ -17,9 +21,14 @@ stages:
paths:
- .cache/pip
- .venv
only:
- branches
- merge_requests
- tags
- web
# Re-usable block to install (and cache) openflexure-microscope-server static app
.node-install-template: &node-install
.javascript:
image: node:15
before_script:
- cd webapp
- npm install
@ -27,95 +36,54 @@ stages:
key: "${CI_COMMIT_REF_SLUG}"
paths:
- webapp/node_modules
# Python static analysis with PyLint
pylint:
stage: analysis
image: python:3.7
retry: 1
<<: *python-install
script:
- poe pylint
only:
- branches
- merge_requests
- tags
- web
# Python static analysis with PyLint
pylint:
stage: analysis
extends: .python
script:
- poe pylint
# Python type checking with Mypy
mypy:
stage: analysis
image: python:3.7
retry: 1
<<: *python-install
extends: .python
script:
- poe mypy
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: openflexure_microscope/cobertura.xml
only:
- branches
- merge_requests
- tags
- web
# Python style analysis with Black
black:
stage: analysis
image: python:3.7
retry: 1
allow_failure: true
<<: *python-install
extends: .python
script:
# Run static build script
- poe black_check
only:
- branches
- merge_requests
- tags
- web
# Python unit tests with PyTest
pytest:
stage: testing
image: python:3.7
retry: 1
<<: *python-install
extends: .python
script:
- poe test
only:
- branches
- merge_requests
- tags
- web
artifacts:
when: always
reports:
junit: pytest_report.xml
# Generate and validate OpenAPI description
openapi:
stage: testing
image: python:3.7
retry: 1
<<: *python-install
extends: .python
script:
- mkdir -p docs/build/
- ofm-generate-openapi -o docs/build/swagger.yaml --validate
@ -125,53 +93,28 @@ openapi:
expire_in: 1 week
paths:
- "./docs/build/swagger.yaml"
only:
- branches
- merge_requests
- tags
- web
# JavaScript linting with ESLint (via Vue CLI)
eslint:
stage: analysis
image: node:15
<<: *node-install
extends: .javascript
script:
# Build JS application for production
- npm run lint
only:
- branches
- merge_requests
- tags
- web
# Build JS app
build:
stage: build
image: node:15
<<: *node-install
extends: .javascript
script:
# Build JS application for production
- npm run build
artifacts:
name: "dist"
expire_in: 1 week
paths:
- "openflexure_microscope/api/static/dist/"
only:
- master
- merge_requests
- tags
- web
# Package application into distribution tarball
package:
stage: package