feat(ci): Add Gitea workflows for build and release.

This commit is contained in:
Philipp Kunz 2024-10-27 19:11:55 +01:00
parent 61a82f0d03
commit 8f4292f402
12 changed files with 870 additions and 958 deletions

View File

@ -0,0 +1,66 @@
name: Default (not tags)
on:
push:
tags-ignore:
- '**'
env:
IMAGE: code.foss.global/hosttoday/ht-docker-node:npmci
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@/${{gitea.repository}}.git
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
jobs:
security:
runs-on: ubuntu-latest
continue-on-error: true
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Install pnpm and npmci
run: |
pnpm install -g pnpm
pnpm install -g @ship.zone/npmci
- name: Run npm prepare
run: npmci npm prepare
- name: Audit production dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --prod
continue-on-error: true
- name: Audit development dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --dev
continue-on-error: true
test:
if: ${{ always() }}
needs: security
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Test stable
run: |
npmci node install stable
npmci npm install
npmci npm test
- name: Test build
run: |
npmci node install stable
npmci npm install
npmci npm build

View File

@ -0,0 +1,124 @@
name: Default (tags)
on:
push:
tags:
- '*'
env:
IMAGE: code.foss.global/hosttoday/ht-docker-node:npmci
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@/${{gitea.repository}}.git
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
jobs:
security:
runs-on: ubuntu-latest
continue-on-error: true
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @ship.zone/npmci
npmci npm prepare
- name: Audit production dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --prod
continue-on-error: true
- name: Audit development dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --dev
continue-on-error: true
test:
if: ${{ always() }}
needs: security
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @ship.zone/npmci
npmci npm prepare
- name: Test stable
run: |
npmci node install stable
npmci npm install
npmci npm test
- name: Test build
run: |
npmci node install stable
npmci npm install
npmci npm build
release:
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @ship.zone/npmci
npmci npm prepare
- name: Release
run: |
npmci node install stable
npmci npm publish
metadata:
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
continue-on-error: true
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @ship.zone/npmci
npmci npm prepare
- name: Code quality
run: |
npmci command npm install -g typescript
npmci npm install
- name: Trigger
run: npmci trigger
- name: Build docs and upload artifacts
run: |
npmci node install stable
npmci npm install
pnpm install -g @git.zone/tsdoc
npmci command tsdoc
continue-on-error: true

View File

@ -1,5 +1,13 @@
# Changelog # Changelog
## 2024-10-27 - 1.3.0 - feat(ci)
Add Gitea workflows for build and release.
- Added .gitea/workflows/default_nottags.yaml for non-tag events.
- Added .gitea/workflows/default_tags.yaml for tag-based events.
- Updated build scripts in package.json to use pnpm.
- Refactored imports and exports in TypeScript source for better modularity.
## 2024-06-24 - 1.2.49 - fix(core) ## 2024-06-24 - 1.2.49 - fix(core)
Minor maintenance updates with version bump Minor maintenance updates with version bump

View File

@ -11,9 +11,9 @@
"tsrun": "./cli.js" "tsrun": "./cli.js"
}, },
"scripts": { "scripts": {
"test": "(tsbuild && node ./cli.js test/test.js sayhello)", "test": "(pnpm run build && node ./cli.js test/test.js sayhello)",
"format": "(gitzone format)", "format": "(gitzone format)",
"build": "(tsbuild)", "build": "(tsbuild --web --allowimplicitany)",
"buildDocs": "tsdoc" "buildDocs": "tsdoc"
}, },
"devDependencies": { "devDependencies": {
@ -43,5 +43,13 @@
], ],
"browserslist": [ "browserslist": [
"last 1 chrome versions" "last 1 chrome versions"
] ],
} "repository": {
"type": "git",
"url": "git+https://gitlab.com/gitzone/tsrun.git"
},
"bugs": {
"url": "https://gitlab.com/gitzone/tsrun/issues"
},
"homepage": "https://gitlab.com/gitzone/tsrun#readme"
}

1553
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -1,26 +1,28 @@
# @gitzone/tsrun # @gitzone/tsrun
run typescript programs efficiently run typescript programs efficiently
## Availabililty and Links ## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@gitzone/tsrun)
* [gitlab.com (source)](https://gitlab.com/gitzone/tsrun) - [npmjs.org (npm package)](https://www.npmjs.com/package/@gitzone/tsrun)
* [github.com (source mirror)](https://github.com/gitzone/tsrun) - [gitlab.com (source)](https://gitlab.com/gitzone/tsrun)
* [docs (typedoc)](https://gitzone.gitlab.io/tsrun/) - [github.com (source mirror)](https://github.com/gitzone/tsrun)
- [docs (typedoc)](https://gitzone.gitlab.io/tsrun/)
## Status for master ## Status for master
Status Category | Status Badge | Status Category | Status Badge |
-- | -- | ----------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
GitLab Pipelines | [![pipeline status](https://gitlab.com/gitzone/tsrun/badges/master/pipeline.svg)](https://lossless.cloud) | GitLab Pipelines | [![pipeline status](https://gitlab.com/gitzone/tsrun/badges/master/pipeline.svg)](https://lossless.cloud) |
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/gitzone/tsrun/badges/master/coverage.svg)](https://lossless.cloud) | GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/gitzone/tsrun/badges/master/coverage.svg)](https://lossless.cloud) |
npm | [![npm downloads per month](https://badgen.net/npm/dy/@gitzone/tsrun)](https://lossless.cloud) | npm | [![npm downloads per month](https://badgen.net/npm/dy/@gitzone/tsrun)](https://lossless.cloud) |
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/gitzone/tsrun)](https://lossless.cloud) | Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/gitzone/tsrun)](https://lossless.cloud) |
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud) | TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud) |
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) | node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) |
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud) | Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud) |
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@gitzone/tsrun)](https://lossless.cloud) | PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@gitzone/tsrun)](https://lossless.cloud) |
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@gitzone/tsrun)](https://lossless.cloud) | PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@gitzone/tsrun)](https://lossless.cloud) |
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@gitzone/tsrun)](https://lossless.cloud) | BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@gitzone/tsrun)](https://lossless.cloud) |
## Usage ## Usage
@ -43,5 +45,6 @@ We are always happy for code contributions. If you are not the code contributing
For further information read the linked docs at the top of this readme. For further information read the linked docs at the top of this readme.
## Legal ## Legal
> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc) > MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy) > | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@git.zone/tsrun', name: '@git.zone/tsrun',
version: '1.2.49', version: '1.3.0',
description: 'run typescript programs efficiently' description: 'run typescript programs efficiently'
} }

View File

@ -37,6 +37,6 @@ export const runCli = async (pathArg?: string) => {
return prevArg + ' ' + currentArg; return prevArg + ' ' + currentArg;
}) })
: '' : ''
}` }`,
); );
}; };

View File

@ -1,3 +1,4 @@
import * as paths from './paths.js';
import * as plugins from './plugins.js'; import * as plugins from './plugins.js';
import type { CompilerOptions } from 'typescript'; import type { CompilerOptions } from 'typescript';
@ -12,6 +13,8 @@ const defaultTsNodeOptions: plugins.tsNode.CreateOptions = {
moduleResolution: <any>'nodenext', moduleResolution: <any>'nodenext',
module: <any>'nodenext', module: <any>'nodenext',
verbatimModuleSyntax: true, verbatimModuleSyntax: true,
paths: plugins.smartfile.fs.toObjectSync(plugins.path.join(paths.cwd, 'tsconfig.json'))
?.compilerOptions?.paths,
} as CompilerOptions, } as CompilerOptions,
esm: true, esm: true,
skipIgnore: true, skipIgnore: true,
@ -19,5 +22,5 @@ const defaultTsNodeOptions: plugins.tsNode.CreateOptions = {
}; };
export const { resolve, load, getFormat, transformSource } = plugins.tsNode.createEsmHooks( export const { resolve, load, getFormat, transformSource } = plugins.tsNode.createEsmHooks(
plugins.tsNode.register(defaultTsNodeOptions) plugins.tsNode.register(defaultTsNodeOptions),
) as any; ) as any;

1
ts/paths.ts Normal file
View File

@ -0,0 +1 @@
export const cwd = process.cwd();

View File

@ -5,9 +5,10 @@ import * as url from 'url';
export { path, url }; export { path, url };
// @pushrocks scope // @pushrocks scope
import * as smartfile from '@push.rocks/smartfile';
import * as smartshell from '@push.rocks/smartshell'; import * as smartshell from '@push.rocks/smartshell';
export { smartshell }; export { smartfile, smartshell };
// third party scope // third party scope
import * as tsNode from 'ts-node'; import * as tsNode from 'ts-node';

View File

@ -3,7 +3,12 @@
"experimentalDecorators": true, "experimentalDecorators": true,
"useDefineForClassFields": false, "useDefineForClassFields": false,
"target": "ES2022", "target": "ES2022",
"module": "ES2022", "module": "NodeNext",
"moduleResolution": "nodenext" "moduleResolution": "NodeNext",
} "esModuleInterop": true,
"verbatimModuleSyntax": true
},
"exclude": [
"dist_*/**/*.d.ts"
]
} }