define names
[yosql.git] / .github / workflows / build.yml
blobc4ceb69cd664511240863dbedc151ab7554c8b97
1 name: Build Project
2 on:
3   push:
4     branches: [ main ]
5   pull_request:
6     branches: [ main ]
7 jobs:
8   build:
9     name: Install Project Artifacts
10     runs-on: ubuntu-latest
11     steps:
12       - id: checkout
13         name: Clone Git Repository
14         uses: actions/checkout@v2
15       - id: java
16         name: Setup Java
17         uses: actions/setup-java@v1
18         with:
19           java-version: 15
20           java-package: jdk
21           architecture: x64
22       - id: cache
23         name: Cache Maven Repository
24         uses: actions/cache@v1
25         with:
26           path: ~/.m2/repository
27           key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
28           restore-keys: |
29             ${{ runner.os }}-maven-
30       - id: install
31         name: Install Project
32         run: mvn --batch-mode --settings $GITHUB_WORKSPACE/build/settings.xml install
33         env:
34           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35   benchmarks:
36     name: Benchmarks
37     runs-on: ubuntu-latest
38     needs: [build]
39     strategy:
40       matrix:
41         benchmark: ["codegen", "jdbc"]
42     steps:
43       - id: checkout
44         name: Clone Git Repository
45         uses: actions/checkout@v2
46       - id: java
47         name: Setup Java
48         uses: actions/setup-java@v1
49         with:
50           java-version: 15
51           java-package: jdk
52           architecture: x64
53       - id: cache
54         name: Cache Maven Repository
55         uses: actions/cache@v1
56         with:
57           path: ~/.m2/repository
58           key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
59           restore-keys: |
60             ${{ runner.os }}-maven-
61       - id: benchmark
62         name: Run Benchmark [${{ matrix.benchmark }}]
63         run: mvn --batch-mode --settings $GITHUB_WORKSPACE/build/settings.xml --projects yosql-benchmarks/yosql-benchmarks-${{ matrix.benchmark }} --also-make --activate-profiles benchmarks verify -Dorg.slf4j.simpleLogger.log.yosql=warn -DskipTests
64         env:
65           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66       - id: upload
67         name: Upload Benchmark Results
68         uses: actions/upload-artifact@v2
69         with:
70           name: benchmark-${{ matrix.benchmark }}
71           path: ./yosql-benchmarks/yosql-benchmarks-${{ matrix.benchmark }}/target/benchmark/yosql-benchmarks-${{ matrix.benchmark }}.json
72   website:
73     name: Website
74     runs-on: ubuntu-latest
75     needs: [benchmarks]
76     if: ${{ github.ref == 'refs/heads/main' }}
77     steps:
78       - id: checkout
79         name: Clone Git Repository
80         uses: actions/checkout@v2
81       - id: hugo
82         name: Setup Hugo
83         uses: peaceiris/actions-hugo@v2
84         with:
85           hugo-version: latest
86       - id: download-codegen
87         name: Download Codegen Results
88         uses: actions/download-artifact@v2
89         with:
90           name: benchmark-codegen
91           path: ./yosql-website/content/benchmarks/current/yosql-benchmarks-codegen.json
92       - id: download-jdbc
93         name: Download JDBC Results
94         uses: actions/download-artifact@v2
95         with:
96           name: benchmark-jdbc
97           path: ./yosql-website/content/benchmarks/current/yosql-benchmarks-jdbc.json
98       - id: website
99         name: Build Website
100         run: hugo --minify --i18n-warnings --path-warnings --source yosql-website
101       - id: deploy
102         name: Deploy Website
103         uses: peaceiris/actions-gh-pages@v3
104         with:
105           github_token: ${{ secrets.GITHUB_TOKEN }}
106           publish_dir: ./yosql-website/public
107           force_orphan: true
108           cname: yosql.projects.metio.wtf