format maven examples
[yosql.git] / .github / workflows / build.yml
blobd5e9be0f30f8fa9ffd479de023fd1f24fff56674
1 name: Build Project
2 on:
3   push:
4     branches: [ main ]
5     paths:
6       - "yosql-codegen/**"
7       - "yosql-converters/**"
8       - "yosql-dao/**"
9       - "yosql-internals/**"
10       - "yosql-logging/**"
11       - "yosql-models/**"
12       - "yosql-testing/**"
13       - "yosql-tooling/**"
14   pull_request:
15     branches: [ main ]
16     paths:
17       - "yosql-codegen/**"
18       - "yosql-converters/**"
19       - "yosql-dao/**"
20       - "yosql-internals/**"
21       - "yosql-logging/**"
22       - "yosql-models/**"
23       - "yosql-testing/**"
24       - "yosql-tooling/**"
25 env:
26   JAVA_VERSION: 16
27   JAVA_PACKAGE: jdk
28   JAVA_ARCH: x64
29   JAVA_DISTRO: adopt
30 jobs:
31   build:
32     name: Build
33     runs-on: ubuntu-latest
34     steps:
35       - id: checkout
36         name: Clone Git Repository
37         uses: actions/checkout@v2
38       - id: java
39         name: Setup Java
40         uses: actions/setup-java@v2
41         with:
42           java-version: ${{ env.JAVA_VERSION }}
43           java-package: ${{ env.JAVA_PACKAGE }}
44           architecture: ${{ env.JAVA_ARCH }}
45           distribution: ${{ env.JAVA_DISTRO }}
46       - id: cache
47         name: Cache Maven Repository
48         uses: actions/cache@v2.1.5
49         with:
50           path: ~/.m2/repository
51           key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
52           restore-keys: |
53             ${{ runner.os }}-maven-
54       - id: maven
55         name: Maven Artifacts
56         run: mvn --batch-mode install
57       - id: gradle-plugin
58         name: Gradle Plugin
59         run: cd ./yosql-tooling/yosql-tooling-gradle/ && ./gradlew build
60   benchmarks:
61     name: Benchmarks
62     runs-on: ubuntu-latest
63     needs: [build]
64     strategy:
65       matrix:
66         benchmark: [codegen, jdbc]
67     steps:
68       - id: checkout
69         name: Clone Git Repository
70         uses: actions/checkout@v2
71       - id: java
72         name: Setup Java
73         uses: actions/setup-java@v2
74         with:
75           java-version: ${{ env.JAVA_VERSION }}
76           java-package: ${{ env.JAVA_PACKAGE }}
77           architecture: ${{ env.JAVA_ARCH }}
78           distribution: ${{ env.JAVA_DISTRO }}
79       - id: cache
80         name: Cache Maven Repository
81         uses: actions/cache@v2.1.5
82         with:
83           path: ~/.m2/repository
84           key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
85           restore-keys: |
86             ${{ runner.os }}-maven-
87       - id: run-benchmark
88         name: Run Benchmark [${{ matrix.benchmark }}]
89         run: mvn --batch-mode --projects yosql-benchmarks/yosql-benchmarks-${{ matrix.benchmark }} --also-make --activate-profiles benchmarks verify -Dorg.slf4j.simpleLogger.log.yosql=warn -DskipTests 2>&1 1> build.log
90       - id: upload-benchmark
91         name: Upload Benchmark Results
92         uses: actions/upload-artifact@v2
93         with:
94           name: benchmark-${{ matrix.benchmark }}
95           path: ./yosql-benchmarks/yosql-benchmarks-${{ matrix.benchmark }}/target/benchmark/yosql-benchmarks-${{ matrix.benchmark }}.json