Skip to content

Commit

Permalink
Move CI Start/Stop Server to Github Action
Browse files Browse the repository at this point in the history
  • Loading branch information
guusdk committed Mar 5, 2024
1 parent d02f7ee commit 707dcd1
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 33 deletions.
23 changes: 23 additions & 0 deletions .github/actions/ci-start-server/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: 'CI Start Server'
description: 'Start CI server from distribution'
inputs:
debug:
description: 'Enable debug mode. Prints commands, and preserves temp directories if used.'
required: false
default: 'false'
domain:
description: 'XMPP domain name of server.'
required: false
default: 'example.org'
ip:
description: 'Set a hosts file for the given IP and host (or for example.com if running locally)'
required: false

runs:
using: "composite"
steps:
- if: ${{ inputs.debug_mode == 'true' }}
run: ./startCIServer -d -l -i ${{ inputs.ip }} -h ${{ inputs.domain }}
- if: ${{ inputs.debug_mode != 'true' }}
run: ./startCIServer -l -i ${{ inputs.ip }} -h ${{ inputs.domain }}
shell: bash
File renamed without changes.
23 changes: 23 additions & 0 deletions .github/actions/ci-stop-server/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: 'CI Stop Server'
description: 'Stops CI server'
inputs:
debug:
description: 'Enable debug mode. Prints commands, and preserves temp directories if used.'
required: false
default: 'false'
domain:
description: 'XMPP domain name of server.'
required: false
default: 'example.org'
ip:
description: 'Set a hosts file for the given IP and host (or for example.com if running locally)'
required: false

runs:
using: "composite"
steps:
- if: ${{ inputs.debug_mode == 'true' }}
run: ./stopCIServer -d -l -i ${{ inputs.ip }} -h ${{ inputs.domain }}
- if: ${{ inputs.debug_mode != 'true' }}
run: ./stopCIServer -l -i ${{ inputs.ip }} -h ${{ inputs.domain }}
shell: bash
File renamed without changes.
39 changes: 6 additions & 33 deletions .github/workflows/continuous-integration-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,6 @@ jobs:
with:
name: distribution-java${{ matrix.java }}
path: distribution-artifact.tar
- name: Upload test files
if: ${{ matrix.distribution == 'zulu' }}
uses: actions/upload-artifact@v4
with:
name: test-files-java${{ matrix.java }}
path: |
startCIServer
stopCIServer
runConnectivityIntegrationTests
- name: Upload coverage report for 'xmppserver' module
if: ${{ matrix.distribution == 'zulu' && matrix.java == 11 && github.ref_name == 'main'}}
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -85,15 +76,9 @@ jobs:
path: .
- name: untar distribution # sharing artifacts that consist of many files can be slow. Share one file instead.
run: tar -xf distribution-artifact.tar
- name: Download test files from build job.
uses: actions/download-artifact@v4
with:
name: test-files-java11
- name: Fix file permissions
run: |
chmod +x distribution/target/distribution-base/bin/openfire.sh
chmod +x ./startCIServer
chmod +x ./stopCIServer
- name: Checkout aioxmpp devel/head
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -126,7 +111,7 @@ jobs:
EOL
- name: Start CI server from distribution
id: startCIServer
run: ./startCIServer -d -l -i 127.0.0.1
uses: ./.github/actions/ci-start-server
- name: Run aioxmpp tests
working-directory: ./aioxmpp
run: |
Expand All @@ -140,7 +125,7 @@ jobs:
path: aioxmpp/output
- name: Stop CI server
if: ${{ always() && steps.startCIServer.conclusion == 'success' }} # TODO figure out if this is correct. The intent is to have the server stopped if it was successfully started, even if the tests fail. Failing tests should still cause the job to fail.
run: ./stopCIServer -d -l -i 127.0.0.1
uses: ./.github/actions/ci-stop-server
- name: Expose openfire output
if: always()
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -178,10 +163,6 @@ jobs:
path: .
- name: untar distribution # sharing artifacts that consist of many files can be slow. Share one file instead.
run: tar -xf distribution-artifact.tar
- name: Download test files from build job.
uses: actions/download-artifact@v4
with:
name: test-files-java11
- name: Set up Java
uses: actions/setup-java@v4
with:
Expand All @@ -190,8 +171,6 @@ jobs:
- name: Fix file permissions
run: |
chmod +x distribution/target/distribution-base/bin/openfire.sh
chmod +x ./startCIServer
chmod +x ./stopCIServer
- name: Create connectivity tests
run: |
mkdir -p ./conntest/src/test/java
Expand Down Expand Up @@ -352,12 +331,12 @@ jobs:
popd
- name: Start CI server from distribution
id: startCIServer
run: ./startCIServer -d -l -i 127.0.0.1
uses: ./.github/actions/ci-start-server
- name: Build with Maven
run: mvn clean test --file ./conntest/pom.xml
- name: Stop CI server
if: ${{ always() && steps.startCIServer.conclusion == 'success' }} # TODO figure out if this is correct. The intent is to have the server stopped if it was successfully started, even if the tests fail. Failing tests should still cause the job to fail.
run: ./stopCIServer -d -l -i 127.0.0.1
uses: ./.github/actions/ci-stop-server
smack:

name: Execute Smack-based CI tests
Expand All @@ -374,10 +353,6 @@ jobs:
path: .
- name: untar distribution # sharing artifacts that consist of many files can be slow. Share one file instead.
run: tar -xf distribution-artifact.tar
- name: Download test files from build job.
uses: actions/download-artifact@v4
with:
name: test-files-java11
- name: Set up Java
uses: actions/setup-java@v4
with:
Expand All @@ -386,11 +361,9 @@ jobs:
- name: Fix file permissions
run: |
chmod +x distribution/target/distribution-base/bin/openfire.sh
chmod +x ./startCIServer
chmod +x ./stopCIServer
- name: Start CI server from distribution
id: startCIServer
run: ./startCIServer -d -l -i 127.0.0.1
uses: ./.github/actions/ci-start-server
- name: Run Smack tests against server
uses: guusdk/sint-action@main # TODO replace 'main' with a proper versioned tag, like 'v1'.
with:
Expand All @@ -400,7 +373,7 @@ jobs:
disabledTests: 'EntityCapsTest,SoftwareInfoIntegrationTest,XmppConnectionIntegrationTest,StreamManagementTest,WaitForClosingStreamElementTest,IoTControlIntegrationTest,ModularXmppClientToServerConnectionLowLevelIntegrationTest'
- name: Stop CI server
if: ${{ always() && steps.startCIServer.conclusion == 'success' }} # TODO figure out if this is correct. The intent is to have the server stopped if it was successfully started, even if the tests fail. Failing tests should still cause the job to fail.
run: ./stopCIServer -d -l -i 127.0.0.1
uses: ./.github/actions/ci-stop-server

should-do-database-upgrade-tests:
name: Check if database upgrade tests should be run
Expand Down

0 comments on commit 707dcd1

Please sign in to comment.