-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from BBMRI-cz/CI_pipeline
Ci pipeline
- Loading branch information
Showing
3 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash -e | ||
|
||
URL=$1 | ||
START_EPOCH="$(date +"%s")" | ||
|
||
eclipsed() { | ||
EPOCH="$(date +"%s")" | ||
echo $((EPOCH - START_EPOCH)) | ||
} | ||
|
||
# wait at maximum 120 seconds | ||
while [[ ($(eclipsed) -lt 120) && ("$(curl -s -o /dev/null -w '%{response_code}' "$URL")" != "200") ]]; do | ||
sleep 2 | ||
done |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: CI test | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
|
||
|
||
jobs: | ||
py-lint: | ||
name: Lint | ||
continue-on-error: true | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
cache: 'pip' | ||
|
||
- name: Install python dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Run pylint | ||
run: pylint --recursive=y . | ||
|
||
unit-tests: | ||
name: Unit tests | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
cache: 'pip' | ||
|
||
- name: Run unit tests | ||
run: make test | ||
|
||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
flags: unit | ||
|
||
integration-tests: | ||
needs: unit-tests | ||
name: Integration tests | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
cache: 'pip' | ||
|
||
- name: Run integration tests | ||
run: make integration | ||
|
||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
flags: integration |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
PYTHON_INTERPRETER = python3 | ||
PYTEST_COMMAND = $(PYTHON_INTERPRETER) -m pytest | ||
PYTEST_ARGS = -v -p no:cacheprovider --cov-report=xml --cov=./ | ||
|
||
.PHONY: test setup clean validate | ||
setup: requirements.txt ## Install required packages | ||
pip install -r requirements.txt | ||
test: setup ## Run unit test | ||
$(PYTEST_COMMAND) $(PYTEST_ARGS) test/unit | ||
integration: setup ## Run integration test | ||
docker run --name blaze --rm -d -e JAVA_TOOL_OPTIONS=-Xmx2g -p 8080:8080 samply/blaze:latest | ||
.github/scripts/wait-for-url.sh http://localhost:8080/health | ||
$(PYTEST_COMMAND) $(PYTEST_ARGS) test/service | ||
docker stop blaze | ||
clean: | ||
rm -rf __pycache__ |