Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Sathya-S3 authored Nov 4, 2024
0 parents commit 40b428a
Show file tree
Hide file tree
Showing 18 changed files with 8,616 additions and 0 deletions.
94 changes: 94 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Build and publish a Docker image.
name: Build and publish docker images

on:
push:
branches: ["main"]
# Publish semver tags as releases.
tags: ["v*.*.*"]
pull_request:
branches: ["main"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
REGISTRY: ghcr.io

permissions:
contents: write
packages: write
attestations: write
id-token: write

jobs:
# Job 1: Update Lock File
update-lockfile:
name: Update Python Lock File
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref || github.ref_name }}
submodules: true

- name: Install uv
uses: astral-sh/setup-uv@v2

- uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Update lock file
run: uv lock --upgrade-package nomad-lab

# Commits any changes made to the lockfile
- name: Commit lock file changes
run: |
git config --global user.name github-actions
git config --global user.email [email protected]
git add uv.lock
if [[ `git status --porcelain` ]]; then
git commit -m "Update lockfile"
git push origin -o ci.skip # prevent triggering the pipeline again
fi
# Job 2: Build and Push Docker Image
docker-publish:
name: Build Docker Image
runs-on: ubuntu-latest
needs: update-lockfile

strategy:
fail-fast: false
matrix:
service: [app, jupyter]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref || github.ref_name }}
submodules: true

- uses: docker/setup-buildx-action@v3

- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}${{ matrix.service == 'jupyter' && '/jupyter' || '' }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
target: ${{ matrix.service == 'jupyter' && 'jupyter' || 'final' }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
60 changes: 60 additions & 0 deletions .github/workflows/initialize.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Template Repository Initialization

on:
# Triggers the workflow on creation of repository
create:
workflow_dispatch:

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}

permissions:
contents: write

jobs:
initialize_repository:
if: github.repository != 'FAIRmat-NFDI/nomad-distribution-template'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

# Replaces the template repository name in the README with the new one
- name: Update README
run: |
sed -i "/# NOMAD Oasis Distribution/,/button on the right./d" README.md
export image_name="${{ github.repository }}"
sed -i "s|fairmat-nfdi/nomad-distribution-template|${image_name,,}|g" README.md
sed -i "s|FAIRmat-NFDI/nomad-distribution-template|${{ github.repository }}|g" README.md
sed -i "s|FAIRmat-NFDI|${{ github.repository_owner }}|g" README.md
sed -i "s|nomad-distribution-template|${{ github.event.repository.name }}|g" README.md
sed -i "s|template https://github.com/${{ github.repository }}|template https://github.com/FAIRmat-NFDI/nomad-distribution-template|g" README.md
sed -i "s|${{ github.repository }}/releases/latest|FAIRmat-NFDI/nomad-distribution-template/releases/latest|g" README.md
sed -i "s|@ git+https://github.com/${{ github.repository_owner }}|@ git+https://github.com/FAIRmat-NFDI|g" README.md
# Replaces the template repository name in the docker config file with the new one
- name: Update docker-compose.yaml
run: |
export image_name="${{ github.repository }}"
sed -i "s|fairmat-nfdi/nomad-distribution-template|${image_name,,}|g" docker-compose.yaml
# Replaces the template repository name in the nomad config with the new one
- name: Update nomad.yaml
run: |
export image_name="${{ github.repository }}"
sed -i "s|fairmat-nfdi/nomad-distribution-template|${image_name,,}|g" configs/nomad.yaml
# Deletes this workflow file to prevent it from running on branch creation
- name: Delete initialization workflow
run: rm .github/workflows/initialize.yml

# Commits all changes
- name: Commit repository initialization
run: |
git config --global user.name github-actions
git config --global user.email [email protected]
git commit -am "Repository initialization"
git push
161 changes: 161 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.pyenv
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
2 changes: 2 additions & 0 deletions .volumes/fs/north/users/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
2 changes: 2 additions & 0 deletions .volumes/fs/public/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
2 changes: 2 additions & 0 deletions .volumes/fs/staging/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
2 changes: 2 additions & 0 deletions .volumes/fs/tmp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
2 changes: 2 additions & 0 deletions .volumes/mongo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
Loading

0 comments on commit 40b428a

Please sign in to comment.