Skip to content

Commit 7df9a56

Browse files
authored
Merge pull request #124 from mde-optimiser/fix/develop-merge-workflow
Improve development branch CI/CD
2 parents f8f3f2d + cafc62b commit 7df9a56

File tree

5 files changed

+55
-99
lines changed

5 files changed

+55
-99
lines changed

.github/workflows/ci-cd.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Build and potentially deploy code on PRs merging into the develop or master branch
2+
name: CI/CD
3+
4+
on:
5+
pull_request:
6+
branches: [ master, develop ]
7+
types: [assigned, opened, synchronize, reopened, closed ] # Run when there are updates to the code in the PR or when the PR is closed and merged
8+
9+
jobs:
10+
build: # Only build when not merging
11+
if: ${{ !github.event.pull_request.merged }}
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Set up JDK 11
17+
uses: actions/setup-java@v2
18+
with:
19+
java-version: '11'
20+
distribution: 'adopt'
21+
- name: Build with Ant
22+
uses: GabrielBB/xvfb-action@v1
23+
with:
24+
working-directory: ./build/ant
25+
run: |
26+
ant -noinput -buildfile build.xml
27+
28+
deploy:
29+
# Build and deploy when merging
30+
# Needs to be in a full job because file workspace isn't shared between jobs, so cannot easily refactor
31+
if: ${{ github.event.pull_request.merged }}
32+
runs-on: ubuntu-latest
33+
34+
steps:
35+
- uses: actions/checkout@v2
36+
- name: Set up JDK 11
37+
uses: actions/setup-java@v2
38+
with:
39+
java-version: '11'
40+
distribution: 'adopt'
41+
- name: Build with Ant
42+
uses: GabrielBB/xvfb-action@v1
43+
with:
44+
working-directory: ./build/ant
45+
run: |
46+
ant -noinput -buildfile build.xml
47+
- name: Deploy files
48+
shell: bash
49+
run: |
50+
/usr/bin/chmod +x ./build/publish-artifacts.sh
51+
/usr/bin/bash ./build/publish-artifacts.sh
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/commit.yml

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

.github/workflows/dev_merge.yml

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

.github/workflows/master_merge.yml

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

build/maven/build.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
<target name="maven.build" unless="isWindows">
2222
<exec dir="." executable="mvn" failifexecutionfails="true" failonerror="true">
2323
<arg value="clean" />
24-
<arg value="deploy" />
24+
<!-- TODO: Consider putting the next into a separate target and use something like compile instead to avoid packaging everything on every commit to a PR. -->
25+
<arg value="deploy" />
2526
<arg value="--quiet" />
2627
</exec>
2728
</target>

0 commit comments

Comments
 (0)