Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply the new workflow #168

Merged
merged 3 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Gather coverage report and upload to codecov

on:
push:
branches:
- main
release:
types:
- prereleased
- published
workflow_dispatch:

defaults:
run:
shell: bash -l {0}

jobs:
coverage:
runs-on: ubuntu-latest
steps:
- name: Check out diffpy.pdfgui
uses: actions/checkout@v4

- name: Initialize miniconda
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: test
auto-update-conda: true
environment-file: environment.yml
auto-activate-base: false

- name: Conda config
run: >-
conda config --set always_yes yes
--set changeps1 no

- name: Install diffpy.pdfgui and requirements
run: |
conda install --file requirements/run.txt
conda install --file requirements/test.txt
python -m pip install -r requirements/pip.txt
python -m pip install . --no-deps

- name: Install Xvfb
run: sudo apt-get install -y xvfb

- name: Start Xvfb
run: |
export DISPLAY=:99
Xvfb :99 -screen 0 1024x768x16 &

- name: Validate diffpy.pdfgui
run: |
export DISPLAY=:99
coverage run -m pytest -vv -s
coverage report -m
codecov

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
47 changes: 26 additions & 21 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,42 @@
name: Build Documentation
name: Build and Deploy Documentation

on:
push:
branches:
- main
release:
types:
- published
workflow_dispatch:

defaults:
run:
shell: bash -l {0}

jobs:
test:
docs:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check out diffpy.pdfgui
uses: actions/checkout@v4

- uses: conda-incubator/setup-miniconda@v2
- name: Initialize miniconda
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: build
auto-update-conda: true
environment-file: environment.yml
auto-activate-base: false

- name: install requirements
- name: Conda config
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
conda config --set always_yes yes
--set changeps1 no

- name: Install diffpy.pdfgui and build requirements
run: |
conda install --file requirements/build.txt
conda install --file requirements/run.txt
conda install --file requirements/docs.txt
python -m pip install -r requirements/pip.txt
python -m pip install . --no-deps

- name: build documents
run: make -C doc html
Expand Down
56 changes: 22 additions & 34 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,42 @@
name: CI
name: Test

on:
push:
branches:
- main
- CI
pull_request:
workflow_dispatch:

defaults:
run:
shell: bash -l {0}

jobs:
miniconda:
name: Miniconda ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-latest"]
validate:
runs-on: ubuntu-latest
steps:
- name: check out diffpy.pdfgui
uses: actions/checkout@v3
with:
repository: diffpy/diffpy.pdfgui
path: .
fetch-depth: 0 # avoid shallow clone with no tags
- name: Check out diffpy.pdfgui
uses: actions/checkout@v4

- 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
- name: Initialize miniconda
uses: conda-incubator/setup-miniconda@v3
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-update-conda: true
environment-file: environment.yml
auto-activate-base: false

- name: install diffpy.pdfgui requirements
shell: bash -l {0}
- name: Conda config
run: >-
conda config --set always_yes yes
--set changeps1 no

- name: Install diffpy.pdfgui and requirements
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 .
python -m pip install -r requirements/pip.txt
python -m pip install . --no-deps

- name: Install Xvfb
run: sudo apt-get install -y xvfb
Expand All @@ -55,10 +47,6 @@ jobs:
Xvfb :99 -screen 0 1024x768x16 &

- name: Validate diffpy.pdfgui
shell: bash -l {0}
run: |
export DISPLAY=:99
conda activate test
coverage run -m pytest -vv -s
coverage report -m
codecov
python -m pytest
19 changes: 0 additions & 19 deletions .github/workflows/pre-commit.yml

This file was deleted.