From 3f50917d98e5c9160fb5d7a1c8bbe9f6ab3e560c Mon Sep 17 00:00:00 2001 From: sinclairzx81 Date: Wed, 5 Jul 2023 00:09:03 +0900 Subject: [PATCH] Scheduled Nightly Builds (#488) --- .github/workflows/{ci.yml => build.yml} | 8 ++--- .github/workflows/nightly.yml | 30 +++++++++++++++++ hammer.mjs | 44 ++++++++++++------------- package-lock.json | 4 +-- readme.md | 4 +-- 5 files changed, 60 insertions(+), 30 deletions(-) rename .github/workflows/{ci.yml => build.yml} (90%) create mode 100644 .github/workflows/nightly.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/build.yml similarity index 90% rename from .github/workflows/ci.yml rename to .github/workflows/build.yml index b1192b3..e482eb7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/build.yml @@ -1,7 +1,5 @@ -name: GitHub CI - +name: Build on: [push, pull_request] - jobs: TypeBox: runs-on: ${{ matrix.os }} @@ -12,11 +10,13 @@ jobs: steps: - uses: actions/checkout@v2 - name: Install Node - uses: actions/setup-node@v1 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} + - name: Install Packages run: npm install + - name: Build Library run: npm run build - name: Test Library diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 0000000..7ad6b9d --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,30 @@ +name: Build Nightly +on: + schedule: + - cron: '0 18 * * *' # 6pm Daily +jobs: + TypeBox: + runs-on: ${{ matrix.os }} + strategy: + matrix: + node: [20.x] + os: [ubuntu-latest] + steps: + - uses: actions/checkout@v2 + - name: Install Node + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node }} + + - name: Install Packages + run: npm install + + - name: Install TypeScript Latest + run: npm install typescript@latest + - name: Build TypeBox + run: npm run build + + - name: Install TypeScript Next + run: npm install typescript@next + - name: Build TypeBox + run: npm run build \ No newline at end of file diff --git a/hammer.mjs b/hammer.mjs index e47b88f..a6bca8b 100644 --- a/hammer.mjs +++ b/hammer.mjs @@ -5,59 +5,59 @@ import { readFileSync } from 'fs' // Clean // ------------------------------------------------------------------------------- export async function clean() { - await folder('target').delete() + await folder('target').delete() } // ------------------------------------------------------------------------------- // Format // ------------------------------------------------------------------------------- export async function format() { - await shell('prettier --no-semi --single-quote --print-width 240 --trailing-comma all --write src test example/index.ts benchmark') + await shell('prettier --no-semi --single-quote --print-width 240 --trailing-comma all --write src test example/index.ts benchmark') } // ------------------------------------------------------------------------------- // Start // ------------------------------------------------------------------------------- export async function start(example = 'index') { - await shell(`hammer run example/${example}.ts --dist target/example/${example}`) + await shell(`hammer run example/${example}.ts --dist target/example/${example}`) } // ------------------------------------------------------------------------------- // Benchmark // ------------------------------------------------------------------------------- export async function benchmark() { - await compression() - await measurement() + await compression() + await measurement() } // ------------------------------------------------------------------------------- // Test // ------------------------------------------------------------------------------- export async function test_static() { - await shell(`tsc -p test/static/tsconfig.json --noEmit --strict`) + await shell(`tsc -p test/static/tsconfig.json --noEmit --strict`) } -export async function test_runtime(filter) { - await shell(`hammer build ./test/runtime/index.ts --dist target/test/runtime --platform node`) - await shell(`mocha target/test/runtime/index.js -g "${filter}"`) +export async function test_runtime(filter = '') { + await shell(`hammer build ./test/runtime/index.ts --dist target/test/runtime --platform node`) + await shell(`mocha target/test/runtime/index.js -g "${filter}"`) } export async function test(filter = '') { - await test_static() - await test_runtime(filter) + await test_static() + await test_runtime(filter) } // ------------------------------------------------------------------------------- // Build // ------------------------------------------------------------------------------- export async function build(target = 'target/build') { - await test() - await folder(target).delete() - await shell(`tsc -p ./src/tsconfig.json --outDir ${target}`) - await folder(target).add('package.json') - await folder(target).add('readme.md') - await folder(target).add('license') - await shell(`cd ${target} && npm pack`) + await test() + await folder(target).delete() + await shell(`tsc -p ./src/tsconfig.json --outDir ${target}`) + await folder(target).add('package.json') + await folder(target).add('readme.md') + await folder(target).add('license') + await shell(`cd ${target} && npm pack`) } // ------------------------------------------------------------- // Publish // ------------------------------------------------------------- export async function publish(otp, target = 'target/build') { - const { version } = JSON.parse(readFileSync('package.json', 'utf8')) - await shell(`cd ${target} && npm publish sinclair-typebox-${version}.tgz --access=public --otp ${otp}`) - await shell(`git tag ${version}`) - await shell(`git push origin ${version}`) + const { version } = JSON.parse(readFileSync('package.json', 'utf8')) + await shell(`cd ${target} && npm publish sinclair-typebox-${version}.tgz --access=public --otp ${otp}`) + await shell(`git tag ${version}`) + await shell(`git push origin ${version}`) } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 3cb6da9..31f90d3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@sinclair/typebox", - "version": "0.29.1", + "version": "0.29.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@sinclair/typebox", - "version": "0.29.1", + "version": "0.29.3", "license": "MIT", "devDependencies": { "@sinclair/hammer": "^0.17.1", diff --git a/readme.md b/readme.md index 7f5d643..68c7922 100644 --- a/readme.md +++ b/readme.md @@ -11,8 +11,8 @@ [![npm version](https://badge.fury.io/js/%40sinclair%2Ftypebox.svg)](https://badge.fury.io/js/%40sinclair%2Ftypebox) [![Downloads](https://img.shields.io/npm/dm/%40sinclair%2Ftypebox.svg)](https://www.npmjs.com/package/%40sinclair%2Ftypebox) -[![GitHub CI](https://github.com/sinclairzx81/typebox/workflows/GitHub%20CI/badge.svg)](https://github.com/sinclairzx81/typebox/actions) -[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +[![Build](https://github.com/sinclairzx81/typebox/actions/workflows/build.yml/badge.svg)](https://github.com/sinclairzx81/typebox/actions/workflows/build.yml) +[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)