From 569e8d4a9a6b340d1f7dee50602392b73fd9c6d0 Mon Sep 17 00:00:00 2001 From: jdebacker Date: Tue, 16 Jul 2024 20:52:39 -0400 Subject: [PATCH] add other actions --- .github/workflows/build_and_test.yml | 63 ++++++++++++++++++++++++++ .github/workflows/check_docs.yml | 34 ++++++++++++++ .github/workflows/check_formatting.yml | 14 ++++++ 3 files changed, 111 insertions(+) create mode 100644 .github/workflows/build_and_test.yml create mode 100644 .github/workflows/check_docs.yml create mode 100644 .github/workflows/check_formatting.yml diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml new file mode 100644 index 0000000..21b6e22 --- /dev/null +++ b/.github/workflows/build_and_test.yml @@ -0,0 +1,63 @@ +name: Build and test +on: + push: + paths: + - '**.yml' + - '**.toml' + - '**.ini' + - '**.py' + - '**.json' + - '**.csv' + - '**.pkl' + - '**.pbz2' + pull_request: + paths: + - '**.yml' + - '**.toml' + - '**.ini' + - '**.py' + - '**.json' + - '**.csv' + - '**.pkl' + - '**.pbz2' +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + python-version: ["3.10", "3.11", "3.12"] + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Setup Miniconda using Python ${{ matrix.python-version }} + uses: conda-incubator/setup-miniconda@v3 + with: + miniforge-variant: Mambaforge + auto-update-conda: true + activate-environment: cge_env + environment-file: environment.yml + python-version: ${{ matrix.python-version }} + auto-activate-base: false + - name: Build + shell: bash -l {0} + run: | + pip install -e . + - name: Test + shell: bash -l {0} + working-directory: ./ + run: | + python -m pytest + - name: Upload coverage to Codecov + if: matrix.os == 'ubuntu-latest' && contains(github.repository, 'PSLmodels/CGE') + uses: codecov/codecov-action@v4 + with: + files: ./coverage.xml + flags: unittests + name: codecov-umbrella + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: true + verbose: true \ No newline at end of file diff --git a/.github/workflows/check_docs.yml b/.github/workflows/check_docs.yml new file mode 100644 index 0000000..bc1cca1 --- /dev/null +++ b/.github/workflows/check_docs.yml @@ -0,0 +1,34 @@ +name: Check that docs build +on: + pull_request: + paths: + - './docs/*' + - '**.md' + - './open_cge/**.py' + +jobs: + build-and-deploy: + if: github.repository == 'PSLmodels/CGE' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Setup Miniconda + uses: conda-incubator/setup-miniconda@v3 + with: + activate-environment: cge_env + environment-file: environment.yml + python-version: 3.7 + auto-activate-base: false + + - name: Install and Build # install Sphinx and build docs + shell: bash -l {0} + run: | + conda install sphinx + conda list + pip install -e . + cd docs + make html \ No newline at end of file diff --git a/.github/workflows/check_formatting.yml b/.github/workflows/check_formatting.yml new file mode 100644 index 0000000..5c42d99 --- /dev/null +++ b/.github/workflows/check_formatting.yml @@ -0,0 +1,14 @@ +name: Check Black formatting + +on: [push, pull_request] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - uses: psf/black@stable + with: + options: "-l 79 --check" + src: "." \ No newline at end of file