Skip to content

Commit bf3be37

Browse files
committed
Java Junior Developer - занятие 1
0 parents  commit bf3be37

260 files changed

Lines changed: 20538 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master, main ]
6+
pull_request:
7+
branches: [ master, main ]
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 15
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Set up JDK 17
23+
uses: actions/setup-java@v4
24+
with:
25+
java-version: '17'
26+
distribution: 'temurin'
27+
28+
- name: Build and test with coverage
29+
run: |
30+
BUILD_OK=true
31+
TEST_OK=true
32+
COVERAGE_OK=true
33+
34+
# Build
35+
if ! mvn -B clean compile -Dmaven.test.skip=true -Djava.awt.headless=true 2>&1; then
36+
BUILD_OK=false
37+
echo "::warning::Build failed — legacy code may need updates for Java 17"
38+
fi
39+
40+
# Test + JaCoCo
41+
if $BUILD_OK; then
42+
if ! mvn -B test -Djava.awt.headless=true 2>&1; then
43+
TEST_OK=false
44+
echo "::warning::Some tests failed"
45+
fi
46+
fi
47+
48+
# Coverage check
49+
if $BUILD_OK && $TEST_OK; then
50+
if ! mvn -B verify -Dmaven.test.skip=true -Djava.awt.headless=true 2>&1; then
51+
COVERAGE_OK=false
52+
echo "::warning::Coverage below 100%"
53+
fi
54+
fi
55+
56+
echo "BUILD_OK=$BUILD_OK" >> $GITHUB_ENV
57+
echo "TEST_OK=$TEST_OK" >> $GITHUB_ENV
58+
echo "COVERAGE_OK=$COVERAGE_OK" >> $GITHUB_ENV
59+
60+
- name: Coverage summary
61+
if: always()
62+
run: |
63+
echo "## CI Status" >> $GITHUB_STEP_SUMMARY
64+
echo "| Step | Status |" >> $GITHUB_STEP_SUMMARY
65+
echo "|------|--------|" >> $GITHUB_STEP_SUMMARY
66+
[ "$BUILD_OK" = "true" ] && echo "| Build | ✅ |" >> $GITHUB_STEP_SUMMARY || echo "| Build | ❌ |" >> $GITHUB_STEP_SUMMARY
67+
[ "$TEST_OK" = "true" ] && echo "| Tests | ✅ |" >> $GITHUB_STEP_SUMMARY || echo "| Tests | ❌ |" >> $GITHUB_STEP_SUMMARY
68+
[ "$COVERAGE_OK" = "true" ] && echo "| Coverage 100% | ✅ |" >> $GITHUB_STEP_SUMMARY || echo "| Coverage 100% | ❌ |" >> $GITHUB_STEP_SUMMARY
69+
70+
if [ -f target/site/jacoco/jacoco.csv ]; then
71+
echo "" >> $GITHUB_STEP_SUMMARY
72+
echo "## Coverage Report" >> $GITHUB_STEP_SUMMARY
73+
echo '```' >> $GITHUB_STEP_SUMMARY
74+
awk -F',' 'NR>1 {missed+=$4; covered+=$5} END {total=missed+covered; if(total>0) printf "Line Coverage: %d/%d (%.1f%%)\nMissed: %d lines\n", covered, total, covered*100/total, missed; else print "No coverage data"}' target/site/jacoco/jacoco.csv >> $GITHUB_STEP_SUMMARY
75+
echo '```' >> $GITHUB_STEP_SUMMARY
76+
echo "" >> $GITHUB_STEP_SUMMARY
77+
echo "### Per-class" >> $GITHUB_STEP_SUMMARY
78+
echo '| Class | Coverage | Lines |' >> $GITHUB_STEP_SUMMARY
79+
echo '|-------|----------|-------|' >> $GITHUB_STEP_SUMMARY
80+
awk -F',' 'NR>1 {total=$4+$5; if(total>0) pct=$5*100/total; else pct=100; printf "| %s.%s | %.0f%% | %d/%d |\n", $2, $3, pct, $5, total}' target/site/jacoco/jacoco.csv >> $GITHUB_STEP_SUMMARY
81+
fi
82+
83+
- name: Upload coverage
84+
if: always()
85+
uses: codecov/codecov-action@v4
86+
with:
87+
file: target/site/jacoco/jacoco.xml
88+
fail_ci_if_error: false
89+
env:
90+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.gitignore

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
*.class
2+
3+
# Mobile Tools for Java (J2ME)
4+
.mtj.tmp/
5+
6+
# Package Files #
7+
*.jar
8+
*.war
9+
*.ear
10+
11+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
12+
hs_err_pid*
13+
14+
atlassian-ide-plugin.xml
15+
.DS_Store
16+
17+
nbproject
18+
out
19+
private
20+
build
21+
dist
22+
target
23+
24+
# Log-files
25+
*.log
26+
27+
# Конфигурационный файл .idea
28+
.idea
29+
*.iml
30+
.idea/workspace.xml
31+

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
language: java
2+
jdk:
3+
- oraclejdk8

.~lock.java.ppt#

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
denis stepulenok,STEPULENOK-PC/gtee,STEPULENOK-PC.ru.oracle.com,21.05.2015 20:35,file:///C:/Users/gtee/AppData/Roaming/OracleOpenOffice/3;

00_intro.md

Lines changed: 312 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)