Skip to content

Commit 103d42b

Browse files
committed
Change testing library and improve documentation
1 parent 4a31db5 commit 103d42b

Some content is hidden

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

45 files changed

+1483
-1201
lines changed

.envrc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1-
use flake
1+
#!/usr/bin/env bash
2+
3+
if type -P lorri &>/dev/null; then
4+
eval "$(lorri direnv)"
5+
elif type -v nix &>/dev/null; then
6+
use flake .
7+
else
8+
echo "The shell is set up via Nix, but it seems it is not installed."
9+
echo "Please setup your shell manually following README's instructions."
10+
fi

.github/dependabot.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/renovate.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": [
4+
"config:best-practices",
5+
"config:semverAllMonthly"
6+
],
7+
"nix": {
8+
"enabled": true
9+
}
10+
}

.github/workflows/ci.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

.github/workflows/quality.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
name: "Quality"
3+
4+
on:
5+
push:
6+
branches: ["main"]
7+
pull_request:
8+
branches: ["main"]
9+
workflow_call: {}
10+
workflow_dispatch: {}
11+
12+
env:
13+
GITHUB_COM_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
14+
15+
permissions:
16+
contents: "read"
17+
18+
jobs:
19+
ci:
20+
name: "Quality Checks (lint and test)"
21+
permissions:
22+
actions: "write"
23+
contents: "read"
24+
runs-on: "ubuntu-latest"
25+
timeout-minutes: 10
26+
steps:
27+
- uses: "nixbuild/nix-quick-install-action@1f095fee853b33114486cfdeae62fa099cda35a9" # v33
28+
- uses: "nix-community/cache-nix-action@135667ec418502fa5a3598af6fb9eb733888ce6a" # v6
29+
with:
30+
primary-key: "cache-nix-store-${{ runner.os }}-${{ hashFiles('flake.nix', 'flake.lock') }}"
31+
restore-prefixes-first-match: "cache-nix-store-${{ runner.os }}-"
32+
gc-max-store-size-linux: 1073741824 # 1go
33+
purge: true
34+
purge-prefixes: "cache-nix-store-${{ runner.os }}-"
35+
purge-created: 0
36+
purge-primary-key: "never"
37+
- uses: "cachix/cachix-action@0fc020193b5a1fa3ac4575aa3a7d3aa6a35435ad" # v16
38+
with:
39+
name: "krostar"
40+
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
41+
- uses: "actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8" # v5
42+
- name: "Print nix version"
43+
run: "nix --version"
44+
- name: "Print flake metadata"
45+
run: "nix flake metadata"
46+
- name: "Setup shell"
47+
run: "nix develop --command true"
48+
- name: "Just CI"
49+
run: "nix develop --command just ci"
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
name: "Scheduled Quality"
3+
4+
on:
5+
schedule:
6+
- cron: "0 4 1 * *"
7+
8+
workflow_dispatch:
9+
inputs:
10+
activity_days_threshold:
11+
description: "Days to look back for commit activity"
12+
required: false
13+
type: "number"
14+
15+
concurrency:
16+
group: "${{ github.workflow }}"
17+
cancel-in-progress: false
18+
19+
env:
20+
GITHUB_COM_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
21+
ACTIVITY_DAYS_THRESHOLD: "${{ inputs.activity_days_threshold || 30 }}"
22+
23+
permissions:
24+
contents: "read"
25+
26+
jobs:
27+
get-activity:
28+
name: "Check Repository Activity"
29+
runs-on: "ubuntu-latest"
30+
timeout-minutes: 1
31+
outputs:
32+
have-recent-commits: "${{ steps.get-activity.outputs.have-recent-commits }}"
33+
steps:
34+
- name: "Get commits activity"
35+
id: "get-activity"
36+
uses: "actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea" # v7
37+
with:
38+
script: |
39+
const daysThreshold = parseInt(process.env.ACTIVITY_DAYS_THRESHOLD);
40+
const checkDate = new Date();
41+
checkDate.setDate(checkDate.getDate() - daysThreshold);
42+
43+
const commits = await github.rest.repos.listCommits({
44+
owner: context.repo.owner,
45+
repo: context.repo.repo,
46+
since: checkDate.toISOString(),
47+
per_page: 1
48+
});
49+
50+
core.setOutput('have-recent-commits', commits.data.length != 0);
51+
52+
call-ci-workflow:
53+
name: "Call CI workflow"
54+
needs: "get-activity"
55+
if: "needs.get-activity.outputs.have-recent-commits == 'false'"
56+
uses: "./.github/workflows/quality.yml"
57+
secrets: "inherit"
58+
permissions:
59+
actions: "write"
60+
contents: "read"

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
11
/.direnv
2+
/result
3+
4+
# nixago: ignore-linked-files
5+
/.editorconfig
6+
/.idea/watcherTasks.xml
7+
/.justfile

.golangci.yml

Lines changed: 0 additions & 172 deletions
This file was deleted.

.nix/repo/data.nix

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
ci.testers.go.enable = true;
3+
ci.linters = {
4+
editorconfig-checker.settings.Exclude = ["./double/internal/*_generated*.go"];
5+
golangci-lint = {
6+
enable = true;
7+
linters = {
8+
exclusions = {
9+
paths = ["internal/example"];
10+
rules = [
11+
{
12+
path = "api.go";
13+
linters = ["gocritic"];
14+
text = "hugeParam: serverAddress is heavy";
15+
}
16+
];
17+
};
18+
};
19+
};
20+
};
21+
}

.nix/repo/devShells.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{deps, ...}: deps.synergy.result.devShells.harmony.go

0 commit comments

Comments
 (0)