Skip to content

Commit 3f50917

Browse files
authored
Scheduled Nightly Builds (#488)
1 parent da10cc0 commit 3f50917

File tree

5 files changed

+60
-30
lines changed

5 files changed

+60
-30
lines changed

.github/workflows/ci.yml renamed to .github/workflows/build.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
name: GitHub CI
2-
1+
name: Build
32
on: [push, pull_request]
4-
53
jobs:
64
TypeBox:
75
runs-on: ${{ matrix.os }}
@@ -12,11 +10,13 @@ jobs:
1210
steps:
1311
- uses: actions/checkout@v2
1412
- name: Install Node
15-
uses: actions/setup-node@v1
13+
uses: actions/setup-node@v3
1614
with:
1715
node-version: ${{ matrix.node }}
16+
1817
- name: Install Packages
1918
run: npm install
19+
2020
- name: Build Library
2121
run: npm run build
2222
- name: Test Library

.github/workflows/nightly.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Build Nightly
2+
on:
3+
schedule:
4+
- cron: '0 18 * * *' # 6pm Daily
5+
jobs:
6+
TypeBox:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
matrix:
10+
node: [20.x]
11+
os: [ubuntu-latest]
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Install Node
15+
uses: actions/setup-node@v3
16+
with:
17+
node-version: ${{ matrix.node }}
18+
19+
- name: Install Packages
20+
run: npm install
21+
22+
- name: Install TypeScript Latest
23+
run: npm install typescript@latest
24+
- name: Build TypeBox
25+
run: npm run build
26+
27+
- name: Install TypeScript Next
28+
run: npm install typescript@next
29+
- name: Build TypeBox
30+
run: npm run build

hammer.mjs

+22-22
Original file line numberDiff line numberDiff line change
@@ -5,59 +5,59 @@ import { readFileSync } from 'fs'
55
// Clean
66
// -------------------------------------------------------------------------------
77
export async function clean() {
8-
await folder('target').delete()
8+
await folder('target').delete()
99
}
1010
// -------------------------------------------------------------------------------
1111
// Format
1212
// -------------------------------------------------------------------------------
1313
export async function format() {
14-
await shell('prettier --no-semi --single-quote --print-width 240 --trailing-comma all --write src test example/index.ts benchmark')
14+
await shell('prettier --no-semi --single-quote --print-width 240 --trailing-comma all --write src test example/index.ts benchmark')
1515
}
1616
// -------------------------------------------------------------------------------
1717
// Start
1818
// -------------------------------------------------------------------------------
1919
export async function start(example = 'index') {
20-
await shell(`hammer run example/${example}.ts --dist target/example/${example}`)
20+
await shell(`hammer run example/${example}.ts --dist target/example/${example}`)
2121
}
2222
// -------------------------------------------------------------------------------
2323
// Benchmark
2424
// -------------------------------------------------------------------------------
2525
export async function benchmark() {
26-
await compression()
27-
await measurement()
26+
await compression()
27+
await measurement()
2828
}
2929
// -------------------------------------------------------------------------------
3030
// Test
3131
// -------------------------------------------------------------------------------
3232
export async function test_static() {
33-
await shell(`tsc -p test/static/tsconfig.json --noEmit --strict`)
33+
await shell(`tsc -p test/static/tsconfig.json --noEmit --strict`)
3434
}
35-
export async function test_runtime(filter) {
36-
await shell(`hammer build ./test/runtime/index.ts --dist target/test/runtime --platform node`)
37-
await shell(`mocha target/test/runtime/index.js -g "${filter}"`)
35+
export async function test_runtime(filter = '') {
36+
await shell(`hammer build ./test/runtime/index.ts --dist target/test/runtime --platform node`)
37+
await shell(`mocha target/test/runtime/index.js -g "${filter}"`)
3838
}
3939
export async function test(filter = '') {
40-
await test_static()
41-
await test_runtime(filter)
40+
await test_static()
41+
await test_runtime(filter)
4242
}
4343
// -------------------------------------------------------------------------------
4444
// Build
4545
// -------------------------------------------------------------------------------
4646
export async function build(target = 'target/build') {
47-
await test()
48-
await folder(target).delete()
49-
await shell(`tsc -p ./src/tsconfig.json --outDir ${target}`)
50-
await folder(target).add('package.json')
51-
await folder(target).add('readme.md')
52-
await folder(target).add('license')
53-
await shell(`cd ${target} && npm pack`)
47+
await test()
48+
await folder(target).delete()
49+
await shell(`tsc -p ./src/tsconfig.json --outDir ${target}`)
50+
await folder(target).add('package.json')
51+
await folder(target).add('readme.md')
52+
await folder(target).add('license')
53+
await shell(`cd ${target} && npm pack`)
5454
}
5555
// -------------------------------------------------------------
5656
// Publish
5757
// -------------------------------------------------------------
5858
export async function publish(otp, target = 'target/build') {
59-
const { version } = JSON.parse(readFileSync('package.json', 'utf8'))
60-
await shell(`cd ${target} && npm publish sinclair-typebox-${version}.tgz --access=public --otp ${otp}`)
61-
await shell(`git tag ${version}`)
62-
await shell(`git push origin ${version}`)
59+
const { version } = JSON.parse(readFileSync('package.json', 'utf8'))
60+
await shell(`cd ${target} && npm publish sinclair-typebox-${version}.tgz --access=public --otp ${otp}`)
61+
await shell(`git tag ${version}`)
62+
await shell(`git push origin ${version}`)
6363
}

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

readme.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
[![npm version](https://badge.fury.io/js/%40sinclair%2Ftypebox.svg)](https://badge.fury.io/js/%40sinclair%2Ftypebox)
1313
[![Downloads](https://img.shields.io/npm/dm/%40sinclair%2Ftypebox.svg)](https://www.npmjs.com/package/%40sinclair%2Ftypebox)
14-
[![GitHub CI](https://github.com/sinclairzx81/typebox/workflows/GitHub%20CI/badge.svg)](https://github.com/sinclairzx81/typebox/actions)
15-
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
14+
[![Build](https://github.com/sinclairzx81/typebox/actions/workflows/build.yml/badge.svg)](https://github.com/sinclairzx81/typebox/actions/workflows/build.yml)
15+
[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
1616

1717
</div>
1818

0 commit comments

Comments
 (0)