-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (103 loc) · 3.35 KB
/
ci.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
name: Continuous Integration
on:
pull_request:
push:
branches:
- 'main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build-and-test:
name: Build and Run Tests
strategy:
matrix:
java-version: [ 17 ]
runs-on: ubuntu-latest
steps:
- name: Checkout current branch
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ matrix.java-version }}
cache: sbt
- name: Build and Test
run: sbt -v coverage test headerCheckAll fmtCheck coverageAggregate
- name: Unit Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: Unit Test Results
path: ./target/test-reports/TEST-*.xml
reporter: java-junit
- name: Upload coverage data to codacy
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: ./target/scala-3.3.0/coverage-report/cobertura.xml
test-docs-build:
name: Test docs
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Install requirements (pip, npm, apt)
run: |
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
- name: Build docs
run: mkdocs build
publish-docker-image:
if: github.ref == 'refs/heads/main'
needs: build-and-test
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.docker_image_tag.outputs.tag }}
strategy:
matrix:
java-version: [ 17 ]
steps:
- name: Checkout current branch
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ matrix.java-version }}
cache: sbt
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Build and push image
run: export DOCKER_BUILDKIT=1; sbt Docker/publish
- name: Output docker image tag
id: docker_image_tag
run: echo "tag=$(git describe --tag --dirty --abbrev=7 --always | tr -d '\n')" >> "$GITHUB_OUTPUT"
shell: bash # Explicit for fail-fast behaviour
trigger-dev-deployment:
name: Trigger deployment to DEV
runs-on: ubuntu-latest
needs: publish-docker-image
steps:
- name: Trigger deployment to DEV
env:
IMAGE_TAG: ${{needs.publish-docker-image.outputs.tag}}
JENKINS_BASIC_AUTH_USER: ${{secrets.JENKINS_BASIC_AUTH_USER}}
JENKINS_BASIC_AUTH_PASS: ${{secrets.JENKINS_BASIC_AUTH_PASS}}
JENKINS_DEV_WEBHOOK: ${{secrets.JENKINS_DEV_WEBHOOK}}
run: |
echo "Trigger deployment for tag=$IMAGE_TAG"; \
curl -f -u "${JENKINS_BASIC_AUTH_USER}:${JENKINS_BASIC_AUTH_PASS}" \
-X POST "${JENKINS_DEV_WEBHOOK}" \
-d "Service=ingest&Version=${IMAGE_TAG}"