├── .env
├── .github
└── workflows
│ ├── run_bash.yml
│ ├── run_go.yml
│ └── run_node.yml
├── README.md
├── git.go
├── git.js
├── git.sh
├── go.mod
├── go.sum
├── package-lock.json
└── package.json
/.env:
--------------------------------------------------------------------------------
1 | COMMIT_COUNT=100000
2 | PUSH_THRESHOLD=3000
3 |
--------------------------------------------------------------------------------
/.github/workflows/run_bash.yml:
--------------------------------------------------------------------------------
1 | # This is a basic workflow to help you get started with Actions
2 |
3 | name: Continous Commiting With Bash
4 |
5 | # Controls when the workflow will run
6 | on:
7 | # Triggers the workflow on push or pull request events but only for the master branch
8 | push:
9 | branches: [ master ]
10 |
11 | # Allows you to run this workflow manually from the Actions tab
12 | workflow_dispatch:
13 |
14 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel
15 | jobs:
16 | # This workflow contains a single job called "build"
17 | commit_and_push:
18 | # The type of runner that the job will run on
19 | runs-on: ubuntu-latest
20 |
21 | # Steps represent a sequence of tasks that will be executed as part of the job
22 | steps:
23 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
24 | - uses: actions/checkout@v2
25 |
26 | # Runs a set of commands using the runners shell
27 | - name: GitHub config
28 | run: |
29 | git config --global user.email "recep.fed@gmail.com"
30 | git config --global user.name "booleanrecep"
31 |
32 | - name: Commit
33 | run: bash git.sh
34 |
35 |
36 |
--------------------------------------------------------------------------------
/.github/workflows/run_go.yml:
--------------------------------------------------------------------------------
1 | name: Continous Commiting With Go
2 |
3 | on:
4 | push:
5 | branches: [ master ]
6 |
7 | workflow_dispatch:
8 |
9 | jobs:
10 |
11 | run_git_with_go:
12 | runs-on: ubuntu-latest
13 | steps:
14 | - uses: actions/checkout@v2
15 |
16 | - name: GitHub config
17 | run: |
18 | git config --global user.email "recep.fed@gmail.com"
19 | git config --global user.name "booleanrecep"
20 |
21 | - name: Set up Go
22 | uses: actions/setup-go@v2
23 | with:
24 | go-version: 1.17
25 | - name: Download go dependencies
26 | run: go mod download
27 |
28 | - name: Run go
29 | run: go run git.go
30 |
31 |
--------------------------------------------------------------------------------
/.github/workflows/run_node.yml:
--------------------------------------------------------------------------------
1 | # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3 |
4 | name: Continous Committing With Node
5 |
6 | on:
7 | push:
8 | branches: [ master ]
9 |
10 | workflow_dispatch:
11 |
12 | jobs:
13 | run_git_with_node:
14 |
15 | runs-on: ubuntu-latest
16 |
17 | strategy:
18 | matrix:
19 | node-version: [16.x]
20 | # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
21 |
22 | steps:
23 | - uses: actions/checkout@v2
24 | - name: Use Node.js ${{ matrix.node-version }}
25 | uses: actions/setup-node@v2
26 | with:
27 | node-version: ${{ matrix.node-version }}
28 |
29 | - run: npm ci
30 |
31 | - name: GitHub config
32 | run: |
33 | git config --global user.email "recep.fed@gmail.com"
34 | git config --global user.name "booleanrecep"
35 | - name: Run Node
36 | run: node git.js
37 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | ### GitHub's Commit Capacity.
3 |
4 | #### Motivation
5 | > Checking some relations and capabilities between GitHub & Git, client-server model, network, GitHub actions and Continous Integration.
6 |
7 | #### Goal
8 | > Making this repo most committed one on GitHub
9 |
10 | #### How ?
11 |
12 | 1. Committing and pushing from GitHub to GitHub.
13 | 2. In the beginning I used my local and another platform to run git workflow scripts. But later on, I used GitHub actions to run them. So that there is no network latency because committed repo and committing actions (GitHub actions) resides in the same platform/virtual machine. That means pushing from GitHub to GitHub.
14 | 3. Getting `COMMIT_COUNT` and `PUSH_THRESHOLD` from .env
15 | 4. Running `scripts` via workflows to achive 1. step
16 |
17 | ###### With Bash
18 | git.sh
19 | ```shell
20 | #!/bin/bash
21 |
22 | source .env
23 | git pull
24 |
25 | for i in $( eval echo {1..$COMMIT_COUNT} )
26 | do
27 | git commit --allow-empty -m 'go + git + github = 💥'
28 |
29 | if [[ $i%$PUSH_THRESHOLD -eq 0 ]]
30 | then
31 | git push
32 | echo '🛬 pushed successfully'
33 | fi
34 | done
35 | ```
36 |
37 | ###### With Golang
38 | git.go
39 | ```go
40 | package main
41 |
42 | import (
43 | "fmt"
44 | "os"
45 | "strconv"
46 | "os/exec"
47 | "github.com/joho/godotenv"
48 | )
49 |
50 | func main() {
51 | godotenv.Load()
52 | commitCount, _ := strconv.Atoi(os.Getenv("COMMIT_COUNT"))
53 | pushThreshold, _ := strconv.Atoi(os.Getenv("PUSH_THRESHOLD"))
54 |
55 | git := "git"
56 | commit := "commit"
57 | push := "push"
58 | allow_empty := "--allow-empty"
59 | m := "-m"
60 | message := "'go + git + github = 💥'"
61 |
62 | for i := 0; i < commitCount; i++ {
63 |
64 | cmdCommit := exec.Command(git, commit, allow_empty, m, message)
65 | stdoutCommit, errCommit := cmdCommit.Output()
66 |
67 | if errCommit != nil {
68 | fmt.Println("🔥 commit error: ", errCommit.Error())
69 | return
70 | }
71 |
72 | fmt.Println("🚀 ",string(stdoutCommit))
73 |
74 | if (i % pushThreshold == 0) {
75 |
76 | cmdPush := exec.Command(git, push)
77 | _, errPush := cmdPush.Output()
78 |
79 | if errPush != nil {
80 | fmt.Println("🔥 push error: ", errPush.Error())
81 |
82 | }
83 |
84 | fmt.Println("🛬 pushed successfully")
85 | }
86 |
87 | }
88 |
89 | }
90 | ```
91 |
92 | ###### With Node
93 | git.js
94 | ```node
95 | const { exec } = require("child_process");
96 | require('dotenv').config();
97 | const commitCount = process.env.COMMIT_COUNT;
98 | const pushThreshold = process.env.PUSH_THRESHOLD;
99 |
100 | const gitPull = () => {
101 | return exec("git pull", (err, stdout, stderr) => {
102 | if (err) {
103 | console.log("🔥 pull error: ", err);
104 | return;
105 | }
106 | console.log(`🚀 : ${stdout}`);
107 | });
108 | };
109 |
110 | const gitCommit = () => {
111 | return exec(
112 | 'git commit --allow-empty -m "go + git + github = 💥"',
113 | (err, stdout, stderr) => {
114 | if (err) {
115 | // console.log("🔥 commit error: ", err);
116 | return;
117 | }
118 | console.log(`🚀 : ${stdout}`);
119 | }
120 | );
121 | };
122 |
123 | const gitPush = () => {
124 | return exec("git push", (err, stdout, stderr) => {
125 | if (err) {
126 | console.log("🔥 push error: ", err);
127 | return;
128 | }
129 |
130 | console.log(`🛬 pushed successfully: ${stdout}`);
131 | });
132 | };
133 |
134 | const run = () => {
135 | gitPull();
136 |
137 | for (let i = 0; i < commitCount; i++) {
138 | gitCommit();
139 |
140 | if (i % pushThreshold === 0) {
141 | gitPush();
142 | }
143 | }
144 | };
145 |
146 | run();
147 | ```
148 |
149 | #### So far experiences
150 | > Disclamer: These observations and thoughts may not be correct. These are my personal experiments and observations.
151 | * In GitHub there are a few repos that have over 1m+ commits. ( I didn't examine througoutly).
152 | * [Linux](https://github.com/torvalds/linux) : 1.072.960~ ( respect to contributers)
153 | * [Commited](https://github.com/virejdasani/Commited) 3.000.000~
154 | * [This repo](https://github.com/booleanrecep/github-commit-capacity) : 12.176.258~
155 | * `git push`ing from another platform or from our local will take slightly more time. Because there will be network latency. But using GitHub actions means our code/repo and Git are in same platform/machine ( a virtual machine provisioned by GitHub which our repo and action runners resides). So that there will be no network latency. That makes `git push` blazingly faster.
156 | * Golang felt faster than Bash and Node, it's like a super-jet.
157 | * Github actions have some restrictions and limits . Some GitHub error messages are like :
158 | * No space left on device.
159 | * You are running out of disk space.
160 | * Each runner has only 6 hours (360 minute) exact time to do it's job.
161 | * Temperature of my computer (2011 model Asus brand 4 core i7 processor) suddenly rised and the fan screamed. In System Monitor, the each of 4 core were over 80%.
162 | * In GitHub actions with Go every three second (~3000ms) ~1000 commits can be pushed. Disclamer: For that measurement I observed commit time in GitHub. So it's not scientific :)
163 | * [Gitpod](https://gitpod.io/) blocked my account after running some scripts on their server. As they explained doing so degraded their platform and it looked like a DoS attack. Thanks to them again for unblocking my account. It's a nice and powerful platform.
164 | * GitHub is such a powerful platform. Tens of thousands of file (.txt) I have created and written with commits alongside of push and nothing broken.
165 | * I have learned also that git has a flag that is `--allow-empty` and lets you write commit without any change.
166 | * ..... to be continued.
167 |
--------------------------------------------------------------------------------
/git.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "fmt"
5 | "os"
6 | "strconv"
7 | "os/exec"
8 | "github.com/joho/godotenv"
9 | )
10 |
11 | func main() {
12 |
13 | godotenv.Load()
14 |
15 | commitCount, _ := strconv.Atoi(os.Getenv("COMMIT_COUNT"))
16 | pushThreshold, _ := strconv.Atoi(os.Getenv("PUSH_THRESHOLD"))
17 |
18 | git := "git"
19 | commit := "commit"
20 | push := "push"
21 | allow_empty := "--allow-empty"
22 | m := "-m"
23 | message := "'go + git + github = 💥'"
24 |
25 | for i := 0; i < commitCount; i++ {
26 |
27 | cmdCommit := exec.Command(git, commit, allow_empty, m, message)
28 |
29 | stdoutCommit, errCommit := cmdCommit.Output()
30 |
31 | if errCommit != nil {
32 | fmt.Println("🔥 commit error: ", errCommit.Error())
33 | return
34 | }
35 |
36 | fmt.Println("🚀 ",string(stdoutCommit))
37 |
38 | if (i % pushThreshold == 0) {
39 |
40 | cmdPush := exec.Command(git, push)
41 |
42 | _, errPush := cmdPush.Output()
43 |
44 | if errPush != nil {
45 | fmt.Println("🔥 push error: ", errPush.Error())
46 |
47 | }
48 |
49 | fmt.Println("🛬 pushed successfully")
50 | }
51 |
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/git.js:
--------------------------------------------------------------------------------
1 | const { exec } = require("child_process");
2 | require('dotenv').config();
3 | const commitCount = process.env.COMMIT_COUNT;
4 | const pushThreshold = process.env.PUSH_THRESHOLD;
5 |
6 | const gitPull = () => {
7 | return exec("git pull", (err, stdout, stderr) => {
8 | if (err) {
9 | console.log("🔥 pull error: ", err);
10 | return;
11 | }
12 | console.log(`🚀 : ${stdout}`);
13 | });
14 | };
15 |
16 | const gitCommit = () => {
17 | return exec(
18 | 'git commit --allow-empty -m "go + git + github = 💥"',
19 | (err, stdout, stderr) => {
20 | if (err) {
21 | return;
22 | }
23 | console.log(`🚀 : ${stdout}`);
24 | }
25 | );
26 | };
27 |
28 | const gitPush = () => {
29 | return exec("git push", (err, stdout, stderr) => {
30 | if (err) {
31 | console.log("🔥 push error: ", err);
32 | return;
33 | }
34 | console.log(`🛬 pushed successfully: ${stdout}`);
35 | });
36 | };
37 |
38 | const run = () => {
39 | gitPull();
40 |
41 | for (let i = 0; i < commitCount; i++) {
42 | gitCommit();
43 |
44 | if (i % pushThreshold === 0) {
45 | gitPush();
46 | }
47 | }
48 | };
49 |
50 | run();
51 |
--------------------------------------------------------------------------------
/git.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | source .env
4 | git pull
5 |
6 | for i in $( eval echo {1..$COMMIT_COUNT} )
7 | do
8 | git commit --allow-empty -m 'go + git + github = 💥'
9 |
10 | if [[ $i%$PUSH_THRESHOLD -eq 0 ]]
11 | then
12 | git push
13 | echo '🛬 pushed successfully'
14 | fi
15 | done
16 |
--------------------------------------------------------------------------------
/go.mod:
--------------------------------------------------------------------------------
1 | module github.com/booleanrecep/github-commit-capacity
2 |
3 | go 1.17
4 |
5 | require github.com/joho/godotenv v1.4.0 // indirect
6 |
--------------------------------------------------------------------------------
/go.sum:
--------------------------------------------------------------------------------
1 | github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg=
2 | github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
3 |
--------------------------------------------------------------------------------
/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "github-commit-capacity",
3 | "version": "1.0.0",
4 | "lockfileVersion": 2,
5 | "requires": true,
6 | "packages": {
7 | "": {
8 | "name": "github-commit-capacity",
9 | "version": "1.0.0",
10 | "license": "ISC",
11 | "dependencies": {
12 | "dotenv": "^16.0.0"
13 | }
14 | },
15 | "node_modules/dotenv": {
16 | "version": "16.0.0",
17 | "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.0.tgz",
18 | "integrity": "sha512-qD9WU0MPM4SWLPJy/r2Be+2WgQj8plChsyrCNQzW/0WjvcJQiKQJ9mH3ZgB3fxbUUxgc/11ZJ0Fi5KiimWGz2Q==",
19 | "engines": {
20 | "node": ">=12"
21 | }
22 | }
23 | },
24 | "dependencies": {
25 | "dotenv": {
26 | "version": "16.0.0",
27 | "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.0.tgz",
28 | "integrity": "sha512-qD9WU0MPM4SWLPJy/r2Be+2WgQj8plChsyrCNQzW/0WjvcJQiKQJ9mH3ZgB3fxbUUxgc/11ZJ0Fi5KiimWGz2Q=="
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "github-commit-capacity",
3 | "version": "1.0.0",
4 | "description": "GitHub Commit Capacity",
5 | "main": "git.js",
6 | "scripts": {},
7 | "author": "booleanrecep",
8 | "license": "ISC",
9 | "dependencies": {
10 | "dotenv": "^16.0.0"
11 | }
12 | }
13 |
--------------------------------------------------------------------------------