From fd347e62c993b819bc0a3d9407837ab9b41ef14d Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Wed, 24 Jul 2024 12:47:34 -0600 Subject: [PATCH 1/3] copy .github directory --- workflows/docs.yml | 43 ++++++++++++++++++++++++++++++++ workflows/main.yml | 54 ++++++++++++++++++++++++++++++++++++++++ workflows/pre-commit.yml | 19 ++++++++++++++ 3 files changed, 116 insertions(+) create mode 100644 workflows/docs.yml create mode 100644 workflows/main.yml create mode 100644 workflows/pre-commit.yml diff --git a/workflows/docs.yml b/workflows/docs.yml new file mode 100644 index 00000000..2909d67f --- /dev/null +++ b/workflows/docs.yml @@ -0,0 +1,43 @@ +name: Build Documentation + +on: + push: + branches: + - main + release: + +jobs: + test: + runs-on: ubuntu-latest + defaults: + run: + shell: bash -l {0} + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - uses: conda-incubator/setup-miniconda@v2 + with: + activate-environment: build + auto-update-conda: true + + - name: install requirements + run: >- + conda install -n build -c conda-forge + --file requirements/build.txt + --file requirements/run.txt + --file requirements/docs.txt + --quiet --yes + + - name: install the package + run: python -m pip install . --no-deps + + - name: build documents + run: make -C doc html + + - name: Deploy + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./doc/build/html diff --git a/workflows/main.yml b/workflows/main.yml new file mode 100644 index 00000000..81ed769d --- /dev/null +++ b/workflows/main.yml @@ -0,0 +1,54 @@ +name: CI + +on: + push: + branches: + - main + - CI + 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 + path: . + fetch-depth: 0 # avoid shallow clone with no tags + + - 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: ./environment.yml + python-version: 3 + auto-activate-base: false + + - name: install diffpy.pdfmorph requirements + shell: bash -l {0} + run: | + conda config --set always_yes yes --set changeps1 no + conda config --add channels conda-forge + conda activate test + conda install --file requirements/run.txt + conda install --file requirements/test.txt + pip install . + - name: Validate diffpy.pdfmorph + shell: bash -l {0} + run: | + conda activate test + coverage run -m pytest -vv -s + coverage report -m + codecov diff --git a/workflows/pre-commit.yml b/workflows/pre-commit.yml new file mode 100644 index 00000000..f2ff7e42 --- /dev/null +++ b/workflows/pre-commit.yml @@ -0,0 +1,19 @@ +name: pre-commit + +on: + pull_request: + push: + workflow_dispatch: + +jobs: + pre-commit: + # pull requests are a duplicate of a branch push if within the same repo. + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + - uses: pre-commit/action@v3.0.0 + with: + extra_args: --all-files From 8cdd4c7e8f3b78fc70fe3444e62bccdb5c34d451 Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Wed, 24 Jul 2024 12:50:53 -0600 Subject: [PATCH 2/3] nest inside .github --- {workflows => .github/workflows}/docs.yml | 0 {workflows => .github/workflows}/main.yml | 0 {workflows => .github/workflows}/pre-commit.yml | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename {workflows => .github/workflows}/docs.yml (100%) rename {workflows => .github/workflows}/main.yml (100%) rename {workflows => .github/workflows}/pre-commit.yml (100%) diff --git a/workflows/docs.yml b/.github/workflows/docs.yml similarity index 100% rename from workflows/docs.yml rename to .github/workflows/docs.yml diff --git a/workflows/main.yml b/.github/workflows/main.yml similarity index 100% rename from workflows/main.yml rename to .github/workflows/main.yml diff --git a/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml similarity index 100% rename from workflows/pre-commit.yml rename to .github/workflows/pre-commit.yml From a42f581000e08e153a245b1d91e640ff84ec1385 Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Wed, 24 Jul 2024 23:41:36 -0600 Subject: [PATCH 3/3] update for pdfgui --- .github/workflows/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 81ed769d..80bbfb71 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,10 +16,10 @@ jobs: matrix: os: ["ubuntu-latest"] steps: - - name: check out diffpy.pdfmorph + - name: check out diffpy.pdfgui uses: actions/checkout@v3 with: - repository: diffpy/diffpy.pdfmorph + repository: diffpy/diffpy.pdfgui path: . fetch-depth: 0 # avoid shallow clone with no tags @@ -36,7 +36,7 @@ jobs: python-version: 3 auto-activate-base: false - - name: install diffpy.pdfmorph requirements + - name: install diffpy.pdfgui requirements shell: bash -l {0} run: | conda config --set always_yes yes --set changeps1 no @@ -45,7 +45,7 @@ jobs: conda install --file requirements/run.txt conda install --file requirements/test.txt pip install . - - name: Validate diffpy.pdfmorph + - name: Validate diffpy.pdfgui shell: bash -l {0} run: | conda activate test