Skip to content

Commit 025ed5c

Browse files
authored
chore: Update GH Action workflows (#1)
1 parent 60bcf4b commit 025ed5c

File tree

4 files changed

+38
-47
lines changed

4 files changed

+38
-47
lines changed

.github/workflows/build-and-push.yml

+23-23
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
name: Build and Push
22

33
on:
4-
pull_request:
5-
branches: [ main ]
6-
types: [closed]
4+
push:
5+
branches: [main]
76

87
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Build develop image
13+
run: make build.develop
14+
- name: Run lint
15+
run: ./scripts/develop.sh make fmt
16+
- name: Run unit test
17+
run: ./scripts/develop.sh make test
918
build:
10-
if: github.event.pull_request.merged == true
19+
needs: test
1120
runs-on: ubuntu-latest
12-
21+
env:
22+
IMAGE_NAME: kserve/modelmesh-runtime-adapter
23+
IMAGE_TAG: latest
1324
steps:
14-
- uses: actions/checkout@v2
15-
- name: Build runtime image
16-
run: |
17-
BUILD_ID=$(date '+%Y%m%d')-$(git rev-parse HEAD | cut -c -5)
18-
IMAGE_TAG=main_${BUILD_ID}
19-
20-
./scripts/build_docker.sh --target runtime --tag $IMAGE_TAG
21-
22-
- name: Log in to docker hub
23-
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
24-
25-
- name: Push to docker hub
26-
run: |
27-
IMAGE_NAME=modelmesh-runtime-adapter
28-
IMAGE_ID=kserve/$IMAGE_NAME
29-
IMAGE_VERSION=latest
30-
31-
docker push $IMAGE_ID:$IMAGE_VERSION
25+
- uses: actions/checkout@v2
26+
- name: Build runtime image
27+
run: make build
28+
- name: Log in to Docker Hub
29+
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_ACCESS_TOKEN }}
30+
- name: Push to Docker Hub
31+
run: docker push ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}

.github/workflows/unit-test.yml

+9-15
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
11
name: Unit Test
22

33
on:
4-
push:
5-
branches: [ main ]
64
pull_request:
7-
branches: [ main ]
5+
branches: [main]
86

97
jobs:
10-
build:
11-
8+
test:
129
runs-on: ubuntu-latest
13-
1410
steps:
15-
- uses: actions/checkout@v2
16-
- name: Build develop image
17-
run: |
18-
BUILD_ID=$(date '+%Y%m%d')-$(git rev-parse HEAD | cut -c -5)
19-
IMAGE_TAG=main_${BUILD_ID}
20-
./scripts/build_docker.sh --target develop --tag $IMAGE_TAG
21-
- name: Run unit test
22-
run: |
23-
./scripts/develop.sh make test
11+
- uses: actions/checkout@v2
12+
- name: Build develop image
13+
run: make build.develop
14+
- name: Run lint
15+
run: ./scripts/develop.sh make fmt
16+
- name: Run unit test
17+
run: ./scripts/develop.sh make test

CONTRIBUTING.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ information on using pull requests.
1212

1313
The following should be viewed as Best Practices unless you know better ones (please submit a guidelines PR).
1414

15-
| Practice | Rationale |
16-
| -------- | --------- |
17-
| Keep the code clean | The health of the codebase is imperative to the success of the project. Files should be under 500 lines long in most cases, which may mean a refactor is necessary before adding changes. |
18-
| Limit your scope | No one wants to review a 1000 line PR. Try to keep your changes focused to ease reviewability. This may mean separating a large feature into several smaller milestones. |
19-
| Refine commit messages | Your commit messages should be in the imperative tense and clearly describe your feature upon first glance. See [this article](https://chris.beams.io/posts/git-commit/) for guidelines.
20-
| Reference an issue | Issues are a great way to gather design feedback from the community. To save yourself time on a controversial PR, first cut an issue for any major feature work. |
15+
| Practice | Rationale |
16+
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
17+
| Keep the code clean | The health of the codebase is imperative to the success of the project. Files should be under 500 lines long in most cases, which may mean a refactor is necessary before adding changes. |
18+
| Limit your scope | No one wants to review a 1000 line PR. Try to keep your changes focused to ease reviewability. This may mean separating a large feature into several smaller milestones. |
19+
| Refine commit messages | Your commit messages should be in the imperative tense and clearly describe your feature upon first glance. See [this article](https://chris.beams.io/posts/git-commit/) for guidelines. |
20+
| Reference an issue | Issues are a great way to gather design feedback from the community. To save yourself time on a controversial PR, first cut an issue for any major feature work. |

scripts/build_docker.sh

-3
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,10 @@ if [ "${DOCKER_TARGET}" != "runtime" ]; then
7373
IMAGE_SUFFIX="-${DOCKER_TARGET}"
7474
fi
7575

76-
BASE_TAG="$(cat BASE_IMAGE_TAG | awk -F= '{print $2}')"
77-
7876
declare -a docker_args=(
7977
--target "${DOCKER_TARGET}"
8078
-t "kserve/modelmesh-runtime-adapter${IMAGE_SUFFIX}:${DOCKER_TAG}"
8179
-t "kserve/modelmesh-runtime-adapter${IMAGE_SUFFIX}:latest"
82-
--build-arg "BASE_IMAGE_TAG=${BASE_TAG}"
8380
)
8481

8582
if [[ $DOCKER_TARGET == 'runtime' ]]; then

0 commit comments

Comments
 (0)