-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
1,555 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.