Skip to content

Commit bde8e1f

Browse files
committed
initial commit
0 parents  commit bde8e1f

File tree

341 files changed

+76687
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

341 files changed

+76687
-0
lines changed

Diff for: .github/workflows/pretest.yaml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Pretest
2+
3+
on: [push, pull_request, workflow_call]
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Check out code
10+
uses: actions/checkout@v3
11+
- name: Prepare a dev environment docker image
12+
run: |
13+
docker build -t project-dev -f container/devel.Dockerfile .
14+
docker build -t project-test -f - . << EOF
15+
FROM project-dev
16+
ADD . /project
17+
18+
# create an empty file to make `go:embed` happy
19+
RUN cd /project && mkdir app/frontend/build && touch app/frontend/build/test && mkdir docs/build && touch docs/build/test
20+
21+
# generate code
22+
RUN cd /project && task openapi && task proto
23+
24+
WORKDIR /project
25+
EOF
26+
- name: Lint
27+
run: docker run project-test task lint
28+
- name: Unit test
29+
run: docker run project-test task test
30+
- name: Build for e2e test
31+
run: |
32+
docker build -t project-e2e -f - . << EOF
33+
FROM project-test
34+
RUN task build-dev
35+
EXPOSE 3000
36+
ENTRYPOINT ["/project/build/nutsh-dev"]
37+
CMD ["--port", "3000"]
38+
EOF
39+
- name: Start the server for e2e test
40+
run: |
41+
docker compose -f - up -d << EOF
42+
version: "3.9"
43+
services:
44+
server:
45+
image: project-e2e
46+
ports:
47+
- "3000:3000"
48+
EOF
49+
- name: Install tools
50+
run: sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin
51+
- name: Prepare e2e test
52+
run: task e2e:install
53+
- name: End-to-end test
54+
run: task e2e:run

Diff for: .github/workflows/release.yaml

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v[0-9]+.[0-9]+.[0-9]"
7+
- "v[0-9]+.[0-9]+.[0-9]+-alpha"
8+
- "v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+"
9+
10+
jobs:
11+
pretest:
12+
uses: ./.github/workflows/pretest.yaml
13+
binary_release:
14+
runs-on: ubuntu-latest
15+
needs: [pretest]
16+
steps:
17+
- name: check out code
18+
uses: actions/checkout@v3
19+
- name: prepare
20+
run: |
21+
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin
22+
mkdir ~/build
23+
- name: build devel
24+
env:
25+
REGISTRY_HOST: local
26+
REGISTRY_REPO: nutsh
27+
BUILD_COMMIT_IDENTIFIER: release
28+
run: task container:devel
29+
- name: build runtimes
30+
run: |
31+
docker build -t local/nutsh:runtime-release -f - . << EOF
32+
FROM local/nutsh:devel-release
33+
ADD . /project
34+
WORKDIR /project
35+
RUN \
36+
task openapi && \
37+
task proto && \
38+
task frontend:build && \
39+
task docs:build
40+
RUN \
41+
GOOS=linux GOARCH=amd64 task backend:build && mv build/nutsh build/nutsh-Linux-x86_64 && \
42+
GOOS=linux GOARCH=arm64 task backend:build && mv build/nutsh build/nutsh-Linux-arm64 && \
43+
GOOS=darwin GOARCH=amd64 task backend:build && mv build/nutsh build/nutsh-Darwin-x86_64 && \
44+
GOOS=darwin GOARCH=arm64 task backend:build && mv build/nutsh build/nutsh-Darwin-arm64
45+
RUN \
46+
GOOS=linux GOARCH=amd64 task sam:build && mv build/nutsh-sam build/nutsh-sam-Linux-x86_64 && \
47+
GOOS=linux GOARCH=arm64 task sam:build && mv build/nutsh-sam build/nutsh-sam-Linux-arm64 && \
48+
GOOS=darwin GOARCH=amd64 task sam:build && mv build/nutsh-sam build/nutsh-sam-Darwin-x86_64 && \
49+
GOOS=darwin GOARCH=arm64 task sam:build && mv build/nutsh-sam build/nutsh-sam-Darwin-arm64
50+
EOF
51+
docker run --rm --entrypoint tar local/nutsh:runtime-release cC /project/build . | tar xvC ~/build
52+
- name: create release
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
run: |
56+
set -x
57+
assets=()
58+
for asset in ~/build/*; do
59+
assets+=("-a" "$asset")
60+
done
61+
tag_name="${GITHUB_REF##*/}"
62+
prerelease=""
63+
if [[ $GITHUB_REF =~ -alpha ]]; then prerelease="-p"; fi
64+
hub release create "${assets[@]}" ${prerelease} -m "$tag_name" --draft "$tag_name"
65+
container_release:
66+
runs-on: ubuntu-latest
67+
needs: [pretest]
68+
steps:
69+
- name: Check out code
70+
uses: actions/checkout@v3
71+
- name: Prepare environment
72+
run: |
73+
echo "RELEASE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
74+
echo "REGISTRY=ghcr.io" >>${GITHUB_ENV}
75+
echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
76+
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin
77+
- name: Build image
78+
env:
79+
REGISTRY_HOST: ${{ env.REGISTRY }}
80+
REGISTRY_REPO: ${{ env.IMAGE_NAME }}
81+
BUILD_COMMIT_IDENTIFIER: ${{ env.RELEASE_TAG }}
82+
run: |
83+
task container:devel
84+
task container:runtime
85+
task sam:container:devel
86+
task sam:container:runtime3rd
87+
task sam:container:runtime
88+
- name: Log in to the container registry
89+
uses: docker/login-action@v2
90+
with:
91+
registry: ${{ env.REGISTRY }}
92+
username: ${{ github.actor }}
93+
password: ${{ secrets.GITHUB_TOKEN }}
94+
- name: Push image
95+
run: |
96+
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:runtime-${{ env.RELEASE_TAG }}
97+
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:runtime-sam-${{ env.RELEASE_TAG }}

Diff for: .gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
app/frontend/src/openapi
2+
app/frontend/src/proto
3+
app/frontend/node_modules
4+
app/frontend/build
5+
openapi/gen
6+
build
7+
local
8+
*.local
9+
__pycache__

Diff for: .pylintrc

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[TYPECHECK]
2+
3+
# List of members which are set dynamically and missed by Pylint inference
4+
# system, and so shouldn't trigger E1101 when accessed.
5+
generated-members=numpy.*, torch.*, cv2.*
6+
7+
[MASTER]
8+
disable=
9+
C0103, # invalid-name
10+
C0114, # missing-module-docstring
11+
C0115, # missing-class-docstring
12+
C0116, # missing-function-docstring
13+
R0914, # too-many-locals
14+
R0902, # too-many-instance-attributes
15+
R0901, # Too many ancestors
16+
R0801, # Similar lines
17+
18+
[FORMAT]
19+
max-line-length = 120

Diff for: .vscode/settings.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"editor.formatOnSave": true,
3+
"[typescript]": {
4+
"editor.defaultFormatter": "esbenp.prettier-vscode",
5+
"editor.rulers": [120]
6+
},
7+
"[typescriptreact]": {
8+
"editor.defaultFormatter": "esbenp.prettier-vscode",
9+
"editor.rulers": [120]
10+
},
11+
"python.linting.enabled": true,
12+
"python.linting.pylintEnabled": true,
13+
"python.analysis.typeCheckingMode": "strict",
14+
"python.formatting.provider": "none",
15+
"[python]": {
16+
"editor.defaultFormatter": "ms-python.black-formatter",
17+
"editor.rulers": [120]
18+
},
19+
"[proto3]": {
20+
"editor.rulers": [120]
21+
},
22+
}

Diff for: CITATION.cff

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# This CITATION.cff file was generated with cffinit.
2+
3+
cff-version: 1.2.0
4+
title: "nutsh: A Platform for Visual Learning from Human Feedback"
5+
message: >-
6+
If you use this software, please cite it using the
7+
metadata from this file.
8+
type: software
9+
authors:
10+
- given-names: Xu
11+
family-names: Han
12+
- given-names: Fisher
13+
family-names: Yu
14+
repository-code: "https://github.com/SysCV/nutsh"
15+
url: "https://nutsh.ai"
16+
license: Apache-2.0
17+
version: 0.1.0

0 commit comments

Comments
 (0)