-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (110 loc) Β· 3.57 KB
/
build-and-test.yaml
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
name: "Build and Test"
on:
push:
branches:
- "master"
jobs:
build-natively-with-gradle:
name: "Build natively with Gradle"
runs-on: "ubuntu-latest"
steps:
- name: "Check out source code"
uses: "actions/checkout@v4.2.2"
- name: "Set up JDK 21"
uses: "actions/setup-java@v4.5.0"
with:
java-version: "21"
distribution: "corretto"
- name: "Validate Gradle wrapper"
uses: "gradle/actions/wrapper-validation@v3.5.0"
- name: "Set up Gradle"
uses: "gradle/actions/setup-gradle@v3.5.0"
- name: "Build with Gradle"
run: "gradle build"
- name: "Upload 'AdventOfCode.jar' artifact"
uses: "actions/upload-artifact@v4.4.3"
with:
name: "AdventOfCode.jar"
path: "build/libs/AdventOfCode.jar"
if-no-files-found: "error"
- name: "Upload Ktlint reports artifact"
if: "${{ always() }}"
uses: "actions/upload-artifact@v4.4.3"
with:
name: "Ktlint reports"
path: "build/reports/ktlint"
if-no-files-found: "error"
- name: "Upload test summary artifact"
if: "${{ always() }}"
uses: "actions/upload-artifact@v4.4.3"
with:
name: "Test summary"
path: "build/reports/tests/test"
if-no-files-found: "error"
- name: "Upload coverage report artifact"
if: "${{ always() }}"
uses: "actions/upload-artifact@v4.4.3"
with:
name: "Coverage report"
path: "build/reports/jacoco/test/html"
if-no-files-found: "error"
- name: "Publish coverage data to Codecov"
uses: "codecov/codecov-action@v5.0.4"
with:
token: "${{ secrets.CODECOV_TOKEN }}"
run-jar-natively:
name: "Run JAR archive natively"
needs: "build-natively-with-gradle"
runs-on: "ubuntu-latest"
steps:
- name: "Download 'AdventOfCode.jar' artifact"
uses: "actions/download-artifact@v4.1.8"
with:
name: "AdventOfCode.jar"
path: "."
- name: "Set up JDK 21"
uses: "actions/setup-java@v4.5.0"
with:
java-version: "21"
distribution: "corretto"
- name: "Run JAR archive"
run: "java -jar AdventOfCode.jar 2023"
build-docker-image:
name: "Build Docker Image"
runs-on: "ubuntu-latest"
steps:
- name: "Check out source code"
uses: "actions/checkout@v4.2.2"
- name: "Set up Docker Buildx"
uses: "docker/setup-buildx-action@v3.7.1"
- name: "Build Docker Image"
uses: "docker/build-push-action@v6.9.0"
with:
tags: "pfolta/advent-of-code:latest"
outputs: "type=docker, dest=AdventOfCode.tar"
push: false
- name: "Upload Docker image artifact"
uses: "actions/upload-artifact@v4.4.3"
with:
name: "Docker Image"
path: "AdventOfCode.tar"
if-no-files-found: "error"
run-docker-image:
name: "Run Docker Image"
needs: "build-docker-image"
runs-on: "ubuntu-latest"
steps:
- name: "Download Docker image artifact"
uses: "actions/download-artifact@v4.1.8"
with:
name: "Docker Image"
path: "."
- name: "Load Docker image"
run: |
docker load --input AdventOfCode.tar
docker image ls pfolta/advent-of-code
- name: "Run Docker image"
uses: "addnab/docker-run-action@v3"
with:
image: "pfolta/advent-of-code:latest"
run: "java -jar AdventOfCode.jar 2023"