-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
186 additions
and
186 deletions.
There are no files selected for viewing
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,99 @@ | ||
name: build | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
# Run when container or environment is changed | ||
paths: | ||
- containers/dockerfile_cpu | ||
- environment.yml | ||
# Allows workflow to be manually triggered | ||
workflow_dispatch: | ||
|
||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: cmelab/grits | ||
DOCKERFILE: containers/dockerfile_cpu | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@main | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Get Latest Version | ||
id: latest-version | ||
run: | | ||
LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) | ||
echo $LATEST_TAG | ||
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_OUTPUT | ||
# slice off the v, ie v0.7.2 -> 0.7.2 | ||
VERSION=${LATEST_TAG:1} | ||
echo $VERSION | ||
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | ||
- name: Print Latest Version | ||
run: echo ${{ steps.latest-version.outputs.VERSION }} | ||
|
||
- name: Create fully qualified image registry path | ||
id: fqirp | ||
run: | | ||
FQIRP=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.latest-version.outputs.VERSION }} | ||
echo "FQIRP=$FQIRP" >> $GITHUB_OUTPUT | ||
- name: Print FQIRP | ||
run: echo ${{ steps.fqirp.outputs.FQIRP }} | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=semver,pattern={{version}},prefix=v | ||
${{ steps.latest-version.outputs.VERSION }} | ||
- name: Build Docker Image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: ${{ env.DOCKERFILE }} | ||
load: true | ||
push: false | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
build-args: | | ||
VERSION=${{ steps.latest-version.outputs.VERSION }} | ||
- name: Test image | ||
run: | | ||
docker run --rm ${{ steps.fqirp.outputs.FQIRP }} python -c "import grits; print(grits.__version__)" | ||
- name: Push Docker image | ||
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | ||
with: | ||
context: . | ||
file: ${{ env.DOCKERFILE }} | ||
push: ${{ github.event_name == 'workflow_dispatch' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
build-args: | | ||
VERSION=${{ steps.latest-version.outputs.VERSION }} |
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
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
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 |
---|---|---|
@@ -1,22 +1,12 @@ | ||
FROM mambaorg/micromamba:0.15.2 | ||
FROM mambaorg/micromamba:1.4.1 | ||
|
||
COPY --chown=micromamba:micromamba environment.yml /tmp/env.yml | ||
ARG VERSION | ||
|
||
RUN micromamba install -y -n base -f /tmp/env.yml && \ | ||
micromamba clean --all --yes | ||
|
||
COPY grits/ /tmp/grits/ | ||
|
||
COPY setup.py /tmp/ | ||
|
||
RUN ls -la /tmp | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
RUN python -m pip install /tmp | ||
COPY --chown=$MAMBA_USER:$MAMBA_USER environment.yml /tmp/env.yml | ||
|
||
RUN pytest -vx | ||
|
||
USER root | ||
|
||
RUN rm -r /tmp/* | ||
RUN micromamba install -y -n base "grits==$VERSION" -f /tmp/env.yml && \ | ||
micromamba clean --all --yes | ||
|
||
RUN python -c "import grits" | ||
ARG MAMBA_DOCKERFILE_ACTIVATE=1 |
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
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
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
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
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
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 |
---|---|---|
@@ -1,6 +1,42 @@ | ||
[build-system] | ||
requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"] | ||
requires = ["setuptools>=61.2", "versioningit"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.setuptools_scm] | ||
write_to = "grits/__version__.py" | ||
[project] | ||
name = "grits" | ||
description = "A toolkit for working with coarse-grained systems" | ||
readme = "README.md" | ||
authors = [{name = "Jenny Fothergill", email = "jennyfothergill@boisestate.edu"}] | ||
license= {text = "GPLv3"} | ||
classifiers=[ | ||
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3", | ||
] | ||
urls = {Homepage = "https://github.com/cmelab/grits"} | ||
requires-python = ">=3.8" | ||
dynamic = ["version"] | ||
|
||
[tool.setuptools] | ||
zip-safe = false | ||
include-package-data = true | ||
license-files = ["LICENSE"] | ||
|
||
[tool.setuptools.packages] | ||
find = {namespaces = false} | ||
|
||
[tool.setuptools.package-data] | ||
grits = ['"./compounds/*"'] | ||
|
||
[tool.versioningit] | ||
default-version = "1+unknown" | ||
|
||
[tool.versioningit.format] | ||
distance = "{base_version}+{distance}.{vcs}{rev}" | ||
dirty = "{base_version}+{distance}.{vcs}{rev}.dirty" | ||
distance-dirty = "{base_version}+{distance}.{vcs}{rev}.dirty" | ||
|
||
[tool.versioningit.vcs] | ||
method = "git" | ||
match = ["*"] | ||
default-tag = "0.0.0" |
Oops, something went wrong.