Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial gitlab-ci workflow file #477

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Added

* Added `gitlab-ci.yml` file for GitLab alternative to GitHub Actions [#452](https://github.com/NLeSC/python-template/issues/452)
* Added Python 3.12 support [#356](https://github.com/NLeSC/python-template/issues/356)
* Template unit tests for documentation generation, linting and version bumping
* Docstring for function
Expand Down
59 changes: 59 additions & 0 deletions template/.gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Change pip's cache directory to be inside the project directory since we can
# only cache local items.
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"

cache:
paths:
- .cache/pip

test:
stage: test
image: "python:$VERSION"
rules:
# Run on a Merge Request to the default branch
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH
# Run on new commits to the default branch
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
parallel:
matrix:
- VERSION: ['3.8', '3.9', '3.10', '3.11', '3.12']
before_script:
# Python info
- which python
- python --version
# Install dependencies
- python -m pip install --upgrade pip setuptools
- python -m pip install --editable ".[dev]"
script:
# Run pytest
- python -m pytest -v --durations=0

cffconvert:
stage: test
image:
name: "citationcff/cffconvert:2.0.0"
entrypoint: [""]
rules:
# Run on a Merge Request to the default branch
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH
# Run on new commits to the default branch
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
changes:
- CITATION.cff
script:
# Check whether the citation metadata from CITATION.cff is valid
- cffconvert --validate

markdown-link-check:
stage: test
image:
name: "lycheeverse/lychee"
entrypoint: [""]
rules:
# Run on a Merge Request to the default branch
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH
# Run on new commits to the default branch
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
script:
- lychee .
Loading