-
Notifications
You must be signed in to change notification settings - Fork 10
150 lines (129 loc) · 5.89 KB
/
maven.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Java CI with Maven
on: [push, pull_request]
jobs:
matrix_prep:
# Using a separate job and agent so as to be able to use tools like 'sed' and 'jq'
runs-on: ubuntu-22.04
# Defining outputs of a job allows for easier consumption and use
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
# Checking out code as the set-matrix step utilizes a file named matrix_includes.json
- name: Check out code
uses: actions/[email protected]
# This step is explained more in a following section
- id: set-matrix
run: |
matrix=$(jq . .github/workflows/matrix_includes.json)
echo "matrix={\"include\":$(echo $matrix)}\"" >> $GITHUB_OUTPUT
build:
needs: matrix_prep
runs-on: ubuntu-22.04
strategy:
# We need to convert the json string output into an object that the GitHub Workflow expects.
# Thankfully, the json-schema for Workflows allows 'matrix' to be set to an expression.
matrix: ${{fromJson(needs.matrix_prep.outputs.matrix)}}
steps:
- name: Environment
run: |
echo GITHUB_WORKSPACE $GITHUB_WORKSPACE
echo GITHUB_REF $GITHUB_REF
echo GITHUB_SHA $GITHUB_SHA
echo GITHUB_EVENT_NAME $GITHUB_EVENT_NAME
echo JAVA ${{ matrix.java }}
echo PROFILE ${{ matrix.profile }}
echo TYCHO ${{ matrix.tycho }}
- name: Check out code
uses: actions/[email protected]
- name: Check if release is needed
id: release_check
env:
PROFILE: ${{ matrix.profile }}
run: |
if [[ "$PROFILE" == *"updatesite"* && "$(git tag --points-at HEAD)" != "" ]]; then export IS_RELEASE=true; fi
echo "IS_RELEASE=${IS_RELEASE}" >> $GITHUB_OUTPUT
- name: Set up JDK ${{ matrix.java }}
uses: actions/[email protected]
with:
distribution: 'adopt'
java-version: ${{ matrix.java }}
- uses: actions/[email protected]
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ matrix.tycho }}-${{ hashFiles('**/pom.xml', '**/*.product') }}
restore-keys: |
${{ runner.os }}-maven-${{ matrix.tycho }}-${{ hashFiles('**/pom.xml', '**/*.product') }}
- name: Install metacity and xvfb
uses: awalsh128/[email protected]
with:
packages: xvfb metacity
version: cache-apt-pkgs-${{ matrix.profile }}
- name: Build with Maven (${{ matrix.profile }})
id: maven_build
env:
MAVEN_OPTS: ${{ matrix.mavenOpt }}
run: |
/usr/bin/Xvfb :99 -ac -screen 0 1440x900x16&
ps auxwww | grep Xvfb
export DISPLAY=:99
echo DISPLAY $DISPLAY
mvn clean verify -fae -P${{ matrix.profile }} "-Dtycho=${{ matrix.tycho }}" -Dmaven.wagon.provider.http=httpclient -Dmaven.artifact.threads=12 -Dhttp.tcp.nodelay=false
- name: Prepare deploy local directory
id: prepare_deploy
if: ${{ steps.release_check.outputs.IS_RELEASE }}
run: |
export TAG_OR_BRANCH="$(echo $GITHUB_REF | cut -d"/" -f3)/nightly"
if [[ "$(echo $GITHUB_REF | cut -d"/" -f2)" != "heads" ]]; then export TAG_OR_BRANCH="$(echo $GITHUB_REF | cut -d"/" -f3)"; fi
chmod a+x ./scripts/prepare-deploy-local-dir.sh
./scripts/prepare-deploy-local-dir.sh $GITHUB_WORKSPACE/$TAG_OR_BRANCH
echo "TAG_OR_BRANCH=${TAG_OR_BRANCH}" >> $GITHUB_OUTPUT
- name: Create Release ${{ github.ref }}
id: create_release
if: ${{ steps.release_check.outputs.IS_RELEASE }}
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload_release_asset
if: ${{ steps.release_check.outputs.IS_RELEASE }}
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.prepare_deploy.outputs.TAG_OR_BRANCH }}/repository/org.eclipse.python4capella.update.zip
asset_name: org.eclipse.python4capella.update.zip
asset_content_type: application/zip
# For PyDev 8.2.0
- name: Build with Maven for PyDev 8.2.0 (${{ matrix.profile }})
id: maven_build_PyDev8_2_0
if: ${{ steps.release_check.outputs.IS_RELEASE }}
run: |
mvn clean verify -fae -P${{ matrix.profile }}-PyDev8.2.0 "-Dtycho=${{ matrix.tycho }}" -Dmaven.wagon.provider.http=httpclient -Dmaven.artifact.threads=12 -Dhttp.tcp.nodelay=false
- name: Prepare deploy local directory for PyDev 8.2.0
id: prepare_deploy_PyDev8_2_0
if: ${{ steps.release_check.outputs.IS_RELEASE }}
run: |
export TAG_OR_BRANCH="$(echo $GITHUB_REF | cut -d"/" -f3)/nightly"
if [[ "$(echo $GITHUB_REF | cut -d"/" -f2)" != "heads" ]]; then export TAG_OR_BRANCH="$(echo $GITHUB_REF | cut -d"/" -f3)"; fi
chmod a+x ./scripts/prepare-deploy-local-dir.sh
./scripts/prepare-deploy-local-dir.sh $GITHUB_WORKSPACE/$TAG_OR_BRANCH
echo "TAG_OR_BRANCH=${TAG_OR_BRANCH}" >> $GITHUB_OUTPUT
- name: Upload Release Asset for PyDev 8.2.0
id: upload_release_asset_PyDev8_2_0
if: ${{ steps.release_check.outputs.IS_RELEASE }}
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.prepare_deploy_PyDev8_2_0.outputs.TAG_OR_BRANCH }}/repository/org.eclipse.python4capella.update.zip
asset_name: org.eclipse.python4capella.update-Capella-1.4.zip
asset_content_type: application/zip