Skip to content
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 test cov and docker images #46

Merged
merged 3 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/build-latest-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build latest images automatically

on:
push:
branches:
- main

jobs:
deploy:
strategy:
fail-fast: true

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

# Build docker images
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
id: docker_build_latest
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64/v8
file: ./docker/Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/sdgx:latest
33 changes: 33 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Testing docker image build

on:
pull_request:
branches: [ "master", "main" ]

jobs:
deploy:
strategy:
fail-fast: true

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

# Build docker images
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Build image
id: docker_build_test
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64/v8
file: ./docker/Dockerfile
push: false
tags: build
39 changes: 39 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Release docker image

on:
workflow_dispatch: {}
release:
types: [published]

permissions:
contents: write

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
id: docker_build_release
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64/v8
file: ./docker/Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/sdgx:${{ github.ref_name }}
38 changes: 1 addition & 37 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Upload Python Package and Build Image
name: Upload Python Package

on:
release:
Expand Down Expand Up @@ -37,39 +37,3 @@ jobs:
file_glob: true
tag: ${{ github.ref }}
overwrite: true
# Build docker images

# TODO: currently we don't provide official images
# -
# name: Set up QEMU
# uses: docker/setup-qemu-action@v2
# -
# name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2
# -
# name: Login to DockerHub
# uses: docker/login-action@v2
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
# -
# name: Build and push image
# id: docker_build
# uses: docker/build-push-action@v4
# with:
# context: .
# file: ./docker/Dockerfile
# push: true
# tags: ${{ secrets.DOCKERHUB_USERNAME }}/sdgx:${{ github.ref_name }}

# # Build latest if release
# -
# name: Build and push release
# if: '!github.event.release.prerelease'
# id: docker_build_release
# uses: docker/build-push-action@v4
# with:
# context: .
# file: ./docker/Dockerfile
# push: true
# tags: ${{ secrets.DOCKERHUB_USERNAME }}/sdgx:latest
7 changes: 6 additions & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,9 @@ jobs:
python -m pip install -e .[test]
- name: Test with pytest
run: |
pytest -vv
pytest -vv --cov=sdgx
- name: Install dependencies for building
run: |
pip install build twine hatch
- name: Test building
run: python -m build
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ High-quality synthetic data can also be used in various fields such as data open

## 🔛 Quick Start

### Pre-build image

You can use pre-built images to quickly experience the latest features.

```bash
docker pull idsteam/sdgx:latest
```

### Local Install (Recommended)

At present, the code of this project is updated very quickly. We recommend that you use SDG by installing it through the source code.
Expand Down
8 changes: 8 additions & 0 deletions README_ZH_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@

## 🔛 快速开始

### 预构建镜像

您可以使用预构建的镜像来快速体验最新功能。

```bash
docker pull idsteam/sdgx:latest
```

### 从本地安装(目前推荐)

目前本项目的代码更新速度快,我们推荐您通过源码进行安装的方式使用SDG。
Expand Down
12 changes: 12 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM python:3.10.12-slim-bookworm as builder

RUN pip install build twine hatch
COPY . /source
WORKDIR /source
RUN python -m build

FROM pytorch/pytorch:2.1.0-cuda12.1-cudnn8-runtime

COPY --from=builder /source/dist/*.whl /tmp/

RUN pip install --no-cache-dir /tmp/*.whl
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ classifiers = [
]

[project.optional-dependencies]
test = ["pytest"]
test = ["pytest", "pytest-cov"]
docs = ["Sphinx<=7.2.4", "sphinx-rtd-theme", "sphinx-click", "autodoc_pydantic"]


Expand Down