forked from rockcrafters/java-rockcraft-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (105 loc) · 3.06 KB
/
build.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
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
name: Build
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
gradlevalidation:
name: "Validate Gradle Wrapper"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gradle/actions/wrapper-validation@v4
validateSampleGradle:
name: Validate gradle samples
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Build and verify Gradle sample projects
run: |
./gradlew publishToMavenLocal
cd examples/gradle
for x in $(find . -maxdepth 1 -type d -not -name '.' -print); do
(cd $x && ./gradlew -i create-rock)
done
validateSampleMaven:
name: Validate maven samples
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Build and verify Maven sample projects
run: |
mvn install -B
cd examples/maven
for x in $(find . -maxdepth 1 -type d -not -name '.' -print); do
(cd $x && mvn package -B)
done
build-maven:
name: Build Maven
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Apache Maven Central
uses: actions/setup-java@v4
with: # running setup-java again overwrites the settings.xml
distribution: 'temurin'
java-version: '8'
- name: Setup LXD
uses: canonical/setup-lxd@main
with:
channel: 5.21/candidate
- name: Setup rockcraft
run: |
rm -rf /home/runner/.local/state/rockcraft/log/*
sudo snap remove rockcraft || true
sudo snap install rockcraft --classic
- name: Build and verify maven project
run: |
mvn -B install invoker:install invoker:run
build-gradle:
name: Build Gradle
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
run: |
sudo apt-get install -y openjdk-8-jdk-headless
- name: Setup LXD
uses: canonical/setup-lxd@main
with:
channel: 5.21/candidate
- name: Setup rockcraft
run: |
sudo snap install rockcraft --classic
- name: Build and verify gradle project
run: |
./gradlew clean build -i
- name: Publish Snapshots
if: github.ref == 'refs/heads/master'
run: |
# Find project version
ver=$(./gradlew properties -q | grep "version:" | awk '{print $2}')
# deploy if snapshot found
if [[ $ver == *"SNAPSHOT"* ]]
then
sudo snap install rockcraft --classic
lxd init --auto
./gradlew publish
fi
shell: bash