-
Notifications
You must be signed in to change notification settings - Fork 43
86 lines (72 loc) · 2.84 KB
/
ci-pr.yaml
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
name: Deployment and Subscription Test
on:
pull_request_target:
branches:
- main # Run the workflow for PRs targeting the "main" branch
jobs:
test:
runs-on: ubuntu-latest
steps:
# Step 1: Check out the code from the PR branch
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
# Step 2: Set up Node.js
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20.x'
# Step 3: Install MBT and dependencies
- name: Install MBT and dependencies
run: |
npm install -g mbt
cd code
npm install --production
# Step 4: Install CF Cli
- name: Install CF Cli
run: |
wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | gpg --dearmor -o /usr/share/keyrings/cli.cloudfoundry.org.gpg
echo "deb [trusted=yes] https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list
sudo apt-get update
sudo apt-get install cf8-cli
# Step 5: Download and Install SAP BTP CLI
- name: Install BTP CLI
run: |
dpkg --print-architecture
curl -LJO https://tools.hana.ondemand.com/additional/btp-cli-linux-amd64-latest.tar.gz --cookie "eula_3_2_agreed=tools.hana.ondemand.com/developer-license-3_2.txt"
tar -xzf btp-cli-linux-amd64-latest.tar.gz
ls -a
mv linux-amd64/btp /usr/local/bin
chmod +x /usr/local/bin/btp
# Step 6: Install Multiapps Plugin
- name: Install Multiapps Plugin
run: |
cf add-plugin-repo CF-Community https://plugins.cloudfoundry.org
cf install-plugin multiapps -f
# Step 7: Login to CF
- name: Log in to Cloud Foundry
run: |
cf login -u ${{ secrets.CF_USERNAME }} -p ${{ secrets.CF_PASSWORD }} -o ${{ secrets.CF_ORG }} -s ${{ secrets.CF_SPACE }} -a ${{ secrets.CF_API }}
# Step 8: Build the project
- name: Build MTA Archive
run: |
cd deploy/cf
sed -i 's|{{BROKER_USER}}|'"${{ secrets.BROKER_USER }}"'|g' ./mtaext/ci.mtaext
sed -i 's|{{BROKER_PASSWORD}}|'"${{ secrets.BROKER_PASSWORD }}"'|g' ./mtaext/ci.mtaext
mbt build -e ./mtaext/ci.mtaext
# Step 9: Verify MTA Archive built successfully
- name: Deploy to CF
run: |
cf deploy ./deploy/cf/mta_archives/susaas_0.0.1.mtar -f
# Step 10: Verify MTA Archive built successfully
- name: Run Subscription Test Script
run: |
chmod +x ./code/test/subscription-test.sh
./code/test/subscription-test.sh
env:
BTP_USERNAME: ${{ secrets.CF_USERNAME }}
BTP_PASSWORD: ${{ secrets.CF_PASSWORD }}
BTP_SUBDOMAIN: ${{ secrets.BTP_SUBDOMAIN }}
CF_SPACE: ${{ secrets.CF_SPACE }}
CF_ORG: ${{ secrets.CF_ORG}}