-
Notifications
You must be signed in to change notification settings - Fork 50
159 lines (151 loc) · 6.23 KB
/
traces-api-facade.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: Traces-api-facade CI
on:
push:
workflow_dispatch:
inputs:
coverage:
description: To generate test report
required: false
type: boolean
default: false
jobs:
changes:
runs-on: ubuntu-latest
name: Filter commit changes
outputs:
traces-api-facade: ${{ steps.filter.outputs.traces-api-facade }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Filter commit changes
uses: dorny/paths-filter@v2
id: filter
with:
base: ${{ github.ref }}
list-files: "json"
filters: |
traces-api-facade:
- 'traces-api-facade/**'
- 'jvm-libs/**'
- 'config/common/traces-limits-v1.toml'
- '.github/workflows/traces-api-facade.yml'
- '.github/workflows/reuse-*.yml'
- 'buildSrc/**'
- 'gradle/**'
- 'build.gradle'
- 'gradle.properties'
- 'settings.gradle'
store_image_name_and_tags:
uses: ./.github/workflows/reuse-store-image-name-and-tags.yml
with:
image_name: consensys/linea-traces-api-facade
check_image_tags_exist:
needs: [ changes, store_image_name_and_tags ]
if: ${{ needs.changes.outputs.traces-api-facade == 'false' }}
uses: ./.github/workflows/reuse-check-image-tags-exist.yml
with:
last_commit_tag: ${{ needs.store_image_name_and_tags.outputs.last_commit_tag }}
common_ancestor_tag: ${{ needs.store_image_name_and_tags.outputs.common_ancestor_tag }}
image_name: ${{ needs.store_image_name_and_tags.outputs.image_name }}
secrets: inherit
traces-api-facade-tag-only:
needs: [ changes, store_image_name_and_tags, check_image_tags_exist ]
if: ${{ needs.changes.outputs.traces-api-facade == 'false' }}
uses: ./.github/workflows/reuse-image-tag-push.yml
with:
commit_tag: ${{ needs.store_image_name_and_tags.outputs.commit_tag }}
last_commit_tag: ${{ needs.store_image_name_and_tags.outputs.last_commit_tag }}
common_ancestor_tag: ${{ needs.store_image_name_and_tags.outputs.common_ancestor_tag }}
develop_tag: ${{ needs.store_image_name_and_tags.outputs.develop_tag }}
untested_tag_suffix: ${{ needs.store_image_name_and_tags.outputs.untested_tag_suffix }}
image_name: ${{ needs.store_image_name_and_tags.outputs.image_name }}
last_commit_tag_exists: ${{ needs.check_image_tags_exist.outputs.last_commit_tag_exists }}
common_ancestor_commit_tag_exists: ${{ needs.check_image_tags_exist.outputs.common_ancestor_commit_tag_exists }}
secrets: inherit
build-and-publish:
needs: [ changes, store_image_name_and_tags, traces-api-facade-tag-only ]
if: ${{ always() && (needs.changes.outputs.traces-api-facade == 'true' || needs.traces-api-facade-tag-only.result != 'success' || needs.traces-api-facade-tag-only.outputs.image_tagged != 'true') }}
runs-on: ubuntu-latest
env:
COMMIT_TAG: ${{ needs.store_image_name_and_tags.outputs.commit_tag }}
DEVELOP_TAG: ${{ needs.store_image_name_and_tags.outputs.develop_tag }}
UNTESTED_TAG_SUFFIX: ${{ needs.store_image_name_and_tags.outputs.untested_tag_suffix }}
IMAGE_NAME: ${{ needs.store_image_name_and_tags.outputs.image_name }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Run tests with coverage
uses: nick-fields/retry@v2
if: ${{ inputs.coverage }}
with:
max_attempts: 2
retry_on: error
timeout_minutes: 20
command: |
./gradlew traces-api-facade:app:buildNeeded jacocoRootReport
- name: Run tests without coverage
uses: nick-fields/retry@v2
if: ${{ !inputs.coverage }}
with:
max_attempts: 2
retry_on: error
timeout_minutes: 20
command: |
./gradlew traces-api-facade:app:buildNeeded
- name: Build dist
run: |
./gradlew traces-api-facade:app:shadowJar
echo ${{ github.workspace }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker meta
id: traces-api-facade
uses: docker/metadata-action@v3
with:
images: consensys/linea-traces-api-facade
- name: Build & push
uses: docker/build-push-action@v4
with:
context: .
build-contexts: jar=./traces-api-facade/app/build/libs/
file: ./traces-api-facade/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ env.IMAGE_NAME }}:${{ env.COMMIT_TAG }}-${{ env.UNTESTED_TAG_SUFFIX }}
run-e2e-tests:
needs: [ changes, store_image_name_and_tags, build-and-publish ]
if: ${{ always() && (needs.changes.outputs.coordinator == 'true' || needs.build-and-publish.result == 'success') }}
uses: ./.github/workflows/reuse-run-e2e-tests.yml
with:
commit_tag: ${{ needs.store_image_name_and_tags.outputs.commit_tag }}
untested_tag_suffix: ${{ needs.store_image_name_and_tags.outputs.untested_tag_suffix }}
secrets: inherit
tag-after-run-tests-success:
needs: [ store_image_name_and_tags, run-e2e-tests ]
if: ${{ always() && needs.run-e2e-tests.outputs.tests_outcome == 'success' }}
uses: ./.github/workflows/reuse-tag-without-untested-suffix.yml
with:
commit_tag: ${{ needs.store_image_name_and_tags.outputs.commit_tag }}
develop_tag: ${{ needs.store_image_name_and_tags.outputs.develop_tag }}
untested_tag_suffix: ${{ needs.store_image_name_and_tags.outputs.untested_tag_suffix }}
image_name: ${{ needs.store_image_name_and_tags.outputs.image_name }}
secrets: inherit