Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
rachaelbanks committed Nov 20, 2024
2 parents a11ee1b + 7859a94 commit 048b5a4
Show file tree
Hide file tree
Showing 15 changed files with 1,555 additions and 81 deletions.
72 changes: 54 additions & 18 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,68 @@
# GitHub Actions workflow for building and running a Java application
# Triggers on push to the repository
name: A workflow for my Hello World App
on:
push: # Runs the workflow when changes are pushed

push:
branches:
- develop
jobs:
build: # Job for building application
name: Hello world action
UnitTests:
name: Unit Tests
runs-on: ubuntu-20.04

steps:
- name: Checkout # Check out the code
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive # Includes submodules

# Install JDK 11
submodules: recursive
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'

- name: Unit Tests
run: mvn -Dtest=com.napier.sem.AppTest test

- name: Build with Maven # Build the application
run: mvn package -DskipTests # Compiles and packages the application
run: mvn -Dtest='com.napier.sem.AppTest,com.napier.sem.CityTest,com.napier.sem.CountryLanguageTest,com.napier.sem.CountryTest,com.napier.sem.DatabaseTest' test

- name: Run docker compose # Run Docker Compose
run: docker compose up --abort-on-container-exit # Starts services and aborts on container exit
IntegrationTests:
name: Integration Tests
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Integration Tests and CodeCov
run: |
docker build -t database ./db
docker run --name world -dp 33060:3306 database
mvn -Dtest=com.napier.sem.AppIntegrationTest test
docker stop world
docker rm world
docker image rm database
- name: CodeCov
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }} # now required for public repos too
directory: ./target/site/jacoco
flags: Integration Tests # optional
verbose: true # optional (default = false)
slug: NikitaEdin/SET08103_2024-5
build:
name: Build and Start Using docker compose
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Package and Run docker compose
run: |
mvn package -DskipTests
docker compose up --abort-on-container-exit
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Use the latest OpenJDK image
FROM openjdk:latest
# Copy the packaged JAR file from local machine to the container
COPY ./target/seMethods-0.2.0.1-jar-with-dependencies.jar /tmp
COPY ./target/seMethods-0.3.0.0.jar /tmp
# Makes tmp directory the working directory
WORKDIR /tmp
# Command to run the jarfile that was copied earlier
ENTRYPOINT ["java", "-jar", "seMethods-0.2.0.1-jar-with-dependencies.jar"]
ENTRYPOINT ["java", "-jar", "seMethods-0.3.0.0.jar", "db:3306", "10000"]
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Napier University Team project for SET08103 module 2024/2025

* Release ![GitHub Release](https://img.shields.io/github/v/release/nikitaedin/SET09103_2024-5?include_prereleases)

* Codecov Coverage [![codecov](https://codecov.io/gh/NikitaEdin/SET08103_2024-5/branch/develop/graph/badge.svg?token=380HR1UHWD)](https://codecov.io/gh/NikitaEdin/SET08103_2024-5)

## Team Members
- **Stephen Banks**
- **Rachael Banks**
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ services:
app:
build: .

# db is db folder
# db is is db folder
db:
build: db/.
command: --default-authentication-plugin=mysql_native_password
restart: always
ports:
- "3306:3306"
- "33060:3306"
23 changes: 22 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.napier.sem</groupId>
<artifactId>seMethods</artifactId>
<version>0.2.0.1</version>
<version>0.3.0.0</version>

<!-- Application Dependencies -->
<dependencies>
Expand Down Expand Up @@ -61,6 +61,7 @@
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
Expand Down Expand Up @@ -90,6 +91,26 @@
</dependency>
</dependencies>
</plugin>

<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.2</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
Loading

0 comments on commit 048b5a4

Please sign in to comment.