Skip to content

SBRA-731 Clean trainer (#76) #402

SBRA-731 Clean trainer (#76)

SBRA-731 Clean trainer (#76) #402

Workflow file for this run

name: ai4sim-ci-cd
on: [push, pull_request]
permissions:
actions: write
checks: write
contents: write
pull-requests: write
jobs:
run-checks:
runs-on: ubuntu-latest
strategy:
matrix:
model-project:
- reactive-flows/cnf-combustion/gnns
- reactive-flows/cnf-combustion/unets
- weather-forecast/gravity-wave-drag/cnns
- weather-forecast/ecrad-3d-correction/unets
fail-fast: false
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Read model-project env.yaml file
uses: pietrobolcato/[email protected]
id: uc_env
with:
config: ${{ matrix.model-project }}/env.yaml
- name: Set up Python ${{ steps.uc_env.outputs['python_version'] }}
uses: actions/setup-python@v2
with:
python-version: ${{ steps.uc_env.outputs['python_version'] }}
- name: Install nox build tool
run: pip3 install $(grep nox== ${{ matrix.model-project }}/requirements.txt)
- name: Analysing the code with flake8
working-directory: ${{ matrix.model-project }}
run: nox -s lint -v
- name: Analysing the code with isort
working-directory: ${{ matrix.model-project }}
run: nox -s import_sort -v -- check-only
- name: Analysing the code with black
working-directory: ${{ matrix.model-project }}
run: nox -s black -v -- check-only
- name: Run unit tests with coverage report
working-directory: ${{ matrix.model-project }}
run: nox -s tests -v
- name: Run functional tests
working-directory: ${{ matrix.model-project }}
run: nox -s train_test -v -- clean_data
- name: Combine coverage reports
working-directory: ${{ matrix.model-project }}
run: nox -s coverage_report -R -v -- combine
- name: Coverage Commentator
uses: 5monkeys/cobertura-action@master
with:
path: ${{ matrix.model-project }}/.ci-reports/pycoverage.xml
repo_token: ${{ secrets.GITHUB_TOKEN }}
minimum_coverage: 0
fail_below_threshold: false
show_missing: true
link_missing_lines: true
link_missing_lines_source_dir: ${{ matrix.model-project }}
report_name: Coverage report for ${{ matrix.model-project }} model project
dependabot-auto-merge:
runs-on: ubuntu-latest
needs: run-checks
if: github.event.pull_request.user.login == 'dependabot[bot]'
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Approve a PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}