From f8c54de246ebc8f59432075bdda6b603fec3517b Mon Sep 17 00:00:00 2001 From: henrykironde Date: Tue, 21 Feb 2023 22:18:51 -0500 Subject: [PATCH] Add github actions for syntax testing --- .github/workflows/python-package-conda.yml | 40 ++++++++++++++++++++++ .style.yapf | 4 +++ dev_environment.yml | 9 +++++ 3 files changed, 53 insertions(+) create mode 100644 .github/workflows/python-package-conda.yml create mode 100644 .style.yapf create mode 100644 dev_environment.yml diff --git a/.github/workflows/python-package-conda.yml b/.github/workflows/python-package-conda.yml new file mode 100644 index 0000000..fd1d35e --- /dev/null +++ b/.github/workflows/python-package-conda.yml @@ -0,0 +1,40 @@ +name: YAPF Google chromium style + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + ci: + name: "CI setup" + + strategy: + fail-fast: false + matrix: + python-version: + - 3.9 + os: + - "ubuntu-latest" + + runs-on: "${{ matrix.os }}" + + # use bash everywhere + defaults: + run: + shell: "bash -l {0}" + + steps: + - uses: actions/checkout@v3 + - uses: mamba-org/provision-with-micromamba@v15 + with: + environment-name: Zooniverse + environment-file: Zooniverse/dev_environment.yml + python-version: "${{ matrix.python-version }}" + cache-env: true + cache-downloads: true + + - name: "Run tests" + run: | + yapf -d --recursive ./Zooniverse/ --style=.style.yapf 2>&1 diff --git a/.style.yapf b/.style.yapf new file mode 100644 index 0000000..82a4cf2 --- /dev/null +++ b/.style.yapf @@ -0,0 +1,4 @@ +[style] +# YAPF uses the chromium style +based_on_style = google +COLUMN_LIMIT=120 diff --git a/dev_environment.yml b/dev_environment.yml new file mode 100644 index 0000000..93122ee --- /dev/null +++ b/dev_environment.yml @@ -0,0 +1,9 @@ +name: Zooniverse +channels: [conda-forge] +dependencies: + - python + - yapf + - black + - pytest-cov + - pytest-xdist + - pdoc