Skip to content

Commit

Permalink
have tests in one workflow with separate jobs and don't push a releas…
Browse files Browse the repository at this point in the history
…e through a pull request
  • Loading branch information
ismisepaul authored and markdenihan committed Mar 16, 2022
1 parent a1b8b82 commit 8f8f9d5
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 126 deletions.
23 changes: 0 additions & 23 deletions .github/workflows/build.yml

This file was deleted.

39 changes: 0 additions & 39 deletions .github/workflows/intergration-tests.yml

This file was deleted.

29 changes: 0 additions & 29 deletions .github/workflows/linter.yml

This file was deleted.

13 changes: 12 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,22 @@ on:
- 'v*'
paths-ignore:
- '**.md'
- '.github/ISSUE_TEMPLATE'
- '.gitignore'
- 'provisioning'
- '.sonarcloud.properties'
- 'LICENSE'
- 'Vagrantfile'
push:
branches: [master, dev]
paths-ignore:
- '**.md'
pull_request:
- '.github/ISSUE_TEMPLATE'
- '.gitignore'
- 'provisioning'
- '.sonarcloud.properties'
- 'LICENSE'
- 'Vagrantfile'

jobs:
release:
Expand Down
85 changes: 85 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Java Build and Test
on:
push:
branches: [master, dev]
paths-ignore:
- '**.md'
pull_request:

jobs:
build:
name: Build Security Shepherd
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build Maven with Docker Profile
run: mvn clean install -Pdocker -DskipTests -B
- name: Docker Compose Build
run: docker-compose build
unit-tests:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: core
ports:
- '8888:3306'
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Start MYSQL Server
run: sudo /etc/init.d/mysql start
- name: Modify MySQL Connection Variables
run: |
sed -i "s/'@'localhost'/'@'%'/g" ${GITHUB_WORKSPACE}/src/main/resources/database/moduleSchemas.sql
sed -i 's/TEST_MYSQL_PORT=3306/TEST_MYSQL_PORT=8888/g' ${GITHUB_WORKSPACE}/.env
- name: Run Unit Tests
run: mvn test -B -e -X
integration-tests:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: core
ports:
- '8888:3306'
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Start MYSQL Server
run: sudo /etc/init.d/mysql start
- name: Modify MySQL Connection Variables
run: |
sed -i "s/'@'localhost'/'@'%'/g" ${GITHUB_WORKSPACE}/src/main/resources/database/moduleSchemas.sql
sed -i 's/TEST_MYSQL_PORT=3306/TEST_MYSQL_PORT=8888/g' ${GITHUB_WORKSPACE}/.env
- name: Prepare Intergration Tests
run: |
sudo apt-get -y install libargon2-0
mvn -Pdocker validate
- name: Run Intergration Tests
run: |
mvn verify -DskipUTs=true -DmongoDocker -B
lint-java:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2 # v2 minimum required
- uses: axel-op/googlejavaformat-action@v3
with:
args: "--set-exit-if-changed"
34 changes: 0 additions & 34 deletions .github/workflows/unit-tests.yml

This file was deleted.

0 comments on commit 8f8f9d5

Please sign in to comment.