-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add Github CI/CD workflows #19
Open
jo-basevi
wants to merge
11
commits into
master
Choose a base branch
from
17-Add-CD-conda-deployment-to-access-nri
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ef1f603
Add CI/CD workflows for building conda package and running tests
jo-basevi ddfe445
Update conda environment and meta files with dependencies and add a p…
jo-basevi 8a997de
Add in versioneer files for dynamic versions
jo-basevi d02dde4
Update README.md
jo-basevi 64e8394
Remove circleci, traveis, requirements.txt and setup.cfg
jo-basevi 82364ca
workflows/CI: Comment out PY_VERSION temporarily
jo-basevi 4bbf596
workflows/CI: Fix file filter
jo-basevi 1eb57a1
workflows/CD: Change label in conda build to main
jo-basevi f208870
Apply suggestions from code review
jo-basevi d8cae0e
workflows/CI: Update workflow with review feedback
jo-basevi d7ae55d
Remove pylint from CI
jo-basevi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
channels: | ||
- accessnri | ||
- conda-forge | ||
- coecms | ||
- nodefaults | ||
|
||
dependencies: | ||
- anaconda-client | ||
- conda-build | ||
- conda-verify | ||
- versioneer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,9 @@ dependencies: | |
- pbr | ||
- netcdf4 | ||
- libnetcdf | ||
- six | ||
- PyYAML | ||
- nchash>=0.1.5 | ||
- pytest | ||
- pytest-cov | ||
- versioneer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{% set version = load_setup_py_data(setup_file='../setup.py', from_recipe_dir=True).get('version') %} | ||
{% set project = load_file_data('../pyproject.toml', from_recipe_dir=True).get('project') %} | ||
|
||
package: | ||
name: {{ project.get('name') }} | ||
version: "{{ version }}" | ||
|
||
build: | ||
noarch: python | ||
number: 0 | ||
script: "python3 -m pip install . -vv" | ||
entry_points: | ||
{% for name, script in project.get('scripts').items() %} | ||
- {{ name }} = {{ script }} | ||
{% endfor %} | ||
|
||
source: | ||
path: ../ | ||
|
||
requirements: | ||
build: | ||
- python | ||
- pip | ||
- setuptools >=61.0.0 | ||
- versioneer | ||
run: | ||
- python | ||
- six | ||
- pyyaml | ||
- nchash | ||
|
||
test: | ||
imports: | ||
- yamanifest | ||
commands: | ||
{% for name, script in project.get('scripts').items() %} | ||
- {{ name }} --help | ||
{% endfor %} | ||
|
||
about: | ||
home: {{ project.get('urls').get('Repository') }} | ||
license: Apache Software | ||
license_file: LICENSE | ||
summary: {{ project.get('description') }} | ||
license_family: Apache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: CD | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
|
||
conda: | ||
name: Build with conda and upload | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-tags: true | ||
fetch-depth: 0 | ||
|
||
- name: Setup conda environment | ||
uses: conda-incubator/setup-miniconda@11b562958363ec5770fef326fe8ef0366f8cbf8a | ||
with: | ||
miniconda-version: "latest" | ||
python-version: ${{ vars.PY_VERSION }} | ||
environment-file: .conda/env_build.yml | ||
auto-update-conda: false | ||
auto-activate-base: false | ||
show-channel-urls: true | ||
|
||
- name: Build and upload the conda package | ||
uses: uibcdf/action-build-and-upload-conda-packages@c6e7a90ad5e599d6cde76e130db4ee52ad733ecf | ||
with: | ||
meta_yaml_dir: .conda | ||
python-version: ${{ vars.PY_VERSION }} | ||
user: accessnri | ||
label: main | ||
token: ${{ secrets.ANACONDA_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
# Run CI tests | ||
name: CI | ||
|
||
# Controls when the action will run. | ||
on: | ||
# Triggers the workflow on push or pull request events but only for the master branch | ||
push: | ||
branches: main | ||
pull_request: | ||
branches: main | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
# JOB to run change in the build files | ||
changes: | ||
runs-on: ubuntu-latest | ||
# Required permissions | ||
permissions: | ||
pull-requests: read | ||
# Set job outputs to values from filter step | ||
outputs: | ||
files: ${{ steps.filter.outputs.files }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4.1.7 | ||
|
||
- name: Filter files | ||
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 #v3.0.2 | ||
id: filter | ||
with: | ||
filters: | | ||
files: | ||
- 'pyproject.toml' | ||
- 'setup.py' | ||
- '.conda/env_build.yml' | ||
- '.conda/meta.yml' | ||
|
||
verify-conda-build: | ||
name: Conda Build | ||
runs-on: ubuntu-latest | ||
needs: changes | ||
# Only run if there are changes in the build files | ||
if: ${{ needs.changes.outputs.files == 'true' }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup conda build environment | ||
uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4 | ||
with: | ||
miniconda-version: "latest" | ||
python-version: ${{ vars.PY_VERSION }} | ||
environment-file: .conda/env_build.yml | ||
auto-activate-base: false | ||
auto-update-conda: false | ||
show-channel-urls: true | ||
|
||
- name: Verify conda recipe | ||
shell: bash -el {0} | ||
# Ignores: | ||
# C2105 - Found invalid package version in meta.yaml | ||
# C2122 - Found invalid license family | ||
run: conda-verify .conda --ignore C2105,C2122 --exit | ||
|
||
- name: Run conda build | ||
shell: bash -el {0} | ||
run: | | ||
conda build . --no-anaconda-upload --output-folder=./build | ||
|
||
- name: Verify conda package | ||
shell: bash -el {0} | ||
# Ignores: | ||
# C1105 - Found invalid version number in info/index.json | ||
# C1115 - Found invalid license in info/index.json | ||
# C1141 - Found python file without a corresponding pyc file | ||
run: conda-verify ./build/noarch/*.tar.bz2 --ignore C1105,C1115,C1141 --exit | ||
|
||
tests: | ||
name: Tests | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
python-version: ["3.10", "3.11", "3.12"] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4.1.7 | ||
|
||
- name: Setup conda environment | ||
uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4 | ||
with: | ||
miniconda-version: "latest" | ||
python-version: ${{ matrix.python-version }} | ||
environment-file: .conda/env_dev.yml | ||
activate-environment: yamanifest-dev | ||
auto-update-conda: false | ||
auto-activate-base: false | ||
show-channel-urls: true | ||
|
||
- name: Install source | ||
shell: bash -l {0} | ||
run: python3 -m pip install --no-deps --no-build-isolation -e . | ||
|
||
- name: List installed packages | ||
shell: bash -l {0} | ||
run: conda list | ||
|
||
- name: Entrypoint test of driver script | ||
shell: bash -l {0} | ||
run: yamf --help | ||
|
||
- name: Run tests | ||
shell: bash -l {0} | ||
run: | | ||
python -m pytest --cov=yamanifest --cov-report=html -s test | ||
|
||
# - name: Upload code coverage | ||
# # Only upload once for the installed version | ||
# if: ${{ matrix.python-version == vars.PY_VERSION }} | ||
# uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 #v4.6.0 | ||
# with: | ||
# token: ${{ secrets.codecov_token }} | ||
# files: ./coverage.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,4 +70,5 @@ target/ | |
*.res | ||
*.bin | ||
*_table | ||
*.yaml | ||
# Commenting out so meta.yaml is tracked by git | ||
# *.yaml |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, when do we get rid of the
coecms
dependency, given it's shut down now?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a dependency on
nchash
(https://github.com/aidanheerdegen/nchash) which is deployed to thecoecms
conda channel. Though I'm unsure on whether the dependency is still required - see this existing issue: #11.