forked from spiceai/spiceai
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestoperator_build_and_release.yml
More file actions
108 lines (92 loc) · 3.55 KB
/
testoperator_build_and_release.yml
File metadata and controls
108 lines (92 loc) · 3.55 KB
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
name: Build testoperator binary and Docker Image
on:
push:
branches:
- trunk
paths:
- 'tools/testoperator/**'
- 'crates/test-framework/**'
- 'Cargo.lock'
- '.github/workflows/testoperator_build_and_release.yml'
- '.github/actions/build-testoperator/**'
workflow_dispatch:
inputs:
publish:
description: 'Publish Docker image to GHCR'
required: false
type: boolean
default: false
permissions:
contents: read
packages: write
jobs:
build-binary:
name: Build testoperator
runs-on: spiceai-dev-runners
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CARGO_NET_GIT_FETCH_WITH_CLI: true
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Install MinIO
uses: ./.github/actions/setup-minio
with:
minio_endpoint: ${{ secrets.TEST_MINIO_ENDPOINT }}
minio_access_key: ${{ secrets.TEST_MINIO_ACCESS_KEY }}
minio_secret_key: ${{ secrets.TEST_MINIO_SECRET_KEY }}
- name: Build testoperator
uses: ./.github/actions/build-testoperator
with:
install_to_system_path: 'false'
upload_artifact: 'true'
force_rebuild: 'true'
download_from_minio: 'true'
minio_endpoint: ${{ secrets.TEST_MINIO_ENDPOINT }}
minio_access_key: ${{ secrets.TEST_MINIO_ACCESS_KEY }}
minio_secret_key: ${{ secrets.TEST_MINIO_SECRET_KEY }}
- name: Print version
run: ./target/release/testoperator --version
build-docker:
name: Build Docker image
needs: build-binary
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Download binary
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: testoperator-linux
path: ./build
- name: List artifacts
run: ls -lR ./build
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- name: Login to Docker Hub
# Authenticate to Docker Hub before building so the base image pull
# uses the authenticated rate limits instead of anonymous (per-IP) limits.
if: github.repository == 'spiceai/spiceai'
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Copy Dockerfile to build context
run: cp tools/testoperator/Dockerfile ./build/Dockerfile
- name: Build image
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
with:
context: ./build
file: ./build/Dockerfile
platforms: linux/amd64
push: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'true') }}
tags: |
ghcr.io/${{ github.repository_owner }}/testoperator:${{ github.sha }}
ghcr.io/${{ github.repository_owner }}/testoperator:latest
cache-from: type=gha,scope=testoperator
cache-to: type=gha,scope=testoperator,mode=max