Skip to content

Commit 649f393

Browse files
committed
Added basic functionality: Global and Contests statistics monitoring and /track command to start tracking user on CodeForces
1 parent a4dea09 commit 649f393

31 files changed

+1494
-21
lines changed

.github/workflows/main-branch.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Main Branch Workflow
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build-jar:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Set up JDK 21
17+
uses: actions/setup-java@v4
18+
with:
19+
java-version: '21'
20+
distribution: 'corretto'
21+
22+
- name: Setup Gradle
23+
uses: gradle/actions/setup-gradle@v4
24+
25+
- name: Change wrapper permissions
26+
run: chmod +x ./gradlew
27+
28+
- name: Build with Gradle Wrapper
29+
run: ./gradlew build
30+
31+
- name: Extract project name from Gradle
32+
run: |
33+
PROJECT_NAME=$(./gradlew -q printProjectName)
34+
echo "PROJECT_NAME=${PROJECT_NAME}" >> $GITHUB_ENV
35+
36+
- name: Extract version from Gradle
37+
run: |
38+
VERSION=$(./gradlew -q printProjectVersion)
39+
echo "VERSION=${VERSION}" >> $GITHUB_ENV
40+
41+
- name: Upload jars
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: ${{ env.PROJECT_NAME }}-${{ env.VERSION }}-jars
45+
path: build/libs/*.jar
46+
47+
build-and-push-docker:
48+
runs-on: ubuntu-latest
49+
permissions:
50+
packages: write
51+
id-token: write
52+
attestations: write
53+
env:
54+
REGISTRY: ghcr.io
55+
IMAGE_NAME: ${{ github.repository }}
56+
57+
steps:
58+
- name: Checkout repository
59+
uses: actions/checkout@v4
60+
61+
- name: Log in to GitHub Container Registry
62+
uses: docker/login-action@v3
63+
with:
64+
registry: ${{ env.REGISTRY }}
65+
username: ${{ github.actor }}
66+
password: ${{ secrets.GITHUB_TOKEN }}
67+
68+
- name: Extract version from file
69+
run: |
70+
VERSION=$(./gradlew -q printProjectVersion)
71+
echo "VERSION=${VERSION}" >> $GITHUB_ENV
72+
73+
- name: Extract metadata (tags, labels) for Docker
74+
id: meta
75+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
76+
with:
77+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
78+
79+
- name: Change wrapper permissions
80+
run: chmod +x ./gradlew
81+
82+
- name: Build and push Docker image
83+
id: push
84+
uses: docker/build-push-action@v6
85+
with:
86+
context: .
87+
push: true
88+
tags: ${{ steps.meta.outputs.tags }}
89+
labels: ${{ steps.meta.outputs.labels }}
90+
91+
- name: Generate artifact attestation
92+
uses: actions/attest-build-provenance@v1
93+
with:
94+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
95+
subject-digest: ${{ steps.push.outputs.digest }}
96+
push-to-registry: true
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Release Branch Trigger Workflow
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
create_branch:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: write
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Extract version from file
17+
id: get-version
18+
run: |
19+
VERSION=$(./gradlew -q printProjectVersion)
20+
echo "VERSION=${VERSION}" >> $GITHUB_ENV
21+
22+
- name: Create release branch
23+
run: |
24+
git config user.name "$GITHUB_ACTOR"
25+
git config user.email "[email protected]"
26+
git checkout -b release/${{ env.VERSION }}
27+
git push origin release/${{ env.VERSION }}
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
name: Release Branch Workflow
2+
3+
on:
4+
push:
5+
branches:
6+
- release/*
7+
8+
jobs:
9+
build-jar:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Set up JDK 21
17+
uses: actions/setup-java@v4
18+
with:
19+
java-version: '21'
20+
distribution: 'corretto'
21+
22+
- name: Setup Gradle
23+
uses: gradle/actions/setup-gradle@v4
24+
25+
- name: Change wrapper permissions
26+
run: chmod +x ./gradlew
27+
28+
- name: Build with Gradle Wrapper
29+
run: ./gradlew build
30+
31+
- name: Extract project name from Gradle
32+
id: extract_name
33+
run: |
34+
PROJECT_NAME=$(./gradlew -q printProjectName)
35+
echo "PROJECT_NAME=${PROJECT_NAME}" >> $GITHUB_ENV
36+
37+
- name: Extract version from Gradle
38+
id: get-version
39+
run: |
40+
VERSION=$(./gradlew -q printProjectVersion)
41+
echo "VERSION=${VERSION}" >> $GITHUB_ENV
42+
43+
- name: Upload jars
44+
uses: actions/upload-artifact@v4
45+
with:
46+
name: ${{ github.ref_name }}-jars
47+
path: build/libs/*.jar
48+
49+
build-and-push-docker:
50+
runs-on: ubuntu-latest
51+
permissions:
52+
packages: write
53+
id-token: write
54+
attestations: write
55+
env:
56+
REGISTRY: ghcr.io
57+
IMAGE_NAME: ${{ github.repository }}
58+
59+
steps:
60+
- name: Checkout repository
61+
uses: actions/checkout@v4
62+
63+
- name: Log in to GitHub Container Registry
64+
uses: docker/login-action@v3
65+
with:
66+
registry: ${{ env.REGISTRY }}
67+
username: ${{ github.actor }}
68+
password: ${{ secrets.GITHUB_TOKEN }}
69+
70+
- name: Extract version from file
71+
run: |
72+
VERSION=$(./gradlew -q printProjectVersion)
73+
echo "VERSION=${VERSION}" >> $GITHUB_ENV
74+
75+
- name: Extract metadata (tags, labels) for Docker
76+
id: meta
77+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
78+
with:
79+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
80+
81+
- name: Change wrapper permissions
82+
run: chmod +x ./gradlew
83+
84+
- name: Build and push Docker image
85+
id: push
86+
uses: docker/build-push-action@v6
87+
with:
88+
context: .
89+
push: true
90+
tags: ${{ steps.meta.outputs.tags }}, "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
91+
labels: ${{ steps.meta.outputs.labels }}
92+
93+
- name: Generate artifact attestation
94+
uses: actions/attest-build-provenance@v1
95+
with:
96+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
97+
subject-digest: ${{ steps.push.outputs.digest }}
98+
push-to-registry: true
99+
100+
package-and-push-helm:
101+
runs-on: ubuntu-latest
102+
permissions:
103+
contents: write
104+
105+
steps:
106+
- name: Checkout repository
107+
uses: actions/checkout@v4
108+
with:
109+
fetch-depth: 0
110+
111+
- name: Configure Git
112+
run: |
113+
git config user.name "$GITHUB_ACTOR"
114+
git config user.email "[email protected]"
115+
116+
- name: Install Helm
117+
uses: azure/setup-helm@v4
118+
env:
119+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
120+
121+
- name: Run chart-releaser
122+
uses: helm/[email protected]
123+
with:
124+
charts_dir: helm
125+
packages_with_index: true
126+
env:
127+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
128+
129+
- name: Package Helm Chart
130+
run: |
131+
helm package ./helm --destination ./chart
132+
133+
- name: Read Helm Chart
134+
id: helm-chart-reader
135+
uses: jacobtomlinson/[email protected]
136+
with:
137+
path: ./chart/*
138+
139+
- name: Upload Helm Chart
140+
uses: actions/upload-artifact@v4
141+
with:
142+
name: ${{ github.ref_name }}-helm-chart
143+
path: build/libs/*.tgz
144+
145+
create-release:
146+
runs-on: ubuntu-latest
147+
148+
steps:
149+
- name: Checkout repository
150+
uses: actions/checkout@v4
151+
152+
- name: Download jars
153+
uses: actions/download-artifact@v4
154+
with:
155+
name: ${{ github.ref_name }}-jars
156+
path: artifacts/
157+
158+
- name: Download Helm Chart
159+
uses: actions/download-artifact@v4
160+
with:
161+
name: ${{ github.ref_name }}-helm-chart
162+
path: artifacts/
163+
164+
- name: Extract version from file
165+
id: get-version
166+
run: |
167+
VERSION=$(./gradlew -q printProjectVersion)
168+
echo "VERSION=${VERSION}" >> $GITHUB_ENV
169+
170+
- name: Release
171+
uses: softprops/action-gh-release@v2
172+
if: true
173+
with:
174+
tag_name: ${{ env.VERSION }}
175+
body_path: ./CHANGELOG.md
176+
files: |
177+
artifacts/*
178+
179+
dependency-submission:
180+
runs-on: ubuntu-latest
181+
permissions:
182+
contents: write
183+
184+
steps:
185+
- name: Checkout repository
186+
uses: actions/checkout@v4
187+
188+
- name: Set up JDK 21
189+
uses: actions/setup-java@v4
190+
with:
191+
java-version: '21'
192+
distribution: 'corretto'
193+
194+
- name: Generate and submit dependency graph
195+
uses: gradle/actions/dependency-submission@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0

.gitignore

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,45 @@
1-
# Compiled class file
2-
*.class
1+
.gradle
2+
build/
3+
!gradle/wrapper/gradle-wrapper.jar
4+
!**/src/main/**/build/
5+
!**/src/test/**/build/
36

4-
# Log file
5-
*.log
7+
### IntelliJ IDEA ###
8+
.idea/modules.xml
9+
.idea/jarRepositories.xml
10+
.idea/compiler.xml
11+
.idea/libraries/
12+
*.iws
13+
*.iml
14+
*.ipr
15+
out/
16+
!**/src/main/**/out/
17+
!**/src/test/**/out/
618

7-
# BlueJ files
8-
*.ctxt
19+
### Kotlin ###
20+
.kotlin
921

10-
# Mobile Tools for Java (J2ME)
11-
.mtj.tmp/
22+
### Eclipse ###
23+
.apt_generated
24+
.classpath
25+
.factorypath
26+
.project
27+
.settings
28+
.springBeans
29+
.sts4-cache
30+
bin/
31+
!**/src/main/**/bin/
32+
!**/src/test/**/bin/
1233

13-
# Package Files #
14-
*.jar
15-
*.war
16-
*.nar
17-
*.ear
18-
*.zip
19-
*.tar.gz
20-
*.rar
34+
### NetBeans ###
35+
/nbproject/private/
36+
/nbbuild/
37+
/dist/
38+
/nbdist/
39+
/.nb-gradle/
2140

22-
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
23-
hs_err_pid*
24-
replay_pid*
41+
### VS Code ###
42+
.vscode/
43+
44+
### Mac OS ###
45+
.DS_Store

.idea/.gitignore

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)