Compare commits

...

84 Commits

Author SHA1 Message Date
3d26823425 Fix breaking changes in vergen
All checks were successful
continuous-integration/drone/push Build is passing
2021-02-26 16:12:58 +01:00
d9553871fa Deactivate unused features of vergen 2021-02-26 16:12:47 +01:00
d2bc9c2149 Bump vergen from 3.2.0 to 4.1.0
Bumps [vergen](https://github.com/rustyhorde/vergen) from 3.2.0 to 4.1.0.
- [Release notes](https://github.com/rustyhorde/vergen/releases)
- [Commits](https://github.com/rustyhorde/vergen/compare/v3.2.0...4.1.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-26 15:06:33 +00:00
b0b97653a9 Rollback reqwest to 0.10.10
All checks were successful
continuous-integration/drone/push Build is passing
2021-02-26 16:04:58 +01:00
0b1bc60790 Merge pull request #238 from vbrandl/revert-236-dependabot/cargo/actix-rt-2.1.0
Revert "Bump actix-rt from 1.1.1 to 2.1.0"
2021-02-26 15:51:46 +01:00
e93588a6d9 Revert "Bump actix-rt from 1.1.1 to 2.1.0" 2021-02-26 15:51:35 +01:00
cd5046a276 Merge pull request #236 from vbrandl/dependabot/cargo/actix-rt-2.1.0
Bump actix-rt from 1.1.1 to 2.1.0
2021-02-26 15:41:54 +01:00
919348d49d Merge pull request #229 from vbrandl/dependabot/cargo/tracing-futures-0.2.5
Bump tracing-futures from 0.2.4 to 0.2.5
2021-02-26 15:31:26 +01:00
8378b0b51b Bump tracing-futures from 0.2.4 to 0.2.5
Bumps [tracing-futures](https://github.com/tokio-rs/tracing) from 0.2.4 to 0.2.5.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-futures-0.2.4...tracing-futures-0.2.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-26 14:31:17 +00:00
0394ae52e9 Merge pull request #235 from vbrandl/dependabot/cargo/tracing-0.1.25
Bump tracing from 0.1.23 to 0.1.25
2021-02-26 15:29:55 +01:00
fb34f6bf2f Bump tracing from 0.1.23 to 0.1.25
Bumps [tracing](https://github.com/tokio-rs/tracing) from 0.1.23 to 0.1.25.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-0.1.23...tracing-0.1.25)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-26 14:29:17 +00:00
36622ad322 Merge pull request #232 from vbrandl/dependabot/cargo/tracing-subscriber-0.2.16
Bump tracing-subscriber from 0.2.15 to 0.2.16
2021-02-26 15:28:11 +01:00
89bb27e137 Merge pull request #237 from vbrandl/dependabot/cargo/serde_json-1.0.63
Bump serde_json from 1.0.62 to 1.0.63
2021-02-26 15:27:53 +01:00
7d4385764c Bump serde_json from 1.0.62 to 1.0.63
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.62 to 1.0.63.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.62...v1.0.63)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-26 04:19:16 +00:00
5df97f0e64 Bump actix-rt from 1.1.1 to 2.1.0
Bumps [actix-rt](https://github.com/actix/actix-net) from 1.1.1 to 2.1.0.
- [Release notes](https://github.com/actix/actix-net/releases)
- [Commits](https://github.com/actix/actix-net/compare/rt-1.1.1...rt-v2.1.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-26 04:18:49 +00:00
a3d98a326e Bump tracing-subscriber from 0.2.15 to 0.2.16
Bumps [tracing-subscriber](https://github.com/tokio-rs/tracing) from 0.2.15 to 0.2.16.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-subscriber-0.2.15...tracing-subscriber-0.2.16)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-22 04:14:56 +00:00
76bf5f2f98 Merge pull request #221 from vbrandl/dependabot/cargo/serde-1.0.123
Bump serde from 1.0.118 to 1.0.123
2021-02-11 11:17:34 +01:00
e827d2ef39 Bump serde from 1.0.118 to 1.0.123
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.118 to 1.0.123.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.118...v1.0.123)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-11 10:12:45 +00:00
65576140ce Merge pull request #212 from vbrandl/dependabot/cargo/reqwest-0.11.0
Bump reqwest from 0.10.10 to 0.11.0
2021-02-11 11:11:14 +01:00
cea54cf2f3 Bump reqwest from 0.10.10 to 0.11.0
Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.10.10 to 0.11.0.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.10.10...v0.11.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-11 10:10:09 +00:00
8c28c68c17 Merge pull request #215 from vbrandl/dependabot/cargo/bytes-1.0.1
Bump bytes from 1.0.0 to 1.0.1
2021-02-11 11:09:27 +01:00
b86a080ead Merge pull request #223 from vbrandl/dependabot/cargo/tracing-0.1.23
Bump tracing from 0.1.22 to 0.1.23
2021-02-11 11:08:42 +01:00
1b0c959a8d Bump bytes from 1.0.0 to 1.0.1
Bumps [bytes](https://github.com/tokio-rs/bytes) from 1.0.0 to 1.0.1.
- [Release notes](https://github.com/tokio-rs/bytes/releases)
- [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/bytes/compare/v1.0.0...v1.0.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-10 17:07:29 +00:00
806baf7460 Bump tracing from 0.1.22 to 0.1.23
Bumps [tracing](https://github.com/tokio-rs/tracing) from 0.1.22 to 0.1.23.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-0.1.22...tracing-0.1.23)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-10 17:06:26 +00:00
080f7379ea Merge pull request #216 from vbrandl/dependabot/cargo/tempfile-3.2.0
Bump tempfile from 3.1.0 to 3.2.0
2021-02-10 18:06:14 +01:00
7409de5dba Merge pull request #219 from vbrandl/dependabot/cargo/git2-0.13.17
Bump git2 from 0.13.14 to 0.13.17
2021-02-10 18:05:52 +01:00
07f4ef518a Merge pull request #225 from vbrandl/dependabot/cargo/serde_json-1.0.62
Bump serde_json from 1.0.61 to 1.0.62
2021-02-10 18:04:58 +01:00
820ebdd899 Bump tempfile from 3.1.0 to 3.2.0
Bumps [tempfile](https://github.com/Stebalien/tempfile) from 3.1.0 to 3.2.0.
- [Release notes](https://github.com/Stebalien/tempfile/releases)
- [Changelog](https://github.com/Stebalien/tempfile/blob/master/NEWS)
- [Commits](https://github.com/Stebalien/tempfile/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-10 17:04:57 +00:00
527d793914 Merge pull request #226 from vbrandl/dependabot/cargo/vergen-3.2.0
Bump vergen from 3.1.0 to 3.2.0
2021-02-10 18:03:26 +01:00
7df6c3fc75 Bump vergen from 3.1.0 to 3.2.0
Bumps [vergen](https://github.com/rustyhorde/vergen) from 3.1.0 to 3.2.0.
- [Release notes](https://github.com/rustyhorde/vergen/releases)
- [Commits](https://github.com/rustyhorde/vergen/compare/v3.1.0...v3.2.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-10 04:16:04 +00:00
17e1af1dd7 Bump serde_json from 1.0.61 to 1.0.62
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.61 to 1.0.62.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.61...v1.0.62)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-08 04:17:19 +00:00
baade8fbc2 Bump git2 from 0.13.14 to 0.13.17
Bumps [git2](https://github.com/rust-lang/git2-rs) from 0.13.14 to 0.13.17.
- [Release notes](https://github.com/rust-lang/git2-rs/releases)
- [Commits](https://github.com/rust-lang/git2-rs/compare/0.13.14...0.13.17)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-25 04:16:33 +00:00
cfc07664fc Merge pull request #211 from vbrandl/dependabot/cargo/serde_json-1.0.61
Bump serde_json from 1.0.60 to 1.0.61
2021-01-06 18:11:44 +01:00
52938c9106 Bump serde_json from 1.0.60 to 1.0.61
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.60 to 1.0.61.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.60...v1.0.61)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-29 04:18:23 +00:00
b64f573a38 Bump version (v0.16.0)
All checks were successful
continuous-integration/drone/push Build is passing
2020-12-23 21:44:46 +01:00
ebbd1ea8cb Merge pull request #204 from vbrandl/dependabot/cargo/reqwest-0.10.10
Bump reqwest from 0.10.9 to 0.10.10
2020-12-23 21:33:54 +01:00
93a0147a78 Merge pull request #208 from vbrandl/dependabot/cargo/bytes-1.0.0
Bump bytes from 0.6.0 to 1.0.0
2020-12-23 21:33:27 +01:00
2040e718d7 Bump reqwest from 0.10.9 to 0.10.10
Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.10.9 to 0.10.10.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.10.9...v0.10.10)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-23 20:33:00 +00:00
5679f67de0 Bump bytes from 0.6.0 to 1.0.0
Bumps [bytes](https://github.com/tokio-rs/bytes) from 0.6.0 to 1.0.0.
- [Release notes](https://github.com/tokio-rs/bytes/releases)
- [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/bytes/compare/v0.6.0...v1.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-23 20:32:36 +00:00
8babdb978e Merge pull request #207 from vbrandl/dependabot/cargo/git2-0.13.14
Bump git2 from 0.13.12 to 0.13.14
2020-12-23 21:32:20 +01:00
b3388912c2 Merge pull request #203 from vbrandl/dependabot/cargo/serde-1.0.118
Bump serde from 1.0.117 to 1.0.118
2020-12-23 21:31:41 +01:00
bce511ce0b Merge pull request #202 from vbrandl/dependabot/cargo/serde_json-1.0.60
Bump serde_json from 1.0.59 to 1.0.60
2020-12-23 21:31:25 +01:00
50e36769d1 Merge pull request #201 from vbrandl/dependabot/cargo/actix-web-3.3.2
Bump actix-web from 3.3.1 to 3.3.2
2020-12-23 21:31:09 +01:00
9477338331 Bump git2 from 0.13.12 to 0.13.14
Bumps [git2](https://github.com/rust-lang/git2-rs) from 0.13.12 to 0.13.14.
- [Release notes](https://github.com/rust-lang/git2-rs/releases)
- [Commits](https://github.com/rust-lang/git2-rs/compare/0.13.12...0.13.14)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-22 04:18:08 +00:00
c1d0930354 Bump serde from 1.0.117 to 1.0.118
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.117 to 1.0.118.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.117...v1.0.118)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-07 04:17:13 +00:00
688067e5c5 Bump serde_json from 1.0.59 to 1.0.60
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.59 to 1.0.60.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.59...v1.0.60)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-03 04:16:41 +00:00
529f36dc40 Bump actix-web from 3.3.1 to 3.3.2
Bumps [actix-web](https://github.com/actix/actix-web) from 3.3.1 to 3.3.2.
- [Release notes](https://github.com/actix/actix-web/releases)
- [Changelog](https://github.com/actix/actix-web/blob/master/CHANGES.md)
- [Commits](https://github.com/actix/actix-web/compare/web-v3.3.1...web-v3.3.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-02 04:17:45 +00:00
d8fdabfca6 Merge pull request #200 from vbrandl/dependabot/cargo/actix-web-3.3.1
Bump actix-web from 3.2.0 to 3.3.1
2020-11-30 23:37:56 +01:00
8060b80ae6 Bump actix-web from 3.2.0 to 3.3.1
Bumps [actix-web](https://github.com/actix/actix-web) from 3.2.0 to 3.3.1.
- [Release notes](https://github.com/actix/actix-web/releases)
- [Changelog](https://github.com/actix/actix-web/blob/master/CHANGES.md)
- [Commits](https://github.com/actix/actix-web/compare/web-v3.2.0...web-v3.3.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-30 04:17:12 +00:00
15965c5b5f Bump version (v0.15.0)
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2020-11-24 19:34:20 +01:00
1eade03b63 Load env in docker-compose setup
All checks were successful
continuous-integration/drone/push Build is passing
2020-11-24 19:33:12 +01:00
f41fbc8baf Fix test
All checks were successful
continuous-integration/drone/push Build is passing
2020-11-24 19:24:35 +01:00
14cd21dc1c Make paths consistent
All checks were successful
continuous-integration/drone/push Build is passing
2020-11-24 19:13:08 +01:00
1bdee4ee36 Document new config mechanism
All checks were successful
continuous-integration/drone/push Build is passing
2020-11-24 19:07:21 +01:00
9e33742d81 Use new config 2020-11-24 19:06:49 +01:00
8e78d13443 Make full base URL configurable 2020-11-24 19:06:42 +01:00
391fa39470 Use config and dotenv over structopt 2020-11-24 19:06:18 +01:00
e6e90214e2 Add example configurations 2020-11-24 19:05:56 +01:00
6f734b103a Ignore actual configs 2020-11-24 19:05:46 +01:00
413bb824e1 Merge pull request #198 from vbrandl/dependabot/cargo/tracing-0.1.22
All checks were successful
continuous-integration/drone/push Build is passing
Bump tracing from 0.1.21 to 0.1.22
2020-11-24 18:22:29 +01:00
58ad13dbad Bump tracing from 0.1.21 to 0.1.22
Bumps [tracing](https://github.com/tokio-rs/tracing) from 0.1.21 to 0.1.22.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-0.1.21...tracing-0.1.22)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-24 04:17:21 +00:00
9f8b781f7b Bump version (v0.14.5)
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2020-11-23 14:47:22 +01:00
175b7c828b Cleanup cache keys
All checks were successful
continuous-integration/drone/push Build is passing
2020-11-23 14:36:43 +01:00
002119324f Remove unused dependencies 2020-11-23 14:35:12 +01:00
df78b6f1e5 Revert "Dummy modification for audit"
All checks were successful
continuous-integration/drone/push Build is passing
This reverts commit e1bff0d280.
2020-11-23 14:21:46 +01:00
e1bff0d280 Dummy modification for audit
All checks were successful
continuous-integration/drone/push Build is passing
2020-11-23 14:19:39 +01:00
4c9454aa9e Use different cache keys per pipeline 2020-11-23 14:19:11 +01:00
e9e57495a6 Disable nix-build
All checks were successful
continuous-integration/drone/push Build is passing
2020-11-23 14:13:02 +01:00
b6505f6a37 Disable nix-build
All checks were successful
continuous-integration/drone/push Build is passing
2020-11-23 14:12:32 +01:00
a2463bf657 Release binaries on github release page
All checks were successful
continuous-integration/drone/push Build is passing
2020-11-23 14:11:36 +01:00
53cb73cd9b Use checkout@v2 2020-11-23 14:11:18 +01:00
423a3aa0b0 Split formatting and clippy checks into separate pipelines 2020-11-23 14:11:01 +01:00
7a2c6b6f06 Merge pull request #197 from vbrandl/dependabot/cargo/reqwest-0.10.9
Bump reqwest from 0.10.8 to 0.10.9
2020-11-23 12:13:19 +01:00
ffb306a7a8 Merge pull request #196 from vbrandl/dependabot/cargo/ructe-0.13.0
Bump ructe from 0.12.0 to 0.13.0
2020-11-23 12:13:08 +01:00
cef2ae2299 Merge pull request #195 from vbrandl/dependabot/cargo/futures-0.3.8
Bump futures from 0.3.7 to 0.3.8
2020-11-23 12:07:59 +01:00
b91de72d19 Remove travis
All checks were successful
continuous-integration/drone/push Build is passing
2020-11-23 12:07:26 +01:00
fd08489587 Bump futures from 0.3.7 to 0.3.8
Bumps [futures](https://github.com/rust-lang/futures-rs) from 0.3.7 to 0.3.8.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.7...0.3.8)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-23 10:57:43 +00:00
ce0d6041ea Bump reqwest from 0.10.8 to 0.10.9
Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.10.8 to 0.10.9.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.10.8...v0.10.9)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-23 10:57:41 +00:00
3af60a82ce Merge pull request #194 from vbrandl/dependabot/cargo/tracing-subscriber-0.2.15
Bump tracing-subscriber from 0.2.14 to 0.2.15
2020-11-23 11:56:47 +01:00
bcdf7db549 Merge pull request #189 from vbrandl/dependabot/cargo/actix-web-3.2.0
Bump actix-web from 3.1.0 to 3.2.0
2020-11-23 11:56:24 +01:00
9b2f1f4ebb Bump ructe from 0.12.0 to 0.13.0
Bumps [ructe](https://github.com/kaj/ructe) from 0.12.0 to 0.13.0.
- [Release notes](https://github.com/kaj/ructe/releases)
- [Changelog](https://github.com/kaj/ructe/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kaj/ructe/compare/v0.12.0...v0.13.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-16 04:19:05 +00:00
84e47237de Bump tracing-subscriber from 0.2.14 to 0.2.15
Bumps [tracing-subscriber](https://github.com/tokio-rs/tracing) from 0.2.14 to 0.2.15.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-subscriber-0.2.14...tracing-subscriber-0.2.15)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-03 04:18:03 +00:00
909f6585b5 Always return a SVG badge
All checks were successful
continuous-integration/drone/push Build is passing
2020-11-01 13:57:56 +01:00
b48d7f1492 Bump actix-web from 3.1.0 to 3.2.0
Bumps [actix-web](https://github.com/actix/actix-web) from 3.1.0 to 3.2.0.
- [Release notes](https://github.com/actix/actix-web/releases)
- [Changelog](https://github.com/actix/actix-web/blob/master/CHANGES.md)
- [Commits](https://github.com/actix/actix-web/compare/web-v3.1.0...web-v3.2.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-30 20:02:12 +00:00
21 changed files with 671 additions and 690 deletions

7
.env.example Normal file
View File

@ -0,0 +1,7 @@
HOC_REPODIR='./repos'
HOC_CACHEDIR='./cache'
HOC_PORT=8080
HOC_HOST='0.0.0.0'
HOC_WORKERS=4
HOC_BASE_URL='http://0.0.0.0:8080'

View File

@ -4,27 +4,24 @@ on:
- cron: '0 1 * * *'
push:
paths:
- 'Cargo.toml'
- 'Cargo.lock'
- '**/Cargo.toml'
- '**/Cargo.lock'
pull_request:
jobs:
security_audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Cache cargo registry
uses: actions/cache@v1
- name: Cache cargo registry, index and build directory
uses: actions/cache@v2
with:
path: /usr/share/rust/.cargo/registry
key: ${{ runner.os }}-cargo-registry
- name: Cache cargo index
uses: actions/cache@v1
with:
path: /usr/share/rust/.cargo/git
key: ${{ runner.os }}-cargo-index
path: |
~/.cargo/registry
~/.cargo/git
./target
key: audit-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/audit-check@v1
with:

View File

@ -1,20 +0,0 @@
name: "Nix Build"
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v8
- name: Cache nix store
uses: actions/cache@v1
with:
path: /nix
key: ${{ runner.os }}-nix-store
- uses: cachix/cachix-action@v5
with:
name: hitsofcode
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
attributes: package

76
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,76 @@
name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
publish:
name: Publishing for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
rust: [stable]
include:
- os: macos-latest
artifact_prefix: macos
target: x86_64-apple-darwin
binary_postfix: ""
- os: ubuntu-latest
artifact_prefix: linux
target: x86_64-unknown-linux-gnu
binary_postfix: ""
- os: windows-latest
artifact_prefix: windows
target: x86_64-pc-windows-msvc
binary_postfix: ".exe"
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- name: Cache cargo registry, index and build directory
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
./target
key: release-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Cargo build
uses: actions-rs/cargo@v1
with:
command: build
toolchain: ${{ matrix.rust }}
args: --release --target ${{ matrix.target }}
- name: Packaging final binary
shell: bash
run: |
cd target/${{ matrix.target }}/release
strip hoc${{ matrix.binary_postfix }}
tar czvf hoc-${{ matrix.artifact_prefix }}.tar.gz hoc${{ matrix.binary_postfix }}
if [[ ${{ runner.os }} == 'Windows' ]]; then
certutil -hashfile hoc-${{ matrix.artifact_prefix }}.tar.gz sha256 | grep -E [A-Fa-f0-9]{64} > hoc-${{ matrix.artifact_prefix }}.sha256
else
shasum -a 256 hoc-${{ matrix.artifact_prefix }}.tar.gz > hoc-${{ matrix.artifact_prefix }}.sha256
fi
- name: Releasing assets
uses: softprops/action-gh-release@v1
with:
files: |
target/${{ matrix.target }}/release/hoc-${{ matrix.artifact_prefix }}.tar.gz
target/${{ matrix.target }}/release/hoc-${{ matrix.artifact_prefix }}.sha256
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,41 +1,30 @@
name: Rust
on: [push, pull_request]
jobs:
lint:
name: Linting and Formatting Checks
rustfmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v1
uses: actions/checkout@v2
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
components: rustfmt
- name: Install rustfmt
run: rustup component add rustfmt
- name: Cache cargo registry
uses: actions/cache@v1
- name: Cache cargo registry, index and build directory
uses: actions/cache@v2
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
path: |
~/.cargo/registry
~/.cargo/git
./target
key: rustfmt-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Check Formatting
uses: actions-rs/cargo@v1
@ -43,8 +32,29 @@ jobs:
command: fmt
args: --all -- --check
- name: Install clippy
run: rustup component add clippy
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
components: rustfmt
- name: Cache cargo registry, index and build directory
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
./target
key: clippy-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Clippy Linting
uses: actions-rs/cargo@v1
@ -52,8 +62,9 @@ jobs:
command: clippy
args: -- -D warnings
test:
name: Run Tests
name: Test Suite
runs-on: ${{ matrix.os }}
strategy:
matrix:
@ -62,31 +73,23 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v1
uses: actions/checkout@v2
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Cache cargo registry
uses: actions/cache@v1
- name: Cache cargo registry, index and build directory
uses: actions/cache@v2
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
path: |
~/.cargo/registry
~/.cargo/git
./target
key: test-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Run Tests
uses: actions-rs/cargo@v1

2
.gitignore vendored
View File

@ -4,3 +4,5 @@ repos
cache
hoc.log
result
hoc.toml
.env

View File

@ -1,17 +0,0 @@
language: rust
rust:
- stable
- beta
- nightly
cache:
- cargo
matrix:
allow_failures:
- rust: nightly
notifications:
email:
on_failure: always

899
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,38 +1,34 @@
[package]
name = "hoc"
version = "0.14.4"
version = "0.16.0"
authors = ["Valentin Brandl <vbrandl@riseup.net>"]
edition = "2018"
build = "build.rs"
[dependencies]
actix-rt = "1.1.1"
actix-slog = "0.2.1"
actix-web = "3.1.0"
actix-web = "3.3.2"
badge = "0.3.0"
bytes = "0.6.0"
futures = "0.3.7"
git2 = "0.13.12"
bytes = "1.0.1"
config = { version = "0.10.1", features = ["toml"] }
dotenv = "0.15.0"
futures = "0.3.8"
git2 = "0.13.17"
lazy_static = "1.4.0"
number_prefix = "0.4.0"
openssl-probe = "0.1.2"
reqwest = "0.10.8"
serde = "1.0.117"
reqwest = "0.10.10"
serde = "1.0.123"
serde_derive = "1.0.103"
serde_json = "1.0.59"
slog = "2.5.2"
slog-async = "2.5.0"
slog-atomic = "3.0.0"
slog-term = "2.6.0"
structopt = "0.3.20"
tracing = "0.1.21"
tracing-subscriber = "0.2.14"
serde_json = "1.0.63"
tracing = "0.1.25"
tracing-actix-web = "0.2.1"
tracing-futures = "0.2.4"
tracing-futures = "0.2.5"
tracing-subscriber = "0.2.16"
[build-dependencies]
ructe = "0.12.0"
vergen = "3.1.0"
ructe = "0.13.0"
vergen = { version = "4.1.0", default-features = false, features = ["git"] }
[dev-dependencies]
tempfile = "3.1.0"
tempfile = "3.2.0"

View File

@ -1,9 +1,8 @@
# Hits-of-Code
[![Hits-of-Code](https://hitsofcode.com/github/vbrandl/hoc)](https://hitsofcode.com/view/github/vbrandl/hoc)
[![Hits-of-Code](https://hitsofcode.com/github/vbrandl/hoc)](https://hitsofcode.com/github/vbrandl/hoc/view)
[![Drone build](https://drone.vbrandl.net/api/badges/vbrandl/hoc/status.svg)](https://drone.vbrandl.net/vbrandl/hoc)
[![Gitlab build](https://gitlab.com/vbrandl/hoc/badges/master/pipeline.svg)](https://gitlab.com/vbrandl/hoc/pipelines)
[![Travis build](https://travis-ci.org/vbrandl/hoc.svg?branch=master)](https://travis-ci.org/vbrandl/hoc)
[![dependency status](https://deps.rs/repo/github/vbrandl/hoc/status.svg)](https://deps.rs/repo/github/vbrandl/hoc)
Small webservice, that returns a badge of the Hits-of-Code of a git repository, as described by [Yegor
@ -27,7 +26,7 @@ where `<service>` is one of `gitub`, `gitlab` or `bitbucket`. The HoC data can a
https://<host>/<service>/<user>/<repo>/json
```
There is also an overview page available via `https://<host>/view/<service>/<user>/<repo>`
There is also an overview page available via `https://<host>/<service>/<user>/<repo>/view`
To delete a repository and the cache from the server, send a `POST` request to
`https://<host>/<service>/<user>/<repo>/delete`. On the overview page, there is a button to perform this operation. It
@ -49,21 +48,29 @@ $ docker build .
inside the repository.
I'm currently working on migrating to [nix](https://nixos.org/nix). To get a
development shell, run `nix-shell`, to build the package run `nix-build --attr
package` and to build the Docker image, run `nix-build --attr dockerImage`.
I'm currently working on migrating to [nix](https://nixos.org/nix). To get a development shell, run `nix-shell`, to
build the package run `nix-build --attr package` and to build the Docker image, run `nix-build --attr dockerImage`.
## Running
Run either the binary produced by cargo, the Docker container you just built (using docker-compose) or pull the image
from [Docker Hub](https://hub.docker.com/r/vbrandl/hits-of-code)
Rename [`hoc.toml.example`](./hoc.toml.example) to `hoc.toml` or [`.env.example`](./.env.example) to `.env` and set the
correct value for `base_url`/`HOC_BASE_URL`. If you don't want to use a configuration or dotenv file, you can pass all
parameters directly via environment variables. For variable names see [`.env.example`](./.env.example).
To start a local instance of the service just run:
```
$ docker run -it --rm vbrandl/hits-of-code --help
$ HOC_BASE_URL='http://0.0.0.0:8080' ./hoc
```
When running the binary directly, you need a git binary in your `PATH`.
You can also use the Docker image:
```
$ docker run -p 8080:8080 --env HOC_BASE_URL='http://0.0.0.0:8080' -it --rm vbrandl/hits-of-code
```
When running the binary directly, you need a `git` binary in your `PATH`.
## License

View File

@ -2,11 +2,11 @@ extern crate ructe;
extern crate vergen;
use ructe::Ructe;
use vergen::{generate_cargo_keys, ConstantsFlags};
use vergen::{gen, ConstantsFlags};
fn main() {
let flags = ConstantsFlags::SHA_SHORT;
generate_cargo_keys(flags).expect("Unable to generate the cargo keys!");
gen(flags).expect("Unable to generate the cargo keys!");
Ructe::from_env()
.expect("ructe")
.compile_templates("templates")

View File

@ -1,4 +1,4 @@
version: "2"
version: "3"
services:
hoc:
@ -9,3 +9,5 @@ services:
# ports:
# - "127.0.0.1:8080:8080"
restart: always
env_file:
- ./.env

15
hoc.toml.example Normal file
View File

@ -0,0 +1,15 @@
# every parameter can also be set (or overwritten) by passing an environment
# variable namend `HOC_<PARAMETERNAME>`, e.g.
# `HOC_BASE_URL='https://hitsofcode.com' ./hoc`
# these config parameters have default values and must not explicitly be set
repodir = "./repos"
cachedir = "./cache"
port = 8080
host = "0.0.0.0"
workers = 4
# these parameters don't have default values and must be set
# this should be the public base URL of the service, e.g. `https://hitsofcode.com`
base_url = "http://0.0.0.0:8080"

View File

@ -1,41 +1,41 @@
use config::{Config, ConfigError, Environment, File};
use std::path::PathBuf;
use structopt::StructOpt;
#[derive(StructOpt, Debug)]
pub(crate) struct Opt {
#[structopt(
short = "o",
long = "outdir",
parse(from_os_str),
default_value = "./repos"
)]
#[derive(Debug, Deserialize)]
pub struct Settings {
/// Path to store cloned repositories
pub(crate) outdir: PathBuf,
#[structopt(
short = "c",
long = "cachedir",
parse(from_os_str),
default_value = "./cache"
)]
pub repodir: PathBuf,
/// Path to store cache
pub(crate) cachedir: PathBuf,
#[structopt(short = "p", long = "port", default_value = "8080")]
pub cachedir: PathBuf,
/// Port to listen on
pub(crate) port: u16,
#[structopt(short = "h", long = "host", default_value = "0.0.0.0")]
pub port: u16,
/// Interface to listen on
pub(crate) host: String,
#[structopt(short = "d", long = "domain", default_value = "hitsofcode.com")]
/// Interface to listen on
pub(crate) domain: String,
#[structopt(short = "w", long = "workers", default_value = "4")]
pub host: String,
/// Base URL
pub base_url: String,
/// Number of worker threads
pub(crate) workers: usize,
pub workers: usize,
}
pub(crate) fn init() {
dotenv::dotenv().ok();
std::env::set_var("RUST_LOG", "actix_web=info,hoc=info");
openssl_probe::init_ssl_cert_env_vars();
tracing_subscriber::fmt().init();
}
impl Settings {
pub fn new() -> Result<Self, ConfigError> {
let mut config = Config::new();
config
.merge(File::with_name("hoc.toml").required(false))?
.merge(Environment::with_prefix("hoc"))?
.set_default("repodir", "./repos")?
.set_default("cachedir", "./cache")?
.set_default("workers", 4)?
.set_default("port", 8080)?
.set_default("host", "0.0.0.0")?;
config.try_into()
}
}

View File

@ -215,7 +215,7 @@ where
Ok(HttpResponse::TemporaryRedirect()
.header(
LOCATION,
format!("/view/{}/{}/{}", T::url_path(), data.0, data.1),
format!("/{}/{}/{}/view", T::url_path(), data.0, data.1),
)
.finish())
};
@ -300,11 +300,25 @@ pub(crate) async fn json_hoc<T: Service>(
handle_hoc_request::<T, _>(state, data, branch, mapper).await
}
fn no_cache_response(body: Vec<u8>) -> HttpResponse {
let expiration = SystemTime::now() + Duration::from_secs(30);
HttpResponse::Ok()
.content_type("image/svg+xml")
.set(Expires(expiration.into()))
.set(CacheControl(vec![
CacheDirective::MaxAge(0u32),
CacheDirective::MustRevalidate,
CacheDirective::NoCache,
CacheDirective::NoStore,
]))
.body(body)
}
pub(crate) async fn calculate_hoc<T: Service>(
state: web::Data<Arc<State>>,
data: web::Path<(String, String)>,
branch: web::Query<BranchQuery>,
) -> Result<HttpResponse> {
) -> HttpResponse {
let mapper = move |r| match r {
HocResult::NotFound => p404(),
HocResult::Hoc { hoc_pretty, .. } => {
@ -317,21 +331,23 @@ pub(crate) async fn calculate_hoc<T: Service>(
// TODO: remove clone
let body = badge.to_svg().as_bytes().to_vec();
let expiration = SystemTime::now() + Duration::from_secs(30);
Ok(HttpResponse::Ok()
.content_type("image/svg+xml")
.set(Expires(expiration.into()))
.set(CacheControl(vec![
CacheDirective::MaxAge(0u32),
CacheDirective::MustRevalidate,
CacheDirective::NoCache,
CacheDirective::NoStore,
]))
.body(body))
Ok(no_cache_response(body))
}
};
let branch = branch.branch.as_deref().unwrap_or("master");
handle_hoc_request::<T, _>(state, data, branch, mapper).await
let error_badge = |_| {
let error_badge = Badge::new(BadgeOptions {
subject: "Hits-of-Code".to_string(),
color: "#ff0000".to_string(),
status: "error".to_string(),
})
.unwrap();
let body = error_badge.to_svg().as_bytes().to_vec();
no_cache_response(body)
};
handle_hoc_request::<T, _>(state, data, branch, mapper)
.await
.unwrap_or_else(error_badge)
}
async fn overview<T: Service>(
@ -355,7 +371,7 @@ async fn overview<T: Service>(
let repo_info = RepoInfo {
commit_url: &T::commit_url(&repo, &head),
commits,
domain: &OPT.domain,
base_url: &OPT.base_url,
head: &head,
hoc,
hoc_pretty: &hoc_pretty,
@ -383,7 +399,7 @@ async fn index() -> Result<HttpResponse> {
&mut buf,
VERSION_INFO,
REPO_COUNT.load(Ordering::Relaxed),
&OPT.domain,
&OPT.base_url,
)?;
Ok(HttpResponse::Ok().content_type("text/html").body(buf))
}
@ -396,7 +412,7 @@ async fn generate(params: web::Form<GeneratorForm<'_>>) -> Result<HttpResponse>
&mut buf,
VERSION_INFO,
REPO_COUNT.load(Ordering::Relaxed),
&OPT.domain,
&OPT.base_url,
params.service.url(),
params.service.service(),
&repo,
@ -426,7 +442,7 @@ fn favicon32() -> HttpResponse {
async fn start_server() -> std::io::Result<()> {
let interface = format!("{}:{}", OPT.host, OPT.port);
let state = Arc::new(State {
repos: OPT.outdir.display().to_string(),
repos: OPT.repodir.display().to_string(),
cache: OPT.cachedir.display().to_string(),
});
HttpServer::new(move || {
@ -459,6 +475,9 @@ async fn start_server() -> std::io::Result<()> {
.service(web::resource("/view/github/{user}/{repo}").to(overview::<GitHub>))
.service(web::resource("/view/gitlab/{user}/{repo}").to(overview::<Gitlab>))
.service(web::resource("/view/bitbucket/{user}/{repo}").to(overview::<Bitbucket>))
.service(web::resource("/github/{user}/{repo}/view").to(overview::<GitHub>))
.service(web::resource("/gitlab/{user}/{repo}/view").to(overview::<Gitlab>))
.service(web::resource("/bitbucket/{user}/{repo}/view").to(overview::<Bitbucket>))
.default_service(web::resource("").route(web::get().to(async_p404)))
})
.workers(OPT.workers)

View File

@ -1,6 +1,5 @@
use crate::{config::Opt, count::count_repositories};
use crate::{config::Settings, count::count_repositories};
use std::sync::atomic::AtomicUsize;
use structopt::StructOpt;
pub struct VersionInfo<'a> {
pub commit: &'a str,
@ -8,7 +7,7 @@ pub struct VersionInfo<'a> {
}
pub(crate) const VERSION_INFO: VersionInfo = VersionInfo {
commit: env!("VERGEN_SHA_SHORT"),
commit: env!("VERGEN_GIT_SHA_SHORT"),
version: env!("CARGO_PKG_VERSION"),
};
pub(crate) const CSS: &str = include_str!("../static/tacit-css.min.css");
@ -16,7 +15,7 @@ pub(crate) const FAVICON: &[u8] = include_bytes!("../static/favicon32.png");
lazy_static! {
pub(crate) static ref CLIENT: reqwest::Client = reqwest::Client::new();
pub(crate) static ref OPT: Opt = Opt::from_args();
pub(crate) static ref OPT: Settings = Settings::new().unwrap();
pub(crate) static ref REPO_COUNT: AtomicUsize =
AtomicUsize::new(count_repositories(&OPT.outdir).unwrap());
AtomicUsize::new(count_repositories(&OPT.repodir).unwrap());
}

View File

@ -1,7 +1,7 @@
pub struct RepoInfo<'a> {
pub commit_url: &'a str,
pub commits: u64,
pub domain: &'a str,
pub base_url: &'a str,
pub head: &'a str,
pub hoc: u64,
pub hoc_pretty: &'a str,

View File

@ -37,7 +37,9 @@ macro_rules! test_service {
#[actix_rt::test]
async fn test_index() {
let mut app = test::init_service(App::new().service(index)).await;
std::env::set_var("HOC_BASE_URL", "http://0.0.0.0:8080");
let mut app = test_app!(index);
let req = dbg!(test::TestRequest::with_uri("/").to_request());
let resp = dbg!(test::call_service(&mut app, req).await);

View File

@ -1,7 +1,7 @@
@use super::base;
@use crate::statics::VersionInfo;
@(version_info: VersionInfo, repo_count: usize, domain: &str, url: &str, service: &str, path: &str)
@(version_info: VersionInfo, repo_count: usize, base_url: &str, url: &str, service: &str, path: &str)
@:base("Hits-of-Code Badges", "Badge Generator", {
@ -10,7 +10,7 @@ Here is the markdown for the badge for <a href="https://@url/@path">@url/@path</
</p>
<pre>
[![Hits-of-Code](https://@domain/@service/@path)](https://@domain/view/@service/@path)
[![Hits-of-Code](@base_url/@service/@path)](@base_url/@service/@path/view)
</pre>
<p>
@ -18,6 +18,6 @@ It will be rendered like this
</p>
<pre>
<a href="https://@domain/view/@service/@path"><img src="https://@domain/@service/@path" alt="example badge" /></a>
<a href="@base_url/@service/@path/view"><img src="@base_url/@service/@path" alt="example badge" /></a>
</pre>
}, version_info, repo_count)

View File

@ -1,7 +1,7 @@
@use super::base;
@use crate::statics::VersionInfo;
@(version_info: VersionInfo, repo_count: usize, domain: &str)
@(version_info: VersionInfo, repo_count: usize, base_url: &str)
@:base("Hits-of-Code Badges", "Hits-of-Code Badges", {
@ -24,7 +24,7 @@ used for GitHub, GitLab and Bitbucket repositories. Just put the following code
</p>
<pre>
[![Hits-of-Code](https://@domain/&lt;service&gt;/&lt;user&gt;/&lt;repo&gt;)](https://@domain/view/&lt;service&gt;/&lt;user&gt;/&lt;repo&gt;)
[![Hits-of-Code](@base_url/&lt;service&gt;/&lt;user&gt;/&lt;repo&gt;)](@base_url/&lt;service&gt;/&lt;user&gt;/&lt;repo&gt;/view)
</pre>
<p>
@ -33,7 +33,7 @@ following Markdown
</p>
<pre>
[![Hits-of-Code](https://@domain/github/vbrandl/hoc)](https://@domain/view/github/vbrandl/hoc)
[![Hits-of-Code](@base_url/github/vbrandl/hoc)](@base_url/github/vbrandl/hoc/view)
</pre>
<p>
@ -41,7 +41,7 @@ would render this badge:
</p>
<pre>
<a href="https://@domain/view/github/vbrandl/hoc"><img src="https://@domain/github/vbrandl/hoc"
<a href="@base_url/github/vbrandl/hoc/view"><img src="@base_url/github/vbrandl/hoc"
alt="example badge" /></a>
</pre>
@ -55,7 +55,7 @@ in your repository or you want a badge for another branch of your repository, ju
You can also request the HoC as JSON by appending <code>/json</code> to the request path. This will return a JSON object
with three fields: <code>count</code> (the HoC value), <code>commits</code> (the number of commits) and
<code>head</code> (the commit ref of HEAD). Requesting <a
href="https://@domain/github/vbrandl/hoc/json">https://@domain/github/vbrandl/hoc/json</a> might return something along
href="@base_url/github/vbrandl/hoc/json">@base_url/github/vbrandl/hoc/json</a> might return something along
the lines of
</p>

View File

@ -19,7 +19,7 @@ To include the badge in your readme, use the following markdown:
</p>
<pre>
[![Hits-of-Code](https://@repo_info.domain/@repo_info.path?branch=@repo_info.branch)](https://@repo_info.domain/view/@repo_info.path?branch=@repo_info.branch)
[![Hits-of-Code](@repo_info.base_url/@repo_info.path?branch=@repo_info.branch)](@repo_info.base_url/@repo_info.path?branch=@repo_info.branch/view?branch=@repo_info.branch)
</pre>