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 5009725
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: learn-github-actions
run-name: ${{ github.actor }} is learning GitHub Actions
on:
pull_request:
merge_group:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '18'
- name: Run CI Build
- run: npm install
- run: npm run build
env:
CI_DELAY: "10_000"
CI_FAIL: ""
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 = Number(process.env.CI_DELAY || 3_000);
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} seconds`);
setTimeout(() => {
if (shouldFail) {
return reject('failing.... booo');
}
resolve(true);
}, delay);
});

console.log("Built!");
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 5009725

Please sign in to comment.