-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
114 lines (105 loc) · 2.66 KB
/
.gitlab-ci.yml
File metadata and controls
114 lines (105 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
image: python:3.11
stages:
- lint
- test
- deploy
before_script:
- export PATH=$HOME/.local/bin:$PATH
- python -m pip install --upgrade pip
- pip install .[dev,test]
lint:
stage: lint
script:
- ruff check src/
- ruff format --check src/
- mypy src/ --ignore-missing-imports
pytest:
stage: test
parallel:
matrix:
- PYTHON_VERSION: ["3.8", "3.9", "3.10", "3.11", "3.12"]
image: python:$PYTHON_VERSION
script:
- pip install .[test]
- python -m pytest tests/ --cov=src/airsspy --cov-report=xml
- python -m coverage report
coverage: '/TOTAL.*\s+(\d+%)$/'
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
buildcell_check:
# Test building with buildcell and run tests
stage: test
image: python:3.11
script:
# Install system dependencies
- apt-get update
- apt-get install -y gfortran liblapack-dev libopenblas-dev curl
# Install Python dependencies
- pip install .[test]
# Get and compile AIRSS 0.9.1
- curl -L -o AIRSS.tgz http://bit.ly/2KtvEWU
- tar zxf AIRSS.tgz
- cd airss-0.9.1 ; export FC=gfortran ; make all; make install
- export PATH=$(pwd)/bin:$PATH
- cd ../
# Run buildcell-specific tests
- python -m pytest tests/test_build.py -v
rules:
- if: $CI_COMMIT_BRANCH == "master"
- if: $CI_COMMIT_BRANCH == "main"
build_docker:
# Test building docker image using repo2docker
stage: test
image: docker:stable
services:
- docker:dind
before_script:
- echo '0. Installing dependencies...'
- apk add --no-cache pigz python3
- python3 -m venv venv
- . venv/bin/activate
- pip install jupyter-repo2docker
script:
- export VERSION=$(python3 -c "import repo2docker; print(repo2docker.__version__)")
- jupyter-repo2docker --debug --image-name "airsspy-repo2docker:test" --user-id 1000 --user-name bz1 --no-run .
- docker ps
- docker images
only:
- master
build_package:
stage: deploy
script:
- pip install build
- python -m build
artifacts:
paths:
- dist/
only:
- tags
- master
stage_production:
stage: deploy
needs: [build_package]
variables:
TWINE_USERNAME: $STAGE_USERNAME
TWINE_PASSWORD: $STAGE_PASSWORD
script:
- twine check dist/*
- twine upload --repository-url $PACKAGR_REPOSITORY_URL dist/*
rules:
- if: $CI_COMMIT_BRANCH == "master"
when: manual
deploy_production:
stage: deploy
needs: [build_package]
variables:
TWINE_USERNAME: $PRODUCTION_USERNAME
TWINE_PASSWORD: $PRODUCTION_PASSWORD
script:
- twine check dist/*
- twine upload dist/*
rules:
- if: $CI_COMMIT_TAG