From de9a38a1a99f8677a4a9db009b35ff2e5abe7ed6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=AB=20Bullard?= <68021211+chloeann95@users.noreply.github.com> Date: Mon, 27 Feb 2023 12:40:28 -0500 Subject: [PATCH 1/2] Add GH actions for CI --- .github/workflows/main.yml | 52 ++++++++++++++++++++++++++++++++++++++ environment.yml | 6 +++++ requirements/run.txt | 1 + 3 files changed, 59 insertions(+) create mode 100644 .github/workflows/main.yml create mode 100644 environment.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..bf16fa8c --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,52 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +jobs: + miniconda: + name: Miniconda ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: ["ubuntu-latest"] + steps: + - name: check out diffpy.pdfmorph + uses: actions/checkout@v3 + with: + repository: diffpy/diffpy.pdfmorph + # for bookkeeping have diffpy.pdfmorph at the same level as everything else in the + # directory tree + path: diffpy.pdfmorph + + - name: initialize miniconda + # this uses a marketplace action that sets up miniconda in a way that makes + # it easier to use. I tried setting it up without this and it was a pain + uses: conda-incubator/setup-miniconda@v2 + with: + activate-environment: test + # environment.yml file is needed by this action. Because I don't want + # maintain this but rather maintain the requirements files it just has + # basic things in it like conda and pip + environment-file: diffpy.pdfmorph/environment.yml + python-version: 3 + auto-activate-base: false + + - name: install pdfmorph requirements + shell: bash -l {0} + run: | + conda config --set always_yes yes --set changeps1 no + cd diffpy.pdfmorph + conda install --file requirements/run.txt + pip install . + + - name: Validate pdfmorph + shell: bash -l {0} + run: | + cd diffpy.pdfmorph/diffpy/pdfmorph + conda activate test + pytest tests diff --git a/environment.yml b/environment.yml new file mode 100644 index 00000000..bf1db968 --- /dev/null +++ b/environment.yml @@ -0,0 +1,6 @@ +name: regolith +channels: + - conda-forge +dependencies: + - python=3 + - pip diff --git a/requirements/run.txt b/requirements/run.txt index 770c175a..a8bb45b4 100644 --- a/requirements/run.txt +++ b/requirements/run.txt @@ -2,3 +2,4 @@ numpy scipy diffpy.utils matplotlib +bg-mpl-stylesheets From 464ff3ab9aa162b9ef0f390a6d6d3c885539b75e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=AB=20Bullard?= <68021211+chloeann95@users.noreply.github.com> Date: Mon, 27 Feb 2023 13:37:58 -0500 Subject: [PATCH 2/2] adjusted main.yml --- .github/workflows/main.yml | 7 ++++--- requirements/run.txt | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bf16fa8c..5c2c2d8a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,7 +21,7 @@ jobs: repository: diffpy/diffpy.pdfmorph # for bookkeeping have diffpy.pdfmorph at the same level as everything else in the # directory tree - path: diffpy.pdfmorph + path: . - name: initialize miniconda # this uses a marketplace action that sets up miniconda in a way that makes @@ -32,7 +32,7 @@ jobs: # environment.yml file is needed by this action. Because I don't want # maintain this but rather maintain the requirements files it just has # basic things in it like conda and pip - environment-file: diffpy.pdfmorph/environment.yml + environment-file: ./environment.yml python-version: 3 auto-activate-base: false @@ -40,7 +40,7 @@ jobs: shell: bash -l {0} run: | conda config --set always_yes yes --set changeps1 no - cd diffpy.pdfmorph + conda config --add channels conda-forge conda install --file requirements/run.txt pip install . @@ -49,4 +49,5 @@ jobs: run: | cd diffpy.pdfmorph/diffpy/pdfmorph conda activate test + cd ./diffpy/pdfmorph pytest tests diff --git a/requirements/run.txt b/requirements/run.txt index a8bb45b4..770c175a 100644 --- a/requirements/run.txt +++ b/requirements/run.txt @@ -2,4 +2,3 @@ numpy scipy diffpy.utils matplotlib -bg-mpl-stylesheets