Feature/bespoke data partners (#231) #1624
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: Unit Tests | |
on: [push] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
max-parallel: 4 | |
matrix: | |
python-version: ["3.10"] | |
os: [ubuntu-latest] | |
steps: | |
- name: Checkout ${{ matrix.python-version }} | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies # TODO: checkout observatory platform from same branch, e.g. develop or master | |
run: | | |
python -m pip install --upgrade pip | |
cd .. | |
# Clone protection required until fix - https://github.com/git-lfs/git-lfs/issues/5749 | |
export GIT_CLONE_PROTECTION_ACTIVE=false | |
git clone -b feature/astro-refactor https://github.com/The-Academic-Observatory/observatory-platform.git | |
cd observatory-platform | |
pip install -e .[tests] --constraint https://raw.githubusercontent.com/apache/airflow/constraints-2.7.3/constraints-no-providers-${{ matrix.python-version }}.txt | |
cd .. | |
cd oaebu-workflows | |
pip install -r requirements.txt --constraint https://raw.githubusercontent.com/apache/airflow/constraints-2.7.3/constraints-no-providers-${{ matrix.python-version }}.txt | |
- name: Add dag folder to PYTHONPATH | |
run: | | |
echo "PYTHONPATH=$HOME/work/oaebu-workflows/oaebu-workflows/dags" >> "$GITHUB_ENV" | |
# Required for testing ONIX Telescope | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: "11" | |
distribution: "adopt" | |
- name: Check licenses | |
run: | | |
# stop the build if there are licensing issues | |
liccheck --sfile strategy.ini --rfile requirements.txt --level CAUTIOUS --reporting liccheck-output.txt --no-deps | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Run unit tests with coverage | |
env: | |
TEST_GCP_DATA_LOCATION: ${{ secrets.TEST_GCP_DATA_LOCATION }} | |
TEST_GCP_PROJECT_ID: ${{ secrets.TEST_GCP_PROJECT_ID }} | |
TEST_GCP_SERVICE_KEY: ${{ secrets.TEST_GCP_SERVICE_KEY }} | |
GOOGLE_APPLICATION_CREDENTIALS: /tmp/google_application_credentials.json | |
AIRFLOW__CORE__LOAD_EXAMPLES: false | |
run: | | |
echo "${TEST_GCP_SERVICE_KEY}" | base64 --decode > /tmp/google_application_credentials.json | |
coverage run -m unittest discover -v | |
coverage xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v1 | |
with: | |
file: ./coverage.xml | |
fail_ci_if_error: false |