CI #1876
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
# -*- coding: utf-8 -*- | |
# | |
# Copyright (C) 2020 CERN. | |
# | |
# CDS-ILS is free software; you can redistribute it and/or modify it | |
# under the terms of the MIT License; see LICENSE file for more details. | |
name: CI | |
on: | |
push: | |
branches: master | |
pull_request: | |
branches: master | |
schedule: | |
# * is a special character in YAML so you have to quote this string | |
- cron: "0 3 * * 6" | |
workflow_dispatch: | |
inputs: | |
reason: | |
description: "Reason" | |
required: false | |
default: "Manual trigger" | |
jobs: | |
Python_Tests: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
# NOTE: add back test for python 3.9 | |
# python-version: [3.6, 3.9] | |
python-version: [3.6] | |
db-service: [postgresql12] | |
search-service: [opensearch2] | |
env: | |
DB: ${{ matrix.db-service }} | |
SEARCH: ${{ matrix.search-service }} | |
EXTRAS: tests | |
steps: | |
- name: Install ldap dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Generate dependencies | |
run: | | |
python -m pip install setuptools">=57.0.0,<58.0.0" | |
python -m pip install --upgrade pip py wheel requirements-builder | |
requirements-builder -e $EXTRAS --level=pypi setup.py > .pypi-${{ matrix.python-version }}-requirements.txt | |
- name: Cache pip | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('.pypi-${{ matrix.python-version }}-requirements.txt') }} | |
- name: Install dependencies | |
run: | | |
pip install -r .pypi-${{ matrix.python-version }}-requirements.txt | |
pip install .[$EXTRAS] | |
pip freeze | |
docker --version | |
docker-compose --version | |
- name: Run tests | |
run: | | |
./run-tests.sh | |
Node_Tests: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Use Node.js v14.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "14.x" | |
- name: Install & Build | |
working-directory: ./ui | |
run: npm ci | |
- name: Lint | |
working-directory: ./ui | |
run: npm run lint | |
env: | |
# avoid fail on warnings | |
CI: false | |
- name: Build | |
working-directory: ./ui | |
run: npm run build | |
env: | |
# avoid fail on warnings | |
CI: false |