-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: PoAn Yang <[email protected]>
- Loading branch information
1 parent
8856b22
commit 8c54ad0
Showing
3 changed files
with
138 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
name: build | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- v* | ||
tags: | ||
- v* | ||
pull_request: | ||
jobs: | ||
flake8: | ||
name: flake8 check | ||
runs-on: ubuntu-latest | ||
container: | ||
image: rancher/dapper:v0.6.0 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
# flake8 check | ||
- name: Run dapper | ||
run: dapper | ||
|
||
build_images: | ||
name: Build images | ||
runs-on: ubuntu-latest | ||
needs: flake8 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
# For multi-platform support | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
# longhornio/longhorn-manager-test image | ||
- name: Build longhorn-manager-test image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./ | ||
push: false | ||
platforms: linux/amd64,linux/arm64 | ||
tags: longhornio/longhorn-manager-test:dry-run | ||
file: manager/integration/Dockerfile | ||
|
||
# longhornio/longhorn-e2e-test image | ||
- name: Build longhorn-e2e-test image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./ | ||
push: false | ||
platforms: linux/amd64,linux/arm64 | ||
tags: longhornio/longhorn-e2e-test:dry-run | ||
file: e2e/Dockerfile | ||
|
||
build_push_images: | ||
name: Build and push images | ||
runs-on: ubuntu-latest | ||
needs: build_images | ||
if: ${{ startsWith(github.ref, 'refs/heads/') || startsWith(github.ref, 'refs/tags/') }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
# For multi-platform support | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Declare branch | ||
run: | | ||
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> "$GITHUB_ENV" | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
# longhorn-manager-test image | ||
- name: Build and push longhorn-manager-test image with branch head | ||
if: ${{ startsWith(github.ref, 'refs/heads/') }} | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./ | ||
push: true | ||
platforms: linux/amd64,linux/arm64 | ||
tags: longhornio/longhorn-manager-test:${{ env.branch }}-head | ||
file: manager/integration/Dockerfile | ||
|
||
- name: Build and push longhorn-manager-test image with git tag | ||
if: ${{ startsWith(github.ref, 'refs/tags/') }} | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./ | ||
push: true | ||
platforms: linux/amd64,linux/arm64 | ||
tags: longhornio/longhorn-manager-test:${{ github.ref_name }} | ||
file: manager/integration/Dockerfile | ||
|
||
# longhorn-e2e-test image | ||
- name: Build and push longhorn-e2e-test image with branch head | ||
if: ${{ startsWith(github.ref, 'refs/heads/') }} | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./ | ||
push: true | ||
platforms: linux/amd64,linux/arm64 | ||
tags: longhornio/longhorn-e2e-test:${{ env.branch }}-head | ||
file: e2e/Dockerfile | ||
|
||
- name: Build and push longhorn-e2e-test image with git tag | ||
if: ${{ startsWith(github.ref, 'refs/tags/') }} | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./ | ||
push: true | ||
platforms: linux/amd64,linux/arm64 | ||
tags: longhornio/longhorn-e2e-test:${{ github.ref_name }} | ||
file: e2e/Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters