Skip to content

Commit

Permalink
chore: Keep v1 and v0 in envd (tensorchord#1272)
Browse files Browse the repository at this point in the history
* feat: Add v1 and v0

Signed-off-by: Ce Gao <[email protected]>

* fix: Fix lint

Signed-off-by: Ce Gao <[email protected]>

* fix: Fix

Signed-off-by: Ce Gao <[email protected]>

* fix: Mock generation

Signed-off-by: Ce Gao <[email protected]>

* fix: Add build

Signed-off-by: Ce Gao <[email protected]>

* fix: Fix test cases

Signed-off-by: Ce Gao <[email protected]>

* fix: Update

Signed-off-by: Ce Gao <[email protected]>

* fix: Fix

Signed-off-by: Ce Gao <[email protected]>

* fix: Update

Signed-off-by: Ce Gao <[email protected]>

* fix: Fix test case

Signed-off-by: Ce Gao <[email protected]>

Signed-off-by: Ce Gao <[email protected]>
  • Loading branch information
gaocegege authored and AlexXi19 committed Dec 12, 2022
1 parent 82cd7e4 commit 59254eb
Show file tree
Hide file tree
Showing 187 changed files with 7,214 additions and 1,197 deletions.
84 changes: 83 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,42 @@ jobs:
with:
name: e2e-cli-coverage-out
path: e2e-cli-coverage.out
e2e-cli-v1:
name: e2e-cli-v1
env:
# Disable telemetry.
ENVD_ANALYTICS: false
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Cache Go modules
uses: actions/cache@preview
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.OS }}-build-${{ env.cache-name }}-
${{ runner.OS }}-build-
${{ runner.OS }}-
- uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag
- name: e2e test
run: make e2e-cli-test-v1
env:
GIT_LATEST_TAG: ${{ steps.get-latest-tag.outputs.tag }}
- name: Upload coverage report
uses: actions/upload-artifact@v3
with:
name: e2e-cli-v1-coverage-out
path: e2e-cli-v1-coverage.out
e2e-lang:
name: e2e-lang
env:
Expand Down Expand Up @@ -157,6 +193,42 @@ jobs:
with:
name: e2e-lang-coverage-out
path: e2e-lang-coverage.out
e2e-lang-v1:
name: e2e-lang-v1
env:
# Disable telemetry.
ENVD_ANALYTICS: false
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Cache Go modules
uses: actions/cache@preview
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.OS }}-build-${{ env.cache-name }}-
${{ runner.OS }}-build-
${{ runner.OS }}-
- uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag
- name: e2e test
run: make e2e-lang-test-v1
env:
GIT_LATEST_TAG: ${{ steps.get-latest-tag.outputs.tag }}
- name: Upload coverage report
uses: actions/upload-artifact@v3
with:
name: e2e-lang-v1-coverage-out
path: e2e-lang-v1-coverage.out
build:
name: build
env:
Expand Down Expand Up @@ -207,7 +279,7 @@ jobs:
with:
name: coverage-out
path: merge

- name: Get cli e2e coverage report
uses: actions/download-artifact@v3
with:
Expand All @@ -218,6 +290,16 @@ jobs:
with:
name: e2e-lang-coverage-out
path: merge
- name: Get cli v1 e2e coverage report
uses: actions/download-artifact@v3
with:
name: e2e-cli-v1-coverage-out
path: merge
- name: Get language v1 e2e coverage report
uses: actions/download-artifact@v3
with:
name: e2e-lang-v1-coverage-out
path: merge
- name: Merge all coverage reports
uses: cutecutecat/go-cover-merge@v1
with:
Expand Down
108 changes: 108 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,3 +246,111 @@ jobs:
with:
name: e2e-doc-coverage-out
path: e2e-doc-coverage.out
e2e-cli-v1:
name: e2e-cli-v1
env:
# Disable telemetry.
ENVD_ANALYTICS: false
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Cache Go modules
uses: actions/cache@preview
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.OS }}-build-${{ env.cache-name }}-
${{ runner.OS }}-build-
${{ runner.OS }}-
- uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag
- name: e2e test
run: make e2e-cli-test-v1
env:
GIT_LATEST_TAG: ${{ steps.get-latest-tag.outputs.tag }}
- name: Upload coverage report
uses: actions/upload-artifact@v3
with:
name: e2e-cli-v1-coverage-out
path: e2e-cli-v1-coverage.out
e2e-lang-v1:
name: e2e-lang-v1
env:
# Disable telemetry.
ENVD_ANALYTICS: false
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Cache Go modules
uses: actions/cache@preview
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.OS }}-build-${{ env.cache-name }}-
${{ runner.OS }}-build-
${{ runner.OS }}-
- uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag
- name: e2e test
run: make e2e-lang-test-v1
env:
GIT_LATEST_TAG: ${{ steps.get-latest-tag.outputs.tag }}
- name: Upload coverage report
uses: actions/upload-artifact@v3
with:
name: e2e-lang-v1-coverage-out
path: e2e-lang-v1-coverage.out
e2e-doc-v1:
name: e2e-doc-v1
env:
# Disable telemetry.
ENVD_ANALYTICS: false
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Cache Go modules
uses: actions/cache@preview
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.OS }}-build-${{ env.cache-name }}-
${{ runner.OS }}-build-
${{ runner.OS }}-
- uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag
- name: e2e doc test
run: make e2e-doc-test-v1
env:
GIT_LATEST_TAG: ${{ steps.get-latest-tag.outputs.tag }}
- name: Upload coverage report
uses: actions/upload-artifact@v3
with:
name: e2e-doc-v1-coverage-out
path: e2e-doc-v1-coverage.out
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ __pycache__/

# Distribution / packaging
.Python
build/
./build/
develop-eggs/
dist/
downloads/
Expand Down
32 changes: 29 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ e2e-cli-test:
-X $(ROOT)/pkg/version.gitTreeState=$(GIT_TREE_STATE) \
-X $(ROOT)/pkg/version.gitTag="$(shell git describe --tags --abbrev=0)" \
-X $(ROOT)/pkg/version.developmentFlag=true" \
-race -v -timeout 20m -coverpkg=./pkg/... -coverprofile=e2e-cli-coverage.out ./e2e/cli
-race -v -timeout 20m -coverpkg=./pkg/... -coverprofile=e2e-cli-coverage.out ./e2e/v0/cli

e2e-lang-test:
@go test -ldflags "-s -w -X $(ROOT)/pkg/version.version=$(VERSION) \
Expand All @@ -202,7 +202,7 @@ e2e-lang-test:
-X $(ROOT)/pkg/version.gitTreeState=$(GIT_TREE_STATE) \
-X $(ROOT)/pkg/version.gitTag="$(shell git describe --tags --abbrev=0)" \
-X $(ROOT)/pkg/version.developmentFlag=true" \
-race -v -timeout 20m -coverpkg=./pkg/... -coverprofile=e2e-lang-coverage.out ./e2e/language
-race -v -timeout 20m -coverpkg=./pkg/... -coverprofile=e2e-lang-coverage.out ./e2e/v0/language

e2e-doc-test:
@go test -ldflags "-s -w -X $(ROOT)/pkg/version.version=$(VERSION) \
Expand All @@ -211,8 +211,34 @@ e2e-doc-test:
-X $(ROOT)/pkg/version.gitTreeState=$(GIT_TREE_STATE) \
-X $(ROOT)/pkg/version.gitTag="$(shell git describe --tags --abbrev=0)" \
-X $(ROOT)/pkg/version.developmentFlag=true" \
-race -v -timeout 60m -coverpkg=./pkg/... -coverprofile=e2e-doc-coverage.out ./e2e/docs
-race -v -timeout 60m -coverpkg=./pkg/... -coverprofile=e2e-doc-coverage.out ./e2e/v0/docs

e2e-cli-test-v1:
@go test -ldflags "-s -w -X $(ROOT)/pkg/version.version=$(VERSION) \
-X $(ROOT)/pkg/version.buildDate=$(BUILD_DATE) \
-X $(ROOT)/pkg/version.gitCommit=$(GIT_COMMIT) \
-X $(ROOT)/pkg/version.gitTreeState=$(GIT_TREE_STATE) \
-X $(ROOT)/pkg/version.gitTag="$(shell git describe --tags --abbrev=0)" \
-X $(ROOT)/pkg/version.developmentFlag=true" \
-race -v -timeout 20m -coverpkg=./pkg/... -coverprofile=e2e-cli-v1-coverage.out ./e2e/v1/cli

e2e-lang-test-v1:
@go test -ldflags "-s -w -X $(ROOT)/pkg/version.version=$(VERSION) \
-X $(ROOT)/pkg/version.buildDate=$(BUILD_DATE) \
-X $(ROOT)/pkg/version.gitCommit=$(GIT_COMMIT) \
-X $(ROOT)/pkg/version.gitTreeState=$(GIT_TREE_STATE) \
-X $(ROOT)/pkg/version.gitTag="$(shell git describe --tags --abbrev=0)" \
-X $(ROOT)/pkg/version.developmentFlag=true" \
-race -v -timeout 20m -coverpkg=./pkg/... -coverprofile=e2e-lang-v1-coverage.out ./e2e/v1/language

e2e-doc-test-v1:
@go test -ldflags "-s -w -X $(ROOT)/pkg/version.version=$(VERSION) \
-X $(ROOT)/pkg/version.buildDate=$(BUILD_DATE) \
-X $(ROOT)/pkg/version.gitCommit=$(GIT_COMMIT) \
-X $(ROOT)/pkg/version.gitTreeState=$(GIT_TREE_STATE) \
-X $(ROOT)/pkg/version.gitTag="$(shell git describe --tags --abbrev=0)" \
-X $(ROOT)/pkg/version.developmentFlag=true" \
-race -v -timeout 60m -coverpkg=./pkg/... -coverprofile=e2e-doc-v1-coverage.out ./e2e/v1/docs

clean: ## Clean the outputs and artifacts
@-rm -vrf ${OUTPUT_DIR}
Expand Down
2 changes: 1 addition & 1 deletion e2e/cli/build_test.go → e2e/v0/cli/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/tensorchord/envd/e2e"
e2e "github.com/tensorchord/envd/e2e/v0"
"github.com/tensorchord/envd/pkg/app"
"github.com/tensorchord/envd/pkg/docker"
"github.com/tensorchord/envd/pkg/envd"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/tensorchord/envd/e2e"
e2e "github.com/tensorchord/envd/e2e/v0"
)

func appendSomeToFile(path string) {
Expand Down
2 changes: 1 addition & 1 deletion e2e/cli/context_test.go → e2e/v0/cli/context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/tensorchord/envd/e2e"
e2e "github.com/tensorchord/envd/e2e/v0"
"github.com/tensorchord/envd/pkg/app"
"github.com/tensorchord/envd/pkg/home"
"github.com/tensorchord/envd/pkg/types"
Expand Down
2 changes: 1 addition & 1 deletion e2e/cli/get_env_test.go → e2e/v0/cli/get_env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/tensorchord/envd/e2e"
e2e "github.com/tensorchord/envd/e2e/v0"
"github.com/tensorchord/envd/pkg/app"
"github.com/tensorchord/envd/pkg/home"
)
Expand Down
2 changes: 1 addition & 1 deletion e2e/cli/init_test.go → e2e/v0/cli/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/tensorchord/envd/e2e"
e2e "github.com/tensorchord/envd/e2e/v0"
"github.com/tensorchord/envd/pkg/app"
"github.com/tensorchord/envd/pkg/home"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/tensorchord/envd/e2e"
e2e "github.com/tensorchord/envd/e2e/v0"
)

var _ = Describe("e2e quickstart", Ordered, func() {
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions e2e/v0/cli/testdata/build-test/build.envd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def build():
base(os="ubuntu20.04", language="python3")
8 changes: 8 additions & 0 deletions e2e/v0/cli/testdata/custom-image-test/build.envd
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
def build():
base(language="python", image="python:3.9-slim")
install.python_packages(
name=[
"via",
]
)
config.entrypoint(["date", "-u"])
File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions e2e/v0/cli/testdata/up-test/build.envd
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
def build():
base(os="ubuntu20.04", language="python3")
install.python_packages(
name=[
"via",
]
)
install.apt_packages(name=["screenfetch"])
shell("zsh")
config.pip_index(url="https://pypi.tuna.tsinghua.edu.cn/simple")
# git_config(name="envd", email="envd@envd", editor="vim")
install.vscode_extensions(["ms-python.python"])
2 changes: 1 addition & 1 deletion e2e/cli/up_test.go → e2e/v0/cli/up_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/tensorchord/envd/e2e"
e2e "github.com/tensorchord/envd/e2e/v0"
"github.com/tensorchord/envd/pkg/app"
"github.com/tensorchord/envd/pkg/docker"
"github.com/tensorchord/envd/pkg/envd"
Expand Down
2 changes: 1 addition & 1 deletion e2e/docs/docs_gpu_test.go → e2e/v0/docs/docs_gpu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package docs
import (
. "github.com/onsi/ginkgo/v2"

"github.com/tensorchord/envd/e2e"
e2e "github.com/tensorchord/envd/e2e/v0"
)

var _ = Describe("check GPU examples in documentation", Ordered, func() {
Expand Down
2 changes: 1 addition & 1 deletion e2e/docs/docs_test.go → e2e/v0/docs/docs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/tensorchord/envd/e2e"
e2e "github.com/tensorchord/envd/e2e/v0"
"github.com/tensorchord/envd/pkg/app"
"github.com/tensorchord/envd/pkg/home"
)
Expand Down
File renamed without changes.
Loading

0 comments on commit 59254eb

Please sign in to comment.