diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index f188bf2..d151dee 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -4,7 +4,7 @@ name: CI on: - pull_request_target: + pull_request: branches: [ "main" ] env: @@ -16,6 +16,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + submodules: true - uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} @@ -32,7 +35,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - + with: + ref: ${{ github.event.pull_request.head.sha }} + submodules: true + - name: Get branch names. id: branch-names uses: tj-actions/branch-names@v8 @@ -43,16 +49,16 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Docker Login - uses: docker/login-action@v3.1.0 - with: - username: ${{ secrets.DOCKERHUB_TOKEN }} - password: ${{ secrets.DOCKERHUB_PASSWD }} + #- name: Docker Login + # uses: docker/login-action@v3.1.0 + # with: + # username: ${{ secrets.DOCKERHUB_TOKEN }} + # password: ${{ secrets.DOCKERHUB_PASSWD }} - name: Build and push uses: docker/build-push-action@v6 with: - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64 push: false build-args: | BASE_IMAGE=ubuntu:20.04 diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index a36978e..339b2d9 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -22,6 +22,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + submodules: true - uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} @@ -38,6 +41,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + submodules: true - name: Get branch names. id: branch-names diff --git a/Dockerfile b/Dockerfile index 0679080..b99381f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,8 +12,9 @@ ENV GOPATH=/go ARG VERSION WORKDIR /build ADD . . -RUN --mount=type=cache,target=/go/pkg/mod \ - make all +RUN go mod download github.com/Project-HAMi/HAMi +RUN go get github.com/Project-HAMi/ascend-device-plugin/internal/server +RUN make all FROM $BASE_IMAGE ENV LD_LIBRARY_PATH=/usr/local/Ascend/driver/lib64:/usr/local/Ascend/driver/lib64/driver:/usr/local/Ascend/driver/lib64/common diff --git a/Makefile b/Makefile index 710f082..8dceeed 100644 --- a/Makefile +++ b/Makefile @@ -14,11 +14,11 @@ docker: --build-arg GOPROXY=https://goproxy.cn,direct \ -t ${IMG_NAME}:${VERSION} . -lint: tidy +lint: $(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.61.0 golangci-lint run -ascend-device-plugin: tidy +ascend-device-plugin: $(GO) build $(BUILDARGS) -o ./ascend-device-plugin ./cmd/main.go clean: diff --git a/README.md b/README.md index 4c0dc48..2523e59 100644 --- a/README.md +++ b/README.md @@ -65,16 +65,13 @@ To exclusively use an entire card or request multiple cards, you only need to se huawei.com/Ascend910B-memory: "4096" ``` +For more examples, see [examples](./examples/) -## License -[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FProject-HAMi%2Fascend-device-plugin.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2FProject-HAMi%2Fascend-device-plugin?ref=badge_large) - For more examples, see [examples](./examples/) - - ### Usage in volcano +### Usage in volcano - Volcano must be installed prior to usage, for more information see [here](https://github.com/volcano-sh/volcano/tree/master/docs/user-guide/how_to_use_vnpu.md) +Volcano must be installed prior to usage, for more information see [here](https://github.com/volcano-sh/volcano/tree/master/docs/user-guide/how_to_use_vnpu.md) - ```yaml +```yaml apiVersion: v1 kind: Pod metadata: @@ -91,3 +88,6 @@ spec: huawei.com/Ascend310P: "1" huawei.com/Ascend310P-memory: "4096" ``` + +## License +[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FProject-HAMi%2Fascend-device-plugin.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2FProject-HAMi%2Fascend-device-plugin?ref=badge_large) \ No newline at end of file