-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.gitlab-ci.yml
47 lines (42 loc) · 1.98 KB
/
.gitlab-ci.yml
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
# GitLab CI/CD pipeline to continuously build, test, deploy, and monitor iterative code changes.
#
# This file specifies the stages, jobs, and scripts to be executed during your CI/CD pipeline.
# It is a YAML file with its own custom syntax.
# The order of the items in stages defines the execution order for jobs.
# If any job fails, the pipeline is marked as failed and jobs in later stages do not start.
stages:
- test
default: # Set default keywords for all jobs that don't alread have it defined.
image: continuumio/miniconda3:latest # Run in docker container with python, conda, pip, setuptools, etc.
tags: # Specify runner to run job (Seems like INRIA shared runners are not allowed to run untagged jobs).
- ci.inria.fr
- small
cache: # List of files and directories to cache between jobs and pipelines.
paths:
- .env/
before_script:
- conda create -p .env/ python=3.10 || true # Store environment inside directory
- shopt -s expand_aliases
- alias envrun="conda run -p .env/" # Use conda run instead since conda activate does not work.
- envrun pip install .
- envrun pip install --no-dependencies tensordict
- envrun python -V
- pwd
- envrun python -c "import sys; print('\n'.join(sys.path))" # Print Python path.
variables: # Change pip's cache directory to be inside the project directory since we can only cache local items.
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
# Job to run unit tests.
pytest:
stage: test
script:
- envrun python -m pytest --disable-warnings --junitxml=pytest-report.xml tests/ # Run all tests under tests/ dir and save report.
# Gitlab will upload these files and attach to the job.
artifacts:
when: always # Whether job succeeds or fails.
reports:
junit: pytest-report.xml # Specify that pytest-report.xml is a JUnit-style test report
lint:
stage: test
script:
- envrun pip install ruff==0.5.3
- envrun ruff check # Check linter.