Skip to content

Commit 0358db8

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

30 files changed

+1446
-21
lines changed

.github/workflows/main-branch.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
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 }}
45+
path: build/libs/
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+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
57+
58+
steps:
59+
- name: Checkout repository
60+
uses: actions/checkout@v4
61+
62+
- name: Log in to GitHub Container Registry
63+
uses: docker/login-action@v3
64+
with:
65+
registry: ${{ env.REGISTRY }}
66+
username: ${{ github.actor }}
67+
password: ${{ secrets.GITHUB_TOKEN }}
68+
69+
- name: Extract version from file
70+
run: |
71+
VERSION=$(./gradlew -q printProjectVersion)
72+
echo "VERSION=${VERSION}" >> $GITHUB_ENV
73+
74+
- name: Extract metadata (tags, labels) for Docker
75+
id: meta
76+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
77+
with:
78+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
79+
80+
- name: Change wrapper permissions
81+
run: chmod +x ./gradlew
82+
83+
- name: Build and push Docker image
84+
id: push
85+
uses: docker/build-push-action@v6
86+
with:
87+
context: .
88+
push: true
89+
tags: ${{ steps.meta.outputs.tags }}
90+
labels: ${{ steps.meta.outputs.labels }}
91+
92+
- name: Generate artifact attestation
93+
uses: actions/attest-build-provenance@v1
94+
with:
95+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
96+
subject-digest: ${{ steps.push.outputs.digest }}
97+
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: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
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: ${{ env.PROJECT_NAME }}-${{ env.VERSION }}
47+
path: build/libs/
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+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
59+
60+
steps:
61+
- name: Checkout repository
62+
uses: actions/checkout@v4
63+
64+
- name: Log in to GitHub Container Registry
65+
uses: docker/login-action@v2
66+
with:
67+
registry: ${{ env.REGISTRY }}
68+
username: ${{ github.actor }}
69+
password: ${{ secrets.GITHUB_TOKEN }}
70+
71+
- name: Extract version from file
72+
id: get-version
73+
run: |
74+
VERSION=$(./gradlew -q printProjectVersion)
75+
echo "VERSION=${VERSION}" >> $GITHUB_ENV
76+
77+
- name: Extract metadata (tags, labels) for Docker
78+
id: meta
79+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
80+
with:
81+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
82+
83+
- name: Change wrapper permissions
84+
run: chmod +x ./gradlew
85+
86+
- name: Build and push Docker image
87+
id: push
88+
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
89+
with:
90+
context: .
91+
platforms: linux/amd64,linux/arm64
92+
push: true
93+
tags: ${{ steps.meta.outputs.tags }},${{ env.BRANCH_NAME }},"latest"
94+
labels: ${{ steps.meta.outputs.labels }}
95+
96+
- name: Generate artifact attestation
97+
uses: actions/attest-build-provenance@v1
98+
with:
99+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
100+
subject-digest: ${{ steps.push.outputs.digest }}
101+
push-to-registry: true
102+
103+
package-and-push-helm:
104+
runs-on: ubuntu-latest
105+
permissions:
106+
contents: write
107+
108+
steps:
109+
- name: Checkout repository
110+
uses: actions/checkout@v4
111+
with:
112+
fetch-depth: 0
113+
114+
- name: Configure Git
115+
run: |
116+
git config user.name "$GITHUB_ACTOR"
117+
git config user.email "[email protected]"
118+
119+
- name: Install Helm
120+
uses: azure/setup-helm@v4
121+
env:
122+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
123+
124+
- name: Run chart-releaser
125+
uses: helm/[email protected]
126+
with:
127+
charts_dir: helm
128+
packages_with_index: true
129+
env:
130+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
131+
132+
dependency-submission:
133+
runs-on: ubuntu-latest
134+
permissions:
135+
contents: write
136+
137+
steps:
138+
- name: Checkout repository
139+
uses: actions/checkout@v4
140+
141+
- name: Set up JDK 21
142+
uses: actions/setup-java@v4
143+
with:
144+
java-version: '21'
145+
distribution: 'corretto'
146+
147+
- name: Generate and submit dependency graph
148+
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.

.idea/gradle.xml

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

.idea/kotlinc.xml

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

.idea/misc.xml

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

.idea/vcs.xml

Lines changed: 6 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)