-
Notifications
You must be signed in to change notification settings - Fork 1
130 lines (110 loc) · 3.95 KB
/
gradle.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
name: Build mod-directory
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
on:
push:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
checks: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v2
- name: Start containers
run: |
cd tools/testing
docker compose down -v
docker compose up -d &> dockerOutput.log
sleep 20
- name: Inject github build number
run: |
# Make github run id available to gradle script via env var BUILD_NUMBER so it ends up in our module descriptor version
# echo "BUILD_NUMBER=${{github.run_id}}" >> $GITHUB_ENV
echo "BUILD_NUMBER=${{github.run_number}}" >> $GITHUB_ENV
- name: Build with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: build integrationTest
build-root-directory: service
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: integration-test-results
path: service/build/test-results/integrationTest/
- name: Upload container logs
if: always()
uses: actions/upload-artifact@v4
with:
name: container-logs
path: tools/testing/*.log
- name: Stop containers
if: always()
run: |
cd tools/testing
docker compose down -v
sleep 10
- name: Upload Test Results Files
uses: actions/upload-artifact@v4
if: always()
with:
name: testLogfiles
path: |
service/build/test-results/**/*.xml
tools/testing/*.log
retention-days: 1
- name: Log in to the Container registry
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || contains(github.ref, 'release') }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || contains(github.ref, 'release') }}
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# master and main
- name: Build and push Docker image
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# extra tags for release branch
- name: Build and push Docker image
if: ${{ contains(github.ref, 'release') }}
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}, ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:rc
labels: ${{ steps.meta.outputs.labels }}
- name: delete untagged containers
if: always()
uses: actions/delete-package-versions@v5
with:
package-name: 'mod-directory'
package-type: 'container'
min-versions-to-keep: 0
delete-only-untagged-versions: 'true'
- name: Publish Descriptor
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || contains(github.ref, 'release') }}
run: |
echo Post to public registry
curl -i -XPOST https://registry.reshare-dev.indexdata.com/_/proxy/modules -d @service/build/resources/main/okapi/ModuleDescriptor.json