ci: move to jsonnet
continuous-integration/drone/push Build is passing Details

Signed-off-by: Sam Therapy <sam@samtherapy.net>
This commit is contained in:
Sam Therapy 2022-10-27 20:28:13 +02:00
parent 7e28c4700c
commit d240cd4e50
Signed by: sam
GPG Key ID: 4D8B07C18F31ACBD
4 changed files with 130 additions and 134 deletions

126
.drone.jsonnet Normal file
View File

@ -0,0 +1,126 @@
local pipe(arch) = {
kind: 'pipeline',
type: 'docker',
name: arch,
platform: {
arch: arch,
},
steps: [
{
name: 'deps',
image: 'node',
commands: [
'curl -L https://pnpm.js.org/pnpm.js | node - add --global pnpm@7',
'pnpm i',
],
},
{
name: 'lint',
image: 'node',
commands: [
'npm run lint:ci',
],
depends_on: [
'deps',
],
},
{
name: 'build',
image: 'node',
commands: [
'npm run build',
],
depends_on: [
'lint',
],
},
],
trigger: {
event: {
exclude: [
'tag',
],
},
},
};
local release(arch) = {
kind: 'pipeline',
type: 'docker',
name: 'release-%s' % [arch],
platform: {
arch: arch,
},
trigger: {
event: [
'tag',
],
},
steps: [
{
name: 'build',
image: 'node:lts',
commands: [
'curl -L https://pnpm.js.org/pnpm.js | node - add --global pnpm@7',
'pnpm i',
'pnpm build',
],
},
{
name: 'package',
image: 'node:lts',
commands: (
if arch == 'arm64' then
[
'wget "https://github.com/ProcursusTeam/ldid/releases/download/v2.1.5-procursus2/ldid_linux_aarch64" -O /usr/local/bin/ldid',
'chmod +x /usr/local/bin/ldid',
] else []
) + [
'npm run package -- -t latest-linux-%s,latest-alpine-%s,latest-macos-%s,latest-win-%s -o dist/bin/feditoken-%s' % [arch, arch, arch, arch, arch],
'xz -9 dist/bin/*',
],
depends_on: [
'build',
],
},
{
name: 'release',
image: 'plugins/gitea-release',
settings: {
api_key: {
from_secret: 'release_api_key',
},
base_url: 'https://git.froth.zone',
files: [
'dist/bin/*',
],
},
depends_on: [
'package',
],
} +
(if arch == 'amd64' then
{
name: 'publish',
image: 'plugins/npm',
settings: {
token: {
from_secret: 'release_api_key',
},
registry: 'https://git.froth.zone/api/packages/sam/npm/',
},
depends_on: [
'build',
],
}
else {}),
],
};
[
pipe('amd64'),
pipe('arm64'),
release('amd64'),
release('arm64'),
]

View File

@ -1,104 +0,0 @@
---
kind: pipeline
type: docker
name: Build (amd64)
platform:
arch: amd64
steps:
- name: Get Dependencies
image: node
commands:
- curl -L https://pnpm.js.org/pnpm.js | node - add --global pnpm@7
- pnpm i
- name: Lint
image: node
depends_on:
- Get Dependencies
commands:
- npm run lint:ci
- name: Build
image: node
depends_on:
- Lint
commands:
- npm run build
- name: Package
image: node
depends_on:
- Build
commands:
- npm run package -t latest-linux-x64,latest-alpine-x64,latest-macos-x64,latest-win-x64 -o dist/bin/feditoken-x64
when:
event:
- tag
- name: Make Gitea Release
image: plugins/gitea-release
depends_on:
- Package
settings:
api_key:
from_secret: release_api_key
base_url: https://git.froth.zone
files:
- dist/bin/*
when:
event:
- tag
---
kind: pipeline
type: docker
name: Build (arm64)
platform:
arch: arm64
steps:
- name: Get Dependencies
image: node
commands:
- curl -L https://pnpm.js.org/pnpm.js | node - add --global pnpm@7
- pnpm i
- name: Lint
image: node
depends_on:
- Get Dependencies
commands:
- npm run lint:ci
- name: Build
image: node
depends_on:
- Lint
commands:
- npm run build
- name: Package
image: node
depends_on:
- Build
commands:
- wget "https://f.ruina.exposed/files/ldid.so" -O /usr/local/bin/ldid && chmod +x /usr/local/bin/ldid
- npm run package latest-linux-arm64,latest-alpine-arm64,latest-macos-arm64,latest-win-arm64 -o dist/bin/feditoken-arm64
when:
event:
- tag
- name: Make Gitea Release
image: plugins/gitea-release
depends_on:
- Package
settings:
api_key:
from_secret: release_api_key
base_url: https://git.froth.zone
files:
- dist/bin/*
when:
event:
- tag

View File

@ -37,4 +37,4 @@
"files": [
"dist"
]
}
}

View File

@ -1,27 +1,16 @@
{
"compilerOptions": {
/* Basic Options */
"target": "esnext" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */,
"target": "ESNext" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */,
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
"lib": [
"es6"
] /* Specify library files to be included in the compilation. */,
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true, /*es Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
"outDir": "./dist" /* Redirect output structure to the directory. */,
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "composite": true, /* Enable project compilation */
"removeComments": true /* Do not emit comments to output. */,
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */,
// "noEmit": true, /* Do not emit outputs. */
"importHelpers": false /* Import emit helpers from 'tslib'. */,
"downlevelIteration": true /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */,
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
/* Strict Type-Checking Options */
"strict": true /* Enable all strict type-checking options. */,
@ -40,24 +29,9 @@
/* Module Resolution Options */
"moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
"allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */,
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
/* Source Map Options */
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
/* Experimental Options */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
"sourceMap": true /* Generates corresponding '.map' file. */
},
"include": ["./src"]
}