-
Notifications
You must be signed in to change notification settings - Fork 3
96 lines (94 loc) · 3.23 KB
/
examples-java-push.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
name: Build `examples/java` pushes
on:
push:
paths:
- "examples/java/**"
- ".github/workflows/examples-java-push.yml"
- "schemas/**"
permissions:
contents: read
jobs:
test:
defaults:
run:
working-directory: examples/java
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@1df8dbefe2a8cbc99770194893dd902763bee34b
with:
java-version: '17'
distribution: 'temurin'
- name: Cache Gradle packages
uses: actions/cache@58c146cc91c5b9e778e71775dfe9bf1442ad9a12
with:
path: ~/.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-m2
- name: Cache SonarCloud packages
uses: actions/cache@58c146cc91c5b9e778e71775dfe9bf1442ad9a12
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Build
run: ./gradlew clean build
- name: Perform Static Analysis
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew sonarqube
- name: Upload Artifacts
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce
with:
name: examples-java-libs
path: '**/build/libs/*'
retention-days: 5
- name: Upload Test reports
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce
with:
name: examples-java-reports
path: '**/build/reports/*'
retention-days: 5
- name: Upload spring-boot manifest
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce
with:
name: spring-boot-manifest
path: 'examples/java/spring-boot/manifest.yml'
retention-days: 5
deploy:
environment: sandbox
runs-on: ubuntu-18.04
needs: test
env:
CF_API: "https://api.london.cloud.service.gov.uk"
CF_ORG: "cabinet-office-cddo-dsa-apis"
CF_SPACE: "sandbox"
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
with:
name: examples-java-libs
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
with:
name: spring-boot-manifest
- name: Install the CF CLI
run: |
wget -q -O cf.tar.gz "https://packages.cloudfoundry.org/stable?release=linux64-binary&version=7.4.0&source=github-rel"
sudo tar xzf cf.tar.gz --wildcards --directory /usr/local/bin/ "cf*"
- name: Authenticate
env:
CF_USERNAME: ${{ secrets.CF_USER }}
CF_PASSWORD: ${{ secrets.CF_PASSWORD }}
run: |
echo "Logging into $CF_ORG/$CF_SPACE..."
cf api "${CF_API}"
cf auth
cf target -o "${CF_ORG}" -s "${CF_SPACE}"
- name: Deploy to PaaS
run: |
cf push -f manifest.yml -p examples/java/spring-boot/build/libs/federated-api-model.jar --strategy rolling
cf logout