-
-
Notifications
You must be signed in to change notification settings - Fork 50
129 lines (112 loc) · 3.45 KB
/
push_main.yml
File metadata and controls
129 lines (112 loc) · 3.45 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Push docker image
on:
push:
branches:
- main
jobs:
test:
name: Testing
runs-on: ubuntu-latest
services:
postgres:
image: postgres
ports:
- "5433:5432"
env:
POSTGRES_PASSWORD: password_test
POSTGRES_USER: nebula_test
POSTGRES_DB: nebula_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
clickhouse:
image: clickhouse/clickhouse-server:24.12
ports:
- "8124:8123"
- "9001:9000"
env:
CLICKHOUSE_PASSWORD: password_test
CLICKHOUSE_USER: nebula_test
CLICKHOUSE_DB: nebula_test
options: >-
--health-cmd "clickhouse-client --query=\"SELECT 1\""
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checking out repository code
uses: actions/checkout@v4
- name: Setting up Golang
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Setting up just
uses: extractions/setup-just@v3
- name: Running tests
run: just test-plain
push_to_dockerhub:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
needs: test
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Setting up QEMU
uses: docker/setup-qemu-action@v3
- name: Setting up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: dennistra/nebula-crawler
tags: |
type=sha
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push_to_ecr:
name: Push Docker image to ProbeLab's ECR
runs-on: ubuntu-latest
needs: test
steps:
- name: Checking out the repo
uses: actions/checkout@v4
- name: Configuring AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-east-1
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_ACCESS_SECRET }}
- name: Log in to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Setting up just
uses: extractions/setup-just@v3
- name: Build, tag, and push docker image to Amazon ECR
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: probelab
run: |
SHA_SHORT=${{ github.sha }}
SHA_SHORT=${SHA_SHORT::7}
IMAGE_TAG="nebula-sha${SHA_SHORT}"
docker build \
--build-arg VERSION=$(cat version) \
--build-arg COMMIT=$SHA_SHORT \
--build-arg BUILT_BY=ghaction \
--build-arg DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
-t $REGISTRY/$REPOSITORY:$IMAGE_TAG \
.
docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG