-
Notifications
You must be signed in to change notification settings - Fork 65
76 lines (74 loc) · 2.16 KB
/
rest-server-continuous-integration.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
name: REST Server - Continuous Integration
###
# Continuous integration GitHub Action
#
# -> Push your code to the `main` branch to have it automatically tested
#
###
on:
push:
branches:
- main
paths:
- 'rest-server/**'
- '.github/workflows/rest-server-continuous-integration.yml'
pull_request:
branches:
- main
paths:
- 'rest-server/**'
- '.github/workflows/rest-server-continuous-integration.yml'
jobs:
test:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: ${{ github.workspace }}/rest-server
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'oracle'
java-version: '21'
check-latest: false
cache: 'maven'
- name: Run tests
run: ./mvnw verify
build_native_docker_image:
name: Build and publish the native (Linux) Docker image
needs: [ test ]
runs-on: ubuntu-22.04
permissions:
actions: read
contents: read
deployments: read
packages: write
pull-requests: write
security-events: write
env:
DOCKER_IMAGE_NAME: 'ghcr.io/microsoft/nubesgen/nubesgen-native'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Login to GitHub Packages
run: docker login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io
- uses: graalvm/setup-graalvm@v1
with:
distribution: 'graalvm'
java-version: '21'
github-token: ${{ secrets.GITHUB_TOKEN }}
cache: 'maven'
- name: Build application with GraalVM
run: |
cd rest-server && ./mvnw -Pnative native:compile
- name: Build the native (GraalVM) Docker image
uses: docker/build-push-action@v5
with:
push: false
tags: ${{ env.DOCKER_IMAGE_NAME }}:main
file: ./rest-server/src/main/docker/Dockerfile.native
context: ./rest-server/
- name: Push to GitHub Packages
run: docker push ${{ env.DOCKER_IMAGE_NAME }}:main
if: ${{ github.repository == 'microsoft/nubesgen' && github.event_name != 'pull_request' }}