-
Notifications
You must be signed in to change notification settings - Fork 10
133 lines (118 loc) · 4.63 KB
/
reusable_e2e.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
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
130
131
132
133
# This is a reusable workflow that can be run based on `mirrord_release_branch` boolean input
# in the `mirrord` or `mirrord-intellij` repository and hence is maintained in a single place.
# The difference in the workflow when `mirrord_release_branch` is set is as follows:
# - we checkout into the latest released tag of `mirrord-intellij` from the perspective of binary
# that has to be released on `mirrord` side. if not set, we checkout into the current branch.
# - we rely on downloading the mirrord binary from `mirrord-artifacts` using `actions/download-artifact`
# and adding it to the path. if not set, the latest version is downloaded.
name: reusable_e2e
on:
workflow_call:
inputs:
mirrord_release_branch:
required: false
type: boolean
default: false
jobs:
intellij-e2e:
runs-on: ubuntu-24.04
env:
CI_BUILD_PLUGIN: "true"
steps:
- name: Remove unnecessary files
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: checkout repository
if: ${{ !inputs.mirrord_release_branch }}
uses: actions/checkout@v4
# mirrord_release_branch boolean when set, means we are on a release branch
# and hence we need to checkout into the last released tag of mirrord-intellij
- name: checkout into mirrord-intellij if mirrord_release_branch
if: ${{ inputs.mirrord_release_branch }}
uses: actions/checkout@v4
with:
repository: "metalbear-co/mirrord-intellij"
- name: checkout into the last released tag if mirrord_release_branch
if: ${{ inputs.mirrord_release_branch }}
run: |
git fetch --all --tags
git checkout tags/$(grep 'pluginVersion =' gradle.properties | cut -d '=' -f 2 | xargs)
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
- uses: actions/setup-python@v5
with:
python-version: 3.11
- uses: abatilo/actions-poetry@v2
# we are on a release branch, so we need to download the mirrord binary from
# mirrord-artifacts and add it to the path
- name: download mirrord binary
if: ${{ inputs.mirrord_release_branch }}
uses: actions/download-artifact@v4
with:
name: mirrord-artifacts
- name: add downloaded mirrord to path
if: ${{ inputs.mirrord_release_branch }}
run: |
chmod u+x mirrord
echo "${GITHUB_WORKSPACE}" >> $GITHUB_PATH
- name: get the latest mirrord binary
if: ${{ !inputs.mirrord_release_branch }}
run: |
curl -fsSL https://raw.githubusercontent.com/metalbear-co/mirrord/main/scripts/install.sh | bash
- name: Start minikube
uses: medyagh/setup-minikube@master
with:
container-runtime: docker
- run: |
kubectl apply -f sample/kubernetes/app.yaml
echo "POD_TO_SELECT=$(kubectl get pods -o=name | head -n 1)" >> "$GITHUB_ENV"
kubectl wait --for=condition=ready --timeout=30s $(kubectl get pods -o=name | head -n 1)
KUBE_SERVICE=$(minikube service list --output=json | jq -r '.[] | select(.Name == "py-serv") | .URLs[0]')
echo "$KUBE_SERVICE"
echo "KUBE_SERVICE=$KUBE_SERVICE" >> "$GITHUB_ENV"
- name: download image
if: ${{ inputs.mirrord_release_branch }}
uses: actions/download-artifact@v4
with:
name: test
path: /tmp
- run: minikube image load /tmp/test.tar
if: ${{ inputs.mirrord_release_branch }}
- name: build plugin
run: |
./gradlew buildPlugin
- name: Run intellij e2e in headless state
uses: coactions/setup-xvfb@v1
if: ${{ inputs.mirrord_release_branch }}
env:
POD_TO_SELECT: ${{ env.POD_TO_SELECT }}
KUBE_SERVICE: ${{ env.KUBE_SERVICE }}
MIRRORD_AGENT_IMAGE: "test"
with:
run: |
./gradlew test
- name: Run intellij e2e in headless state
uses: coactions/setup-xvfb@v1
if: ${{ !inputs.mirrord_release_branch }}
env:
POD_TO_SELECT: ${{ env.POD_TO_SELECT }}
KUBE_SERVICE: ${{ env.KUBE_SERVICE }}
with:
run: |
./gradlew test
- name: Save the failure video
continue-on-error: true
if: ${{ always() }}
run: |
mv video build/reports
- name: Save fails report
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: mirrord-plugin-fail-report
path: |
build/reports