From 06dd43e71ea3283abeb889e9c3707c53f4fc7928 Mon Sep 17 00:00:00 2001 From: koki-develop Date: Wed, 2 Apr 2025 20:36:43 +0900 Subject: [PATCH 1/3] chore: Install codecov/codecov-action --- .github/workflows/actions-lock.json | 1 + .github/workflows/actions.json | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/actions-lock.json b/.github/workflows/actions-lock.json index 1cafdf9..7d79d3e 100644 --- a/.github/workflows/actions-lock.json +++ b/.github/workflows/actions-lock.json @@ -2,6 +2,7 @@ "actions": { "actions/cache@v4.2.3": "5a3ec84eff668545956fd18022155c47e93e2684", "actions/checkout@v4.2.2": "11bd71901bbe5b1630ceea73d27597364c9af683", + "codecov/codecov-action@v5.4.0": "0565863a31f2c772f9f0395002a31e3f06189574", "googleapis/release-please-action@v4.2.0": "a02a34c4d625f9be7cb89156071d8567266a2445", "jdx/mise-action@v2.1.11": "5083fe46898c414b2475087cc79da59e7da859e8", "koki-develop/github-actions-lint/actionlint@v1.1.0": "cd40a2834e54895146e4a73ae17dcc37944ffb0f", diff --git a/.github/workflows/actions.json b/.github/workflows/actions.json index 016d9da..699305b 100644 --- a/.github/workflows/actions.json +++ b/.github/workflows/actions.json @@ -1,6 +1,7 @@ { "actions/cache": "v4.2.3", "actions/checkout": "v4.2.2", + "codecov/codecov-action": "v5.4.0", "googleapis/release-please-action": "v4.2.0", "jdx/mise-action": "v2.1.11", "koki-develop/github-actions-lint/actionlint": "v1.1.0", From abad1f8611b8faf11e26cc164f5c120b63cbe864 Mon Sep 17 00:00:00 2001 From: koki-develop Date: Wed, 2 Apr 2025 20:40:39 +0900 Subject: [PATCH 2/3] chore: Use codecov/codecov-action --- .github/workflows/ci.ts | 15 +++++++++++++-- .github/workflows/ci.yml | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.ts b/.github/workflows/ci.ts index 7e1b83e..27e0754 100644 --- a/.github/workflows/ci.ts +++ b/.github/workflows/ci.ts @@ -1,4 +1,4 @@ -import { Workflow } from "ghats"; +import { action, Workflow } from "ghats"; import { setupJob } from "./_helpers"; const workflow = new Workflow("CI", { @@ -14,7 +14,18 @@ workflow.addJob( permissions: { contents: "read" }, timeoutMinutes: 5, withBun: true, - }).run("bun test"), + }) + .run("bun test --coverage --coverage-reporter=lcov") + .uses( + action("codecov/codecov-action", { + with: { + token: "${{ secrets.CODECOV_TOKEN }}", + files: "coverage/lcov.info", + disable_search: "true", + verbose: "true", + }, + }), + ), ); workflow.addJob( diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f59ad30..b6df41f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ # DO NOT EDIT THIS FILE # This file is automatically generated by ghats (https://www.npmjs.com/package/ghats) # Edit the workflow in .github/workflows/ci.ts instead, and run `ghats build` to update this file. -{"name":"CI","on":{"pull_request":{"branches":["main"]},"push":{"branches":["main"]}},"permissions":{},"jobs":{"test":{"runs-on":"ubuntu-latest","permissions":{"contents":"read"},"timeout-minutes":5,"steps":[{"with":{"persist-credentials":"false"},"uses":"actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"},{"uses":"jdx/mise-action@5083fe46898c414b2475087cc79da59e7da859e8"},{"with":{"path":"~/.bun/install/cache","key":"${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}","restore-keys":"${{ runner.os }}-bun-"},"uses":"actions/cache@5a3ec84eff668545956fd18022155c47e93e2684"},{"run":"bun install --frozen-lockfile"},{"run":"bun test"}]},"build-workflow":{"runs-on":"ubuntu-latest","permissions":{"contents":"read"},"timeout-minutes":5,"steps":[{"with":{"persist-credentials":"false"},"uses":"actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"},{"uses":"jdx/mise-action@5083fe46898c414b2475087cc79da59e7da859e8"},{"with":{"path":"~/.bun/install/cache","key":"${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}","restore-keys":"${{ runner.os }}-bun-"},"uses":"actions/cache@5a3ec84eff668545956fd18022155c47e93e2684"},{"run":"bun install --frozen-lockfile"},{"run":"\ncat < ./.github/workflows/example.ts\nimport { Workflow, Job } from \"ghats\";\n\nconst workflow = new Workflow(\"Hello\", {\n on: \"push\",\n});\n\nworkflow.addJob(\n new Job(\"hello\", {\n runsOn: \"ubuntu-latest\",\n })\n .uses(\"actions/checkout@v4\")\n .run(\"echo 'Hello, world!'\"),\n);\n\nexport default workflow;\nEOF\n"},{"run":"bun run ./lib/cli/index.ts build ./.github/workflows/example.ts"},{"run":"cat ./.github/workflows/example.yml"}]}}} \ No newline at end of file +{"name":"CI","on":{"pull_request":{"branches":["main"]},"push":{"branches":["main"]}},"permissions":{},"jobs":{"test":{"runs-on":"ubuntu-latest","permissions":{"contents":"read"},"timeout-minutes":5,"steps":[{"with":{"persist-credentials":"false"},"uses":"actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"},{"uses":"jdx/mise-action@5083fe46898c414b2475087cc79da59e7da859e8"},{"with":{"path":"~/.bun/install/cache","key":"${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}","restore-keys":"${{ runner.os }}-bun-"},"uses":"actions/cache@5a3ec84eff668545956fd18022155c47e93e2684"},{"run":"bun install --frozen-lockfile"},{"run":"bun test --coverage --coverage-reporter=lcov"},{"with":{"token":"${{ secrets.CODECOV_TOKEN }}","files":"coverage/lcov.info","disable_search":"true","verbose":"true"},"uses":"codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574"}]},"build-workflow":{"runs-on":"ubuntu-latest","permissions":{"contents":"read"},"timeout-minutes":5,"steps":[{"with":{"persist-credentials":"false"},"uses":"actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"},{"uses":"jdx/mise-action@5083fe46898c414b2475087cc79da59e7da859e8"},{"with":{"path":"~/.bun/install/cache","key":"${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}","restore-keys":"${{ runner.os }}-bun-"},"uses":"actions/cache@5a3ec84eff668545956fd18022155c47e93e2684"},{"run":"bun install --frozen-lockfile"},{"run":"\ncat < ./.github/workflows/example.ts\nimport { Workflow, Job } from \"ghats\";\n\nconst workflow = new Workflow(\"Hello\", {\n on: \"push\",\n});\n\nworkflow.addJob(\n new Job(\"hello\", {\n runsOn: \"ubuntu-latest\",\n })\n .uses(\"actions/checkout@v4\")\n .run(\"echo 'Hello, world!'\"),\n);\n\nexport default workflow;\nEOF\n"},{"run":"bun run ./lib/cli/index.ts build ./.github/workflows/example.ts"},{"run":"cat ./.github/workflows/example.yml"}]}}} \ No newline at end of file From a65482166323a7463ce34bb4f9b98f606fee9442 Mon Sep 17 00:00:00 2001 From: koki-develop Date: Wed, 2 Apr 2025 20:44:18 +0900 Subject: [PATCH 3/3] chore: Add codecov badge to readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index fd9d654..03bb672 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # GitHub Actions with TypeScript [![NPM Version](https://img.shields.io/npm/v/ghats)](https://www.npmjs.com/package/ghats) +[![codecov](https://codecov.io/gh/koki-develop/ghats/graph/badge.svg?token=M38AAFPXC1)](https://codecov.io/gh/koki-develop/ghats) [![GitHub License](https://img.shields.io/github/license/koki-develop/ghats)](./LICENSE) ```ts