Skip to content

Commit 6d68e95

Browse files
committed
Switching build from Jenkins to GitHub actions
1 parent 7f66fc0 commit 6d68e95

File tree

3 files changed

+215
-62
lines changed

3 files changed

+215
-62
lines changed

.github/workflows/ci.yaml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
# Prevent concurrent builds of the same branch - a new push will cancel the
9+
# running workflow and start another
10+
concurrency:
11+
group: ${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v3
21+
with:
22+
fetch-depth: "1"
23+
24+
- name: Update submodules
25+
run: |
26+
if [ -f '.gitmodules' ]; then
27+
git submodule update --init --recursive --depth=1
28+
else
29+
echo "Repository does not have submodules - nothing to do"
30+
fi
31+
32+
- name: Set up JDK
33+
uses: actions/setup-java@v3
34+
with:
35+
java-version: '8'
36+
distribution: 'zulu'
37+
cache: maven
38+
39+
# Override http://repo.gate.ac.uk to use https:// instead
40+
- name: Configure Maven settings
41+
uses: whelk-io/maven-settings-xml-action@v20
42+
with:
43+
mirrors: >
44+
[
45+
{
46+
"id": "gate.ac.uk-https",
47+
"name": "GATE repo (secure)",
48+
"mirrorOf": "gate.ac.uk",
49+
"url": "https://repo.gate.ac.uk/content/groups/public/"
50+
}
51+
]
52+
repositories: >
53+
[
54+
{
55+
"id": "central",
56+
"name": "Maven Central",
57+
"url": "https://repo1.maven.org/maven2",
58+
"releases": {
59+
"enabled": "true"
60+
},
61+
"snapshots": {
62+
"enabled": "false"
63+
}
64+
}
65+
]
66+
plugin_repositories: >
67+
[
68+
{
69+
"id": "central",
70+
"name": "Maven Central",
71+
"url": "https://repo1.maven.org/maven2",
72+
"releases": {
73+
"enabled": "true"
74+
},
75+
"snapshots": {
76+
"enabled": "false"
77+
}
78+
}
79+
]
80+
servers: >
81+
[
82+
{
83+
"id": "gate.snapshots",
84+
"username": "${{ secrets.GATE_REPO_USERNAME }}",
85+
"password": "${{ secrets.GATE_REPO_PASSWORD }}"
86+
}
87+
]
88+
89+
- name: Set up python venv
90+
run: |
91+
python3 -mvenv tmpenv
92+
echo "$PWD/tmpenv/bin" >> $GITHUB_PATH
93+
tmpenv/bin/pip install -r python-requirements.txt
94+
95+
- name: Build with Maven
96+
run: mvn --batch-mode -e clean install
97+
98+
- name: Publish Test Report
99+
uses: scacap/action-surefire-report@v1
100+
with:
101+
fail_if_no_tests: false
102+
103+
- name: Build site
104+
run: mvn --batch-mode -e -DskipTests site
105+
106+
# Only do the deploy to repo.gate.ac.uk if we're in the main GateNLP
107+
# repo, not a fork
108+
- name: Deploy to repo.gate.ac.uk
109+
if: github.ref == 'refs/heads/main' && github.repository_owner == 'GateNLP'
110+
run: mvn --batch-mode -e -Dmaven.test.skip=true source:jar javadoc:jar deploy
111+
112+
# We want to avoid cacheing -SNAPSHOT dependencies from our local maven
113+
# cache, to ensure that we always go out and check for them again at the
114+
# next build in case they have changed.
115+
- name: Delete snapshots from m2 repository
116+
if: always()
117+
run: |
118+
find ~/.m2/repository -name \*-SNAPSHOT -type d -exec rm -rf {} \+ || :

.github/workflows/pull-request.yaml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout PR
14+
uses: actions/checkout@v3
15+
16+
- name: Update submodules if necessary
17+
run: |
18+
if [ -f '.gitmodules' ]; then
19+
git submodule update --init --recursive --depth=1
20+
else
21+
echo "Repository does not have submodules - nothing to do"
22+
fi
23+
24+
- name: Set up JDK
25+
uses: actions/setup-java@v3
26+
with:
27+
java-version: '8'
28+
distribution: 'zulu'
29+
cache: maven
30+
31+
# Override http://repo.gate.ac.uk to use https:// instead
32+
- name: Configure Maven settings
33+
uses: whelk-io/maven-settings-xml-action@v20
34+
with:
35+
mirrors: >
36+
[
37+
{
38+
"id": "gate.ac.uk-https",
39+
"name": "GATE repo (secure)",
40+
"mirrorOf": "gate.ac.uk",
41+
"url": "https://repo.gate.ac.uk/content/groups/public/"
42+
}
43+
]
44+
repositories: >
45+
[
46+
{
47+
"id": "central",
48+
"name": "Maven Central",
49+
"url": "https://repo1.maven.org/maven2",
50+
"releases": {
51+
"enabled": "true"
52+
},
53+
"snapshots": {
54+
"enabled": "false"
55+
}
56+
}
57+
]
58+
plugin_repositories: >
59+
[
60+
{
61+
"id": "central",
62+
"name": "Maven Central",
63+
"url": "https://repo1.maven.org/maven2",
64+
"releases": {
65+
"enabled": "true"
66+
},
67+
"snapshots": {
68+
"enabled": "false"
69+
}
70+
}
71+
]
72+
73+
- name: Set up python venv
74+
run: |
75+
python3 -mvenv tmpenv
76+
echo "$PWD/tmpenv/bin" >> $GITHUB_PATH
77+
tmpenv/bin/pip install -r python-requirements.txt
78+
79+
- name: Build with Maven
80+
run: mvn --batch-mode -e clean install
81+
82+
- name: Publish Test Report
83+
uses: scacap/action-surefire-report@v1
84+
if: success() || failure()
85+
with:
86+
fail_if_no_tests: false
87+
88+
- name: Build site
89+
run: mvn --batch-mode -e -DskipTests site
90+
91+
# We want to avoid cacheing -SNAPSHOT dependencies from our local maven
92+
# cache, to ensure that we always go out and check for them again at the
93+
# next build in case they have changed.
94+
- name: Delete snapshots from m2 repository
95+
if: always()
96+
run: |
97+
find ~/.m2/repository -name \*-SNAPSHOT -type d -exec rm -rf {} \+ || :

Jenkinsfile

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)