Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tokei #43

Merged
merged 20 commits into from
Dec 10, 2024
Merged

Add tokei #43

merged 20 commits into from
Dec 10, 2024

Conversation

Jasperhino
Copy link
Collaborator

@Jasperhino Jasperhino commented Jan 24, 2024

This PR add tokei as the main analytics tool and changes the frontend metrics format from csv to json

@Jasperhino Jasperhino requested a review from scheibel January 25, 2024 12:33
Dockerfile Outdated
@@ -10,11 +10,15 @@ COPY analytics/src ./src
COPY analytics/package.json .
COPY analytics/pnpm-lock.yaml .
COPY analytics/tsconfig.json .
RUN mkdir /metrics
VOLUME ["/metrics"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is an anonymous volume beneficial here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its not for now, removed it

@@ -5,7 +5,7 @@ import RepoBreadcrumbs from "./RepoBreadcrumbs";

export default function MetricsPage() {
const { owner, repo, commitSHA, branch } = useParams();

console.log(owner, repo, commitSHA, branch);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove or comment out debugging information?

): Promise<MetricsBlob[]> {
const ref_string = `metrics/${commit_sha}`;
console.log(ref_string);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove or comment out debugging information?

tokei Outdated Show resolved Hide resolved
tokei.tar.gz Outdated Show resolved Hide resolved
frontend/src/components/Metrics.tsx Outdated Show resolved Hide resolved
Dockerfile Outdated

RUN pnpm install
RUN pnpm run build

RUN curl -vL --compressed https://github.com/XAMPPRocky/tokei/releases/download/v12.1.2/tokei-x86_64-unknown-linux-gnu.tar.gz --output tokei.tar.gz
RUN tar -xvf tokei.tar.gz
RUN ./tokei /repository --output json > /metrics/metrics.json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me, it's not clear how this run of tokei will result in a software project being analyzed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we run a checkout action before running our action we will have copied the whole repository to be analysed into our own action Docker container under /repository at build time. we then also just compute metrics into a json at build time and use this file as an artifact to upload as a blob to the git refs and decode and use in the frontend.

This is arguably not the best solution as it does not allow for caching and reusing the image built for this action. Maybe we can get around this issue by mounting a volume instead in the future.

@scheibel
Copy link
Member

Looks good to me. Nice updating of the dependencies even across major versions.

@Jasperhino Jasperhino merged commit c34bbc0 into dev Dec 10, 2024
2 checks passed
@Jasperhino Jasperhino deleted the add-tokei branch December 10, 2024 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants