Skip to content

Commit

Permalink
chore(): add build in ci
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinMind committed Nov 24, 2023
1 parent 46b977e commit edc4ef7
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: ci build
run-name: ${{ github.actor }} is learning GitHub Actions
on:
pull_request:
merge_group:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
run: npm i
- name: Build
run: npm run build
env:
CI_DELAY: "10000"
CI_FAIL: "1"
18 changes: 18 additions & 0 deletions build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env node

const delay = parseInt(process.env.CI_DELAY || 3_000, 10);
const shouldFail = Boolean(process.env.CI_FAIL || '');

console.log('config', {delay, shouldFail, raw: { delay: process.env.CI_DELAY, shouldFail: process.env.CI_FAIL}});

await new Promise((resolve, reject) => {
console.log(`Running build... for ${delay / 1000} seconds`);
setTimeout(() => {
if (shouldFail) {
return reject('failing.... booo');
}
resolve(true);
}, delay);
});

console.log("Built!");
7 changes: 7 additions & 0 deletions node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "test-github-features",
"version": "1.0.0",
"description": "Repo to test github settings for PRs, CI, merging",
"main": "index.js",
"scripts": {
"build": "node ./build.mjs"
},
"author": "",
"license": "ISC"
}

0 comments on commit edc4ef7

Please sign in to comment.