test #133
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
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 | |
make: | |
name: make check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
# local buid check | |
- name: Run make | |
run: make | |
build_images: | |
name: Build images | |
runs-on: ubuntu-latest | |
needs: [flake8, make] | |
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 |