forked from openobserve/openobserve
-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (82 loc) · 2.95 KB
/
build-pr-image.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
name: Build PR Docker Image
on:
pull_request:
branches:
- "*"
paths-ignore:
- "**.md"
env:
AWS_REGION: us-east-1
jobs:
build_pr_image:
name: build_pr_image
permissions:
id-token: write
contents: read
runs-on: ${{ github.event.pull_request.head.repo.fork == true && 'ubuntu-2004-8-cores' || 'ubicloud-standard-8' }}
steps:
- name: Remove unused tools
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Clone the current repo
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref || github.ref }}
fetch-depth: 0
fetch-tags: true
- name: Setup Rust Toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2024-03-02
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
version: "21.12"
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Build frontend code
run: cd web && npm install && npm run build
- name: Print rustc cfg
run: rustc --print cfg
- name: Build and run binary
run: |
cargo build --release --features mimalloc --target x86_64-unknown-linux-gnu
mkdir -p bin
mv target/x86_64-unknown-linux-gnu/release/openobserve bin/openobserve
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ env.AWS_REGION }}
role-to-assume: arn:aws:iam::058694856476:role/GitHubActionsRole
role-session-name: GithubActionsSession
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
with:
registry-type: public
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set GIT_TAG env
run: |
echo "GIT_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
echo "GIT_HASH=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v5
with:
file: deploy/build/Dockerfile.pr.amd64
context: .
tags: |
public.ecr.aws/zinclabs/openobserve-dev:${{ env.GIT_TAG }}-${{ env.GIT_HASH}}-amd64
push: true
cache-from: type=gha
cache-to: type=gha,mode=max