feat: Add gitlab ci to the template #1359
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: main | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
check-branch: | |
if: ${{ github.event_name == 'pull_request' }} | |
runs-on: ubuntu-latest | |
timeout-minutes: 2 | |
concurrency: | |
group: check-pr-${{ github.ref }} | |
cancel-in-progress: true | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Check if the PR's branch is updated | |
uses: osl-incubator/[email protected] | |
with: | |
remote_branch: origin/main | |
pr_sha: ${{ github.event.pull_request.head.sha }} | |
tests: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- "ubuntu" | |
- "macos" | |
- "windows" | |
runs-on: ${{ matrix.os }}-latest | |
concurrency: | |
group: ci-main-tests-${{ matrix.os }}-${{ github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache Conda packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.conda/pkgs | |
key: conda-${{ runner.os }}-${{ hashFiles('**/conda*.yaml') }} | |
restore-keys: | | |
conda-${{ runner.os }}- | |
- name: Install dependencies with conda for linux/macos | |
uses: conda-incubator/setup-miniconda@v3 | |
if: ${{ matrix.os != 'windows' }} | |
with: | |
miniforge-version: latest | |
environment-file: conda/dev.yaml | |
channels: conda-forge,nodefaults | |
activate-environment: scicookie | |
auto-update-conda: true | |
conda-solver: libmamba | |
- name: Install dependencies with conda for windows | |
uses: conda-incubator/setup-miniconda@v3 | |
if: ${{ matrix.os == 'windows' }} | |
with: | |
miniforge-version: latest | |
environment-file: conda/dev-win.yaml | |
channels: conda-forge,nodefaults | |
activate-environment: scicookie | |
auto-update-conda: true | |
conda-solver: libmamba | |
- name: Check poetry.lock | |
run: poetry check | |
- name: Install dependencies | |
run: | | |
poetry config virtualenvs.create false | |
poetry install | |
- name: Run tests | |
if: ${{ matrix.os != 'windows' }} | |
run: makim tests.unittest | |
- name: Run tests | |
if: ${{ matrix.os == 'windows' }} | |
run: pytest -s -vv --template src/scicookie tests | |
# - name: Semantic Release PR Title Check | |
# uses: osl-incubator/[email protected] | |
# if: success() || failure() | |
# with: | |
# convention-name: conventionalcommits | |
linter: | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ci-main-linter-${{ github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache Conda packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.conda/pkgs | |
key: conda-${{ runner.os }}-${{ hashFiles('**/conda*.yaml') }} | |
restore-keys: | | |
conda-${{ runner.os }}- | |
- name: Install dependencies with conda for linux/macos | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
miniforge-version: latest | |
environment-file: conda/dev.yaml | |
channels: conda-forge,nodefaults | |
activate-environment: scicookie | |
auto-update-conda: true | |
conda-solver: libmamba | |
- name: Install dependencies | |
run: | | |
poetry config virtualenvs.create false | |
poetry install | |
- name: Run style checks | |
run: | | |
pre-commit install | |
makim tests.lint | |
smoke-test: | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ci-main-smoke-${{ matrix.smoke_file }}-${{ github.ref }} | |
cancel-in-progress: true | |
strategy: | |
fail-fast: false | |
matrix: | |
smoke_file: | |
- automation.sh | |
- auto-format-tools.sh | |
- build-systems.sh | |
- ci.sh | |
- containers.sh | |
- docs-jupyter-book.sh | |
- docs-mkdocs.sh | |
- docs-quarto.sh | |
- docs-sphinx.sh | |
- files.sh | |
- linters.sh | |
- tests.sh | |
- virtual-envs.sh | |
- cli.sh | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: conda-incubator/setup-miniconda@v3 | |
with: | |
miniforge-version: latest | |
environment-file: conda/dev.yaml | |
channels: conda-forge,nodefaults | |
activate-environment: scicookie | |
auto-update-conda: true | |
conda-solver: libmamba | |
- name: Install dependencies | |
run: poetry install | |
- name: Run Smoke Test (${{ matrix.smoke_file }}) | |
run: bash ./tests/smoke/${{ matrix.smoke_file }} |