|
1 | | -# This workflow will build a Java project with Gradle |
2 | | -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle |
3 | | - |
4 | 1 | name: Build JavaBot |
5 | 2 |
|
6 | 3 | on: [push, pull_request, workflow_dispatch] |
|
11 | 8 | permissions: |
12 | 9 | contents: read |
13 | 10 | steps: |
14 | | - - uses: actions/checkout@v4 |
| 11 | + - uses: actions/checkout@v6 |
15 | 12 | - name: Set up JDK 25 |
16 | | - uses: actions/setup-java@v4 |
| 13 | + uses: actions/setup-java@v5 |
17 | 14 | with: |
18 | 15 | java-version: '25' |
| 16 | + cache: 'maven' |
19 | 17 | distribution: 'temurin' |
20 | | - - name: Grant execute permission for gradlew |
21 | | - run: chmod +x gradlew |
22 | | - - name: Build with Gradle |
23 | | - run: ./gradlew build |
24 | | - - name: Test with Gradle |
25 | | - run: ./gradlew test |
| 18 | + - name: Build and run tests |
| 19 | + run: mvn verify |
| 20 | + nativetest: |
| 21 | + runs-on: ubuntu-latest |
| 22 | + permissions: |
| 23 | + contents: read |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@v6 |
| 26 | + - name: Set up JDK 25 |
| 27 | + uses: graalvm/setup-graalvm@v1 |
| 28 | + with: |
| 29 | + java-version: '25' |
| 30 | + distribution: 'graalvm-community' |
| 31 | + cache: 'maven' |
| 32 | + - name: Run tests with native-image |
| 33 | + run: mvn test -PnativeTest |
26 | 34 | publish: |
27 | 35 | runs-on: ubuntu-latest |
28 | 36 | permissions: |
29 | 37 | contents: read |
30 | | - needs: build |
| 38 | + needs: |
| 39 | + - build |
31 | 40 | if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'workflow_dispatch' }} |
| 41 | + concurrency: |
| 42 | + group: publish |
| 43 | + cancel-in-progress: true |
32 | 44 | steps: |
33 | | - - uses: actions/checkout@v4 |
| 45 | + - uses: actions/checkout@v6 |
34 | 46 | - name: Set up JDK 25 |
35 | 47 | uses: graalvm/setup-graalvm@v1 |
36 | 48 | with: |
37 | 49 | java-version: '25' |
38 | 50 | distribution: 'graalvm-community' |
| 51 | + cache: 'maven' |
39 | 52 | - name: Build native-image |
40 | | - run: ./gradlew nativeCompile -Pprod |
| 53 | + run: "mvn native:compile -Pnative -Pprod '-P!dev'" |
41 | 54 | - name: Build Docker image |
42 | 55 | run: docker build -t javabot . |
43 | 56 | - name: Tag docker image |
|
48 | 61 | dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} |
49 | 62 | if: env.dockerhub_username != null |
50 | 63 | - name: Login to DockerHub |
51 | | - uses: docker/login-action@v3 |
| 64 | + uses: docker/login-action@v4 |
52 | 65 | with: |
53 | 66 | username: ${{ secrets.DOCKERHUB_USERNAME }} |
54 | 67 | password: ${{ secrets.DOCKERHUB_TOKEN }} |
|
0 commit comments