Skip to content

Commit

Permalink
Merge pull request #178 from centre-for-humanities-computing/mb/updat…
Browse files Browse the repository at this point in the history
…e_repo_structure_for_v2

ci: update repo structure and CI/CD for v2
  • Loading branch information
MartinBernstorff authored Oct 17, 2023
2 parents 29b7e9d + 28196d3 commit 7604a23
Show file tree
Hide file tree
Showing 91 changed files with 1,346 additions and 1,065 deletions.
37 changes: 37 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
{
"name": "Existing Dockerfile",
"build": {
// Sets the run context to one level up instead of the .devcontainer folder.
"context": "..",
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
"dockerfile": "../Dockerfile.dev"
},
// "features": {},
"customizations": {
"vscode": {
"extensions": [
"GitHub.copilot",
"charliermarsh.ruff",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-python.black-formatter",
"GitHub.vscode-pull-request-github"
]
}
},
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {}
},
"postStartCommand": "make install"
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Uncomment the next line to run commands after the container is created.
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "devcontainer"
}
157 changes: 157 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
# 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/
pip-wheel-metadata/
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/

# 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
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.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

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

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.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/

# data files
**/*.jsonl
*.ndjson
*.csv
*.parquet
src/applications/dataset_validation/intercoder_reliability.ipynb
data/test/*
*.parquet

# MacOS
.DS_Store

# Profiling
*.prof

#wandb
wandb/*
models/*

# RProg
*.Rproj
*.Rproj.user
.Rproj.user
.Rhistory

# Hydra
outputs/*
23 changes: 0 additions & 23 deletions .github/workflows/black_formatter.yml

This file was deleted.

34 changes: 34 additions & 0 deletions .github/workflows/lint-and-build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: 'lint and build dev container'
on: # rebuild any PRs and main branch changes
pull_request:
push:
branches:
- main


jobs:
build-and-test:
concurrency:
group: "${{ github.workflow }} @ ${{ github.ref }}"
cancel-in-progress: true
runs-on: ubuntu-latest
steps:
- name: Checkout (GitHub)
uses: actions/checkout@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Pre-build dev container image
uses: devcontainers/[email protected]
with:
imageName: ghcr.io/centre-for-humanities-computing/danish-foundation-models-devcontainer
cacheFrom: ghcr.io/centre-for-humanities-computing/danish-foundation-models-devcontainer
push: filter
refFilterForPush: refs/heads/main
runCmd:
make validate
74 changes: 0 additions & 74 deletions .github/workflows/pytest.yml

This file was deleted.

2 changes: 0 additions & 2 deletions .isort.cfg

This file was deleted.

18 changes: 8 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
repos:
- repo: https://github.com/psf/black
rev: 22.10.0
- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.0
hooks:
- id: isort
# - repo: https://gitlab.com/pycqa/flake8
# rev: 3.8.4
# hooks:
# - id: flake8
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"python.analysis.typeCheckingMode": "strict",
"python.testing.pytestArgs": [
"src"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
}
13 changes: 13 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM python:3.11-bullseye

# Set the working directory to /app
WORKDIR /app

# Dev experience
COPY makefile ./
COPY pyproject.toml ./
RUN make install

# Install the app
COPY . /app
RUN pip install -e .
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@ You can contribute both:
- Validation tasks can even be private benchmarks where you only wish to share the performance metrics.
- And probably in many other ways

## Setting up development environment
### Method 1: Dev container
By far the easiest way is to use our included development container. If you're using VSCode:

* Ensure you have either [Orbstack](https://orbstack.dev) or [Docker](https://docker.com) installed
* Press this button: [![Open in Dev Container](https://img.shields.io/static/v1?label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/centre-for-humanities-computing/danish-foundation-models/)
* Select "From Dockerfile"
* Press "OK" on the feature screen

### Method 2: Manual install
Install as you usually would, replicating the commands in the `Dockerfile.dev`.

## Current Contributors and Collaborators
This project has collaborators across industry, national institutions and research centers. This project uses compute resources supplied by [Ucloud](https://docs.cloud.sdu.dk/index.html) through the [DeiC e-infrastructure grant](https://www.deic.dk/en/supercomputing/Apply-for-HPC-resources).
Expand Down
Loading

0 comments on commit 7604a23

Please sign in to comment.