-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (122 loc) · 3.85 KB
/
test.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
125
126
127
128
129
name: 'Test Actions'
on:
push:
branches:
- develop
- renovate/**
defaults:
run:
shell: bash
jobs:
changes:
name: Detect file changes
runs-on: ubuntu-latest
# Set job outputs to values from filter step
outputs:
add-pr-url: ${{ steps.filter.outputs.add-pr-url }}
load-env: ${{ steps.filter.outputs.load-env }}
detect-pod: ${{ steps.filter.outputs.detect-pod }}
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJSON(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Check out the repo
uses: actions/checkout@v3
- name: Find file changes
uses: dorny/paths-filter@v2
id: filter
with:
base: ${{ github.event.before }}
filters: |
add-pr-url:
- 'actions/add-pr-url/**'
- '.github/workflows/test.yml'
load-env:
- 'actions/load-env/**'
- '.github/workflows/test.yml'
detect-pod:
- 'actions/detect-pod/**'
- '.github/workflows/test.yml'
test-add-pr-url:
name: Test add-pr-url
runs-on: ubuntu-latest
needs: [changes]
if: ${{ needs.changes.outputs.add-pr-url == 'true' }}
steps:
- name: Add url link to PR
uses: phase2/octane-actions/actions/add-pr-url@develop
with:
url: www.example.com
caption: Test Link
- name: Add second url link to PR
uses: phase2/octane-actions/actions/add-pr-url@develop
with:
url: www.google.com
caption: Second Test Link
fetch: true
test-load-env:
name: Test load-env
runs-on: ubuntu-latest
needs: [changes]
if: ${{ needs.changes.outputs.load-env == 'true' }}
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Load environment
uses: phase2/octane-actions/actions/load-env@develop
- name: Environment vars
run: env
- name: Validate results
run: |
result=0
echo "PROJECT_NAME: $PROJECT_NAME"
if [ "$PROJECT_NAME" != "octane-actions" ]; then
echo "ERROR loading .env file"
result=1
fi
echo "CI_URL: $CI_URL"
if [ "$CI_URL" != "devcloud.fayze2.com" ]; then
echo "ERROR setting CI_URL"
result=1
fi
echo "CI_BRANCH: $CI_BRANCH"
if [ "$CI_BRANCH" != "$GITHUB_REF_NAME" ]; then
echo "ERROR setting CI_BRANCH"
result=1
fi
if [[ ! -z $(which npm 2>/dev/null || echo "") ]]; then
npmConfig=$(npm config get prefix)
echo "npm config get prefix: $npmConfig"
if [ "$npmConfig" != "/home/runner/work/octane-actions/octane-actions/.config/npm/global" ]; then
echo "ERROR setting npm config"
result=1
fi
fi
exit $result
test-detect-pod:
name: Test detect-pod
runs-on: ubuntu-latest
needs: [changes]
if: ${{ needs.changes.outputs.detect-pod == 'true' }}
env:
# Check if Phase2 demo project has a pod for main branch.
GENERATOR_PROJECT_NAME: demo
GENERATOR_NAMESPACE: demo
POD_RELEASE_NAME: main
steps:
- name: Find Devcloud pod
uses: phase2/octane-actions/actions/detect-pod@develop
id: detect-pod
with:
kubeconfig: ${{ secrets.KUBE_CONFIG }}
release_name: ${{ env.POD_RELEASE_NAME }}
- name: Validate pod status
run: |
result=0
echo "Pod status: ${{ steps.detect-pod.outputs.pod-status }}"
if [ "${{ steps.detect-pod.outputs.pod-status }}" != "true" ]; then
echo "ERROR finding pod for namespace: $GENERATOR_NAMESPACE release: $POD_RELEASE_NAME"
result=1
fi
exit $result