-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit f6c305c
Showing
19 changed files
with
1,380 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,77 @@ | ||
--- | ||
name: Measure coverage | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: [main] | ||
|
||
env: | ||
COVERAGE_THRESHOLD: 0.8 | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: write | ||
|
||
jobs: | ||
test: | ||
name: Coverage with JaCoCo | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: temurin | ||
cache: maven | ||
|
||
- name: Evaluate coverage | ||
run: mvn -B verify | ||
|
||
- name: Create filtered JaCoCo CSV that contains only GT4500 results | ||
run: > | ||
> jacoco-gt4500.csv awk | ||
'NR==1{print;next}/GT4500/{print}' | ||
target/site/jacoco/jacoco.csv | ||
- name: Generate JaCoCo badges | ||
id: jacoco | ||
uses: cicirello/jacoco-badge-generator@v2 | ||
with: | ||
jacoco-csv-file: jacoco-gt4500.csv | ||
generate-coverage-badge: false | ||
generate-branches-badge: false | ||
workflow-summary-heading: JaCoCo Test Coverage Summary (GT4500) | ||
|
||
- name: Log coverage metrics | ||
run: | | ||
echo "GT4500 instruction coverage = ${{ steps.jacoco.outputs.coverage }}" | ||
echo "GT4500 branch coverage = ${{ steps.jacoco.outputs.branches }}" | ||
- name: Add PR comment with coverage metrics | ||
uses: mshick/add-pr-comment@v2 | ||
with: | ||
message: | | ||
### JaCoCo Coverage Report (GT4500) | ||
| Coverage Metric | Value | Threshold (Minimum) | | | ||
| --- | --- | --- | --- | | ||
| 👉 Instruction Coverage | ${{ steps.jacoco.outputs.coverage }} | ${{ env.COVERAGE_THRESHOLD }} | ${{ steps.jacoco.outputs.coverage < env.COVERAGE_THRESHOLD && '❌' || '✅' }} | | ||
| 🌳 Decision/Branch Coverage | ${{ steps.jacoco.outputs.branches }} | ${{ env.COVERAGE_THRESHOLD }} | ${{ steps.jacoco.outputs.branches < env.COVERAGE_THRESHOLD && '❌' || '✅' }} | | ||
allow-repeats: true | ||
|
||
- name: Upload coverage report | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: jacoco-report | ||
path: target/site/jacoco/ | ||
|
||
- name: Fail job unless requirements are met | ||
if: ${{ steps.jacoco.outputs.coverage < env.COVERAGE_THRESHOLD || steps.jacoco.outputs.branches < env.COVERAGE_THRESHOLD }} | ||
uses: actions/github-script@v7 | ||
with: | ||
script: core.setFailed('Coverage metrics do not meet requirements') | ||
|
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
name: Java CI with Maven | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
build: | ||
name: Build with Maven | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: temurin | ||
cache: maven | ||
- name: Build with Maven | ||
run: mvn -B package --file pom.xml |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
*.class | ||
|
||
# Mobile Tools for Java (J2ME) | ||
.mtj.tmp/ | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
*.ear | ||
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* | ||
|
||
# ignore target from Maven | ||
target/ | ||
|
||
# IntelliJ folder | ||
.idea/ | ||
|
||
# Visual Studio Code files | ||
*.classpath | ||
*.project | ||
.settings/ | ||
.vscode/ |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.3/apache-maven-3.9.3-bin.zip | ||
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2017 Budapest University of Technology and Economics | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# SE Spaceship | ||
|
||
This is a sample application for the [Software Engineering](http://www.mit.bme.hu/oktatas/targyak/vimiab04) course at BME MIT. | ||
|
||
The application is simplified and deliberately contains bugs. | ||
|
||
## Getting started | ||
|
||
- The project is implemented in Java 11. | ||
- The project can be built using [Maven](https://maven.apache.org/). | ||
- [JUnit](https://junit.org/junit5/) is used for tests, and [Mockito](https://site.mockito.org/) for isolating dependencies. | ||
|
||
Clone the repository and execute Maven to build the application: | ||
|
||
``` | ||
mvn compile | ||
``` | ||
|
||
To compile and run tests also execute: | ||
|
||
``` | ||
mvn test | ||
``` | ||
|
||
(That will be enough to know for the current exercises. If you are more interested, see [this](https://github.com/ftsrg-edu/swsv-labs/wiki/0b-Build-tools) short guide about Maven.) | ||
|
||
As this is a really simple project, you can use the command-line build tools or a light-weight IDE like [Visual Studio Code](https://code.visualstudio.com/). | ||
|
||
## Overview | ||
|
||
The project represents an alpha version of a spaceship. | ||
|
||
- The ship (`SpaceShip` interface) can fire one or more lasers or torpedos. | ||
- We have only one spaceship as of now (`GT4500`). | ||
- Currently two firing modes (`FiringMode`) are supported: firing only one or all instances of a given weapon type. | ||
- Lasers are not yet implemented, but the code for torpedo stores are ready (`TorpedoStore`). | ||
- For the GT4500 ship the rules for firing torpedoes can be found in the Javadoc comment of method `fireTorpedos`. They are already partially implemented. | ||
- There are currently two tests (`GT4500Test`), but be aware that they are not proper unit tests, as they do not isolate the dependencies of the tested class. | ||
|
||
The code can be built, but due to missing features one of the tests fails. The first exercise will be to fix this. |
Oops, something went wrong.