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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
45 changes: 45 additions & 0 deletions .github/workflows/concepts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,26 @@ jobs:
distribution: temurin
java-version: "25"
cache: maven
# setup-java caches ~/.m2/repository only. The Maven that ./mvnw downloads lives in
# ~/.m2/wrapper, so cache that too, and fetch it with retries: a single failed download
# from Maven Central would otherwise fail the whole job before any test runs.
- uses: actions/cache@v4
with:
path: ~/.m2/wrapper
key: maven-wrapper-${{ runner.os }}-${{ hashFiles('java/concepts/**/.mvn/wrapper/maven-wrapper.properties') }}
# Maven Central sometimes refuses a runner outright. After two failed tries, switch this
# job to Google's mirror of Central for both the Maven download and the dependencies.
- name: Download Maven (with retries, then a mirror)
run: |
cd "${{ matrix.project.path }}/solution"
for i in 1 2; do ./mvnw -q -v && exit 0; echo "attempt $i failed, retrying"; sleep 10; done
mirror=https://maven-central.storage-download.googleapis.com/maven2
echo "Maven Central refused the download. Using $mirror for this job."
echo "MVNW_REPOURL=$mirror" >> "$GITHUB_ENV"
mkdir -p ~/.m2
printf '<settings><mirrors><mirror><id>google</id><mirrorOf>central</mirrorOf><url>%s</url></mirror></mirrors></settings>\n' "$mirror" > ~/.m2/settings.xml
for i in 1 2 3; do MVNW_REPOURL=$mirror ./mvnw -q -v && exit 0; echo "mirror attempt $i failed, retrying"; sleep 10; done
exit 1
# start/ must fail with the documented count; solution/ must pass everything.
- name: Verify start/ and solution/
run: >
Expand All @@ -70,6 +90,31 @@ jobs:
distribution: temurin
java-version: "25"
cache: maven
- uses: actions/cache@v4
with:
path: ~/.m2/wrapper
key: maven-wrapper-${{ runner.os }}-${{ hashFiles('java/concepts/**/.mvn/wrapper/maven-wrapper.properties') }}
- name: Download Maven (with retries, then a mirror)
shell: pwsh
run: |
$mvnw = "java/concepts/junior-mid/06-thread-safety/solution/mvnw.cmd"
for ($i = 1; $i -le 2; $i++) {
& $mvnw -q -v
if ($LASTEXITCODE -eq 0) { exit 0 }
Write-Host "attempt $i failed, retrying"; Start-Sleep -Seconds 10
}
$mirror = "https://maven-central.storage-download.googleapis.com/maven2"
Write-Host "Maven Central refused the download. Using $mirror for this job."
"MVNW_REPOURL=$mirror" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
New-Item -ItemType Directory -Force -Path "$HOME/.m2" | Out-Null
"<settings><mirrors><mirror><id>google</id><mirrorOf>central</mirrorOf><url>$mirror</url></mirror></mirrors></settings>" | Out-File -FilePath "$HOME/.m2/settings.xml" -Encoding utf8
$env:MVNW_REPOURL = $mirror
for ($i = 1; $i -le 3; $i++) {
& $mvnw -q -v
if ($LASTEXITCODE -eq 0) { exit 0 }
Write-Host "mirror attempt $i failed, retrying"; Start-Sleep -Seconds 10
}
exit 1
# Hosted Windows runners cannot run the Postgres containers, so this checks what it can:
# every project's demo.cmd compiles the project and passes its arguments through.
- name: demo.cmd --help in every project
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ A collection of hands-on coding interview projects organized by language. Each p
> **Backend concepts:** [java/concepts/](java/concepts/) is a different kind of project: not a timed
> round, but one concept taught step by step. Each is broken first (you run it and watch the problem
> happen), has challenge tasks and a guided version, tests as acceptance criteria, and `start/` and
> `solution/` folders side by side. There are fifteen so far, numbered in the suggested order from
> `01-transactional` to `15-equals-and-hashcode`: see the [list](java/concepts/README.md).
> `solution/` folders side by side. There are eighteen so far, numbered in the suggested order from
> `01-transactional` to `18-virtual-threads`: see the [list](java/concepts/README.md).

## Structure

Expand Down Expand Up @@ -97,7 +97,7 @@ interview-prep/
│ ├── karat-drills/
│ ├── secret-storage/
│ ├── concepts/
│ │ └── junior-mid/ (01-transactional ... 15-equals-and-hashcode)
│ │ └── junior-mid/ (01-transactional ... 18-virtual-threads)
│ ├── DELIVERY_HERO.md
│ └── KARAT.md
├── python/
Expand Down
3 changes: 3 additions & 0 deletions java/concepts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ under [`java/`](../).
| 13 | Junior / mid | [Money as double](junior-mid/13-money-as-double/) | 1,000 payments of 0.10 add up to 100.00 and 99.99 is paid out |
| 14 | Junior / mid | [Authorisation and JWT](junior-mid/14-authorisation-and-jwt/) | Merchant A reads merchant B's invoices by changing the id in the URL |
| 15 | Junior / mid | [equals and hashCode](junior-mid/15-equals-and-hashcode/) | An item goes into a set, its quantity changes, and the set can no longer find it |
| 16 | Junior / mid | [Batch writes](junior-mid/16-batch-writes/) | Importing 10,000 rows takes 10,000 round trips to the database |
| 17 | Junior / mid | [Testing with a real database](junior-mid/17-testing-with-a-real-database/) | Every test is green and 4 of 4 features are broken on Postgres |
| 18 | Junior / mid | [Virtual threads](junior-mid/18-virtual-threads/) | 200 slow requests, at most 20 in flight; the rest wait in a queue |

The numbers are the suggested order. Each project stands on its own, so you can start anywhere.

Expand Down
5 changes: 4 additions & 1 deletion java/concepts/ci-projects.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@
{ "path": "java/concepts/junior-mid/12-caching-with-redis", "startPass": 13, "total": 28 },
{ "path": "java/concepts/junior-mid/13-money-as-double", "startPass": 9, "total": 34 },
{ "path": "java/concepts/junior-mid/14-authorisation-and-jwt", "startPass": 15, "total": 31 },
{ "path": "java/concepts/junior-mid/15-equals-and-hashcode", "startPass": 14, "total": 34 }
{ "path": "java/concepts/junior-mid/15-equals-and-hashcode", "startPass": 14, "total": 34 },
{ "path": "java/concepts/junior-mid/16-batch-writes", "startPass": 17, "total": 32 },
{ "path": "java/concepts/junior-mid/17-testing-with-a-real-database", "startPass": 9, "total": 24 },
{ "path": "java/concepts/junior-mid/18-virtual-threads", "startPass": 17, "total": 25 }
]
Loading
Loading