Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: CI

on:
pull_request:
branches: ["main", "master"]
push:
branches: ["main", "master"]

permissions:
contents: read

jobs:
backend:
name: Backend – Build & Test
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('backend/**/*.gradle*', 'backend/**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Make Gradle wrapper executable
run: chmod +x backend/gradlew

- name: Run Spotless check
working-directory: backend
run: ./gradlew spotlessCheck --no-daemon

- name: Build (with tests)
working-directory: backend
run: ./gradlew build --no-daemon

frontend:
name: Frontend – Lint & Build
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json

- name: Install dependencies
working-directory: frontend
run: npm ci

- name: Lint
working-directory: frontend
run: npm run lint

- name: Build
working-directory: frontend
run: npm run build
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ public ResponseEntity<String> hello() {
public ResponseEntity<Object> getResults(
@RequestParam String startinglink, @RequestParam String endinglink) {
try {
BFSResult result =
bfs.getPathWithStats(new PageNode(startinglink), new PageNode(endinglink));
BFSResult result = bfs.getPathWithStats(new PageNode(startinglink), new PageNode(endinglink));

if (result.getPath() == null) {
return new ResponseEntity<>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ public void getResultsReturnsPathWhenFound() throws Exception {
when(bfs.getPathWithStats(any(PageNode.class), any(PageNode.class)))
.thenReturn(
new BFSResult(
Arrays.asList(
"https://en.wikipedia.org/wiki/A", "https://en.wikipedia.org/wiki/B"),
Arrays.asList("https://en.wikipedia.org/wiki/A", "https://en.wikipedia.org/wiki/B"),
2));

mockMvc
Expand Down
Loading