Run Tests & Lint #252
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: Run Tests & Lint | |
on: | |
workflow_call: | |
pull_request: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
lint: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ^3.10 | |
cache: "pip" | |
- name: Install dependencies | |
run: pip3 install -r requirements.txt | |
- name: Check if the lint configuration matches the one in the DAS repository. | |
run: |- | |
config_files=(".black.cfg" ".flake8.cfg" ".isort.cfg") | |
for config_file in "${config_files[@]}"; do | |
master_lint=$(curl -s https://raw.githubusercontent.com/singnet/das/master/.lint/${config_file} | shasum -a 256 | cut -d ' ' -f 1) | |
local_lint=$(shasum -a 256 ${config_file} | cut -d ' ' -f 1) | |
if [ "$master_lint" != "$local_lint" ]; then | |
echo "The local lint configuration differs from the one in the DAS repository." | |
exit 1 | |
fi | |
done | |
echo "All lint configurations match the ones in the DAS repository." | |
- name: Perform Code Linting | |
run: make lint | |
unit-tests: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ^3.10 | |
cache: "pip" | |
- name: Install dependencies | |
run: pip3 install -r das-query-engine/requirements.txt | |
- name: Execute Unit Test Suite | |
run: make unit-tests | |
coverage: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ^3.10 | |
cache: "pip" | |
- name: Install dependencies | |
run: pip3 install -r das-query-engine/requirements.txt | |
- name: Generate Coverage Report | |
run: make unit-tests-coverage | |
integration-tests: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ^3.10 | |
cache: "pip" | |
- name: Install dependencies | |
run: pip3 install -r das-query-engine/requirements.txt | |
- name: Set dotenv | |
run: cp .env.example .env | |
- name: Perform Integration Testing | |
run: make integration-tests |