-
Notifications
You must be signed in to change notification settings - Fork 54
123 lines (110 loc) · 3.47 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
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