Skip to content

Commit

Permalink
Merge pull request #114 from issp-center-dev/develop
Browse files Browse the repository at this point in the history
v3.2.0
  • Loading branch information
shinaoka authored Feb 9, 2022
2 parents b64f3c4 + 18784a0 commit 361219e
Show file tree
Hide file tree
Showing 158 changed files with 37,150 additions and 34,088 deletions.
29 changes: 29 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM --platform=linux/x86_64 shinaoka/dcore_dev_triqs3

ENV PYTHONUNBUFFERED=1


# Install requirement
RUN mkdir /tmp/setup
WORKDIR /tmp/setup
COPY ./ .

RUN python3 setup.py egg_info
RUN pip3 install `grep -v '^\[' src/*.egg-info/requires.txt`

# Create non-root user
ARG NB_USER=vscode
ARG NB_UID=1000
RUN useradd -u $NB_UID -m $NB_USER -s /bin/bash && \
echo 'vscode ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER $NB_USER
ENV PATH "/home/${NB_USER}/.local/bin:/opt/pomerol2dcore/bin:${PATH}"
#ENV PYTHONPATH "/home/${NB_USER}/work/src:${PYTONPATH}"

# for vscode
RUN mkdir /home/${NB_USER}/work

# For DCore
#ENV DCORE_TRIQS_COMPAT 0

RUN echo "source /opt/triqs/share/triqsvars.sh" >> /home/${NB_USER}/.bashrc
40 changes: 40 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or the definition README at
// https://github.com/microsoft/vscode-dev-containers/tree/master/containers/docker-existing-dockerfile
{
"name": "Existing Dockerfile",
// 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",
// The optional 'runArgs' property can be used to specify additional runtime arguments.
"runArgs": [],
// Use 'settings' to set *default* container specific settings.json values on container create.
// You can edit these settings after create using File > Preferences > Settings > Remote.
// Uncomment the next line if you want to publish any ports.
// "appPort": [],
// Uncomment the next line to run commands after the container is created - for example installing git.
// "postCreateCommand": "apt-get update && apt-get install -y git",
// Add the IDs of extensions you want installed when the container is created in the array below.
"extensions": [
"ms-azuretools.vscode-docker",
"mutantdino.resourcemonitor",
"shardulm94.trailing-spaces",
"cliffordfajardo.hightlight-selections-vscode",
"wdawson.better-kill-ring",
"oderwat.indent-rainbow",
"github.vscode-pull-request-github",
"mhutchie.git-graph",
"donjayamanne.githistory",
"eamodio.gitlens",
"bungcip.better-toml",
"usernamehw.errorlens",
"ms-vscode.live-server",
"christian-kohler.path-intellisense",
"ms-python.python",
"ms-python.vscode-pylance",
"lextudio.restructuredtext"
],
"remoteUser": "vscode",
"workspaceFolder": "/home/vscode/work",
"workspaceMount": "src=${localWorkspaceFolder},dst=/home/vscode/work,type=bind",
}
61 changes: 61 additions & 0 deletions .devcontainer_notriqs/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
FROM python:3.9-slim

ENV PYTHONUNBUFFERED=1

RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
curl \
ca-certificates \
git \
zip \
vim \
gosu \
hdf5-tools \
libopenblas-base \
libopenblas-dev \
libhdf5-103 \
libhdf5-dev \
libeigen3-dev \
cmake \
pkg-config \
gfortran \
openmpi-bin \
libopenmpi-dev \
sudo \
libboost-dev \
libboost-mpi-dev \
&& \
apt-get clean && rm -rf /var/cache/apt/archives/* /var/lib/apt/lists/* # clean up


# pomerol
WORKDIR /root
RUN git clone https://github.com/aeantipov/pomerol.git && cd pomerol && git checkout 7a45b6a8b8254dcbf8 && cd .. && \
mkdir pomerol.build && cd pomerol.build && \
cmake -DCMAKE_INSTALL_PREFIX=/opt/pomerol -DPOMEROL_COMPLEX_MATRIX_ELEMENTS=ON ../pomerol && \
make install && cd .. && rm -rf pomerol.build pomerol

# pomerol2dcore
WORKDIR /root
RUN git clone https://github.com/j-otsuki/pomerol2dcore.git && \
mkdir pomerol2dcore.build && cd pomerol2dcore.build && \
cmake -Dpomerol_DIR=/opt/pomerol -DCMAKE_INSTALL_PREFIX=/opt/pomerol2dcore ../pomerol2dcore && \
make install

# Create non-root user
ARG NB_USER=vscode
ARG NB_UID=1000
RUN useradd -u $NB_UID -m $NB_USER -s /bin/bash && \
echo 'vscode ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER $NB_USER
ENV PATH "/home/${NB_USER}/.local/bin:/opt/pomerol2dcore/bin:${PATH}"
ENV PYTHONPATH "/home/${NB_USER}/work/src:${PYTONPATH}"

# for vscode
RUN mkdir /home/${NB_USER}/work

# For DCore
ENV DCORE_TRIQS_COMPAT 1

RUN pip3 install scipy, h5py>2.10.0, toml, dcorelib, mpi4py, matplotlib
38 changes: 38 additions & 0 deletions .devcontainer_notriqs/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or the definition README at
// https://github.com/microsoft/vscode-dev-containers/tree/master/containers/docker-existing-dockerfile
{
"name": "Existing Dockerfile",
// 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",
// The optional 'runArgs' property can be used to specify additional runtime arguments.
"runArgs": [],
// Use 'settings' to set *default* container specific settings.json values on container create.
// You can edit these settings after create using File > Preferences > Settings > Remote.
// Uncomment the next line if you want to publish any ports.
// "appPort": [],
// Uncomment the next line to run commands after the container is created - for example installing git.
// "postCreateCommand": "apt-get update && apt-get install -y git",
// Add the IDs of extensions you want installed when the container is created in the array below.
"extensions": [
"ms-azuretools.vscode-docker",
"mutantdino.resourcemonitor",
"shardulm94.trailing-spaces",
"cliffordfajardo.hightlight-selections-vscode",
"wdawson.better-kill-ring",
"oderwat.indent-rainbow",
"github.vscode-pull-request-github",
"mhutchie.git-graph",
"donjayamanne.githistory",
"eamodio.gitlens",
"bungcip.better-toml",
"usernamehw.errorlens",
"ms-vscode.live-server",
"christian-kohler.path-intellisense",
"ms-python.python",
],
"remoteUser": "vscode",
"workspaceFolder": "/home/vscode/work",
"workspaceMount": "src=${localWorkspaceFolder},dst=/home/vscode/work,type=bind",
}
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Run all tests
on: [push, pull_request]
jobs:
all-tests:
runs-on: ubuntu-latest
steps:
- run: echo "The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v2
- run: echo "The ${{ github.repository }} repository has been cloned to the runner."
- name: pytest
run: |
export LOCAL_UID=$(id -u $USER)
export LOCAL_GID=$(id -g $USER)
echo "LOCAL_UID=${LOCAL_UID}" > .env
echo "LOCAL_GID=${LOCAL_GID}" >> .env
docker-compose up -d
- run: echo "This job's status is ${{ job.status }}."
80 changes: 80 additions & 0 deletions .github/workflows/deploy_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: deploy

on:
push:
branches:
- master
- develop
- gh_actions # test branch
- '**-autodoc'
- '!gh-pages'
tags: '*'

jobs:
deploy:
runs-on: ubuntu-20.04
steps:
- name: Inject slug/short variables
uses: rlespinasse/[email protected]

- name: Checkout
uses: actions/checkout@v2
with:
path: main

- name: Checkout gh-pages
uses: actions/checkout@v2
with:
ref: gh-pages
path: gh-pages

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install matplotlib sphinx wild_sphinx_theme
- name: Build
run: |
cd ${GITHUB_WORKSPACE}/main/
export PYTHONPATH=./src
python3 -m dcore.option_tables doc/reference
sphinx-build -b html ./doc ./built_doc
- name: Deploy Configuration
run: |
mkdir ~/.ssh
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
echo "${{ secrets.GH_ACTIONS_DEPLOY_KEY }}" > ~/.ssh/id_rsa
chmod 400 ~/.ssh/id_rsa
- name: Push
env:
GIT_USER: "DCore Developers"
GIT_EMAIL: "[email protected]"
REF_SLUG: ${{ env.GITHUB_REF_SLUG }}
run: |
cd ${GITHUB_WORKSPACE}
feature_branch=${REF_SLUG%-autodoc}
if [ "_${REF_SLUG}" != "_${feature_branch}" ]; then
TARGET_NAME=${feature_branch}
else
TARGET_NAME=${REF_SLUG}
fi
rm -rf "gh-pages/${TARGET_NAME}"
cp -r "main/built_doc" "gh-pages/${TARGET_NAME}"
cd gh-pages
git config --local user.name "${GIT_USER}"
git config --local user.email "${GIT_EMAIL}"
git remote set-url origin [email protected]:${GITHUB_REPOSITORY}.git
git add ${TARGET_NAME}
if git commit -m "Deploy docs to ${TARGET_NAME} by GitHub Actions triggered by ${GITHUB_SHA}"
then
git push origin gh-pages
else
echo "Nothing to deploy"
fi
40 changes: 40 additions & 0 deletions .github/workflows/wheel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build and upload to PyPI

# Triggered a new tag starting with "v" is pushed
on:
push:
tags:
- 'v*'

jobs:
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Build dist
run: python setup.py sdist bdist_wheel

- uses: actions/upload-artifact@v2
with:
name: dist
path: |
dist/*.tar.gz
dist/*.whl
if-no-files-found: error

upload_pypi:
needs: [build_sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
with:
name: dist
path: dist

- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
skip_existing: true
25 changes: 25 additions & 0 deletions .github_scripts/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

USER_ID=${LOCAL_UID:-9001}
GROUP_ID=${LOCAL_GID:-9001}

echo "Starting with UID : $USER_ID, GID: $GROUP_ID"
ls -al /home/
useradd -u $USER_ID -o -m user -s /bin/bash
groupmod -g $GROUP_ID user
export HOME=/home/user

cd /var/dcoretest
#git clean -xdf

pip3 install pytest matplotlib
pip3 install git+https://github.com/shinaoka/dcorelib.git
pip3 install .

chown -R user /var/dcoretest
chgrp -R user /var/dcoretest
gosu user bash -c 'source /opt/triqs/share/triqsvars.sh;pytest tests/non-mpi/*/*.py'
gosu user bash -c 'source /opt/triqs/share/triqsvars.sh;pytest tests/non-mpi/test*.py'
gosu user bash -c 'source /opt/triqs/share/triqsvars.sh;mpirun -np 2 pytest tests/mpi/*/*.py'
echo "TEST DONE"
#echo "Use Ctrl+C to stop the container!"
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

Loading

0 comments on commit 361219e

Please sign in to comment.