From 07020712018149ac8e04b6e78e53869b6fbbab79 Mon Sep 17 00:00:00 2001 From: Kevin Meinhardt Date: Fri, 24 Nov 2023 14:46:25 +0000 Subject: [PATCH] chore(): add build in ci --- .github/workflows/ci.yml | 18 ++++++++++++++++++ build.mjs | 18 ++++++++++++++++++ package-lock.json | 13 +++++++++++++ package.json | 11 +++++++++++ 4 files changed, 60 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 build.mjs create mode 100644 package-lock.json create mode 100644 package.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..234fb19 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,18 @@ +name: learn-github-actions +run-name: ${{ github.actor }} is learning GitHub Actions +on: + pull_request: + merge_group: +jobs: + build: + runs-on: ubuntu-latest + env: + CI_DELAY: "10_000" + CI_FAIL: "" + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + node-version: '18' + - run: npm install + - run: npm run build diff --git a/build.mjs b/build.mjs new file mode 100644 index 0000000..cadf08a --- /dev/null +++ b/build.mjs @@ -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}); + +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!"); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..f1cef0c --- /dev/null +++ b/package-lock.json @@ -0,0 +1,13 @@ +{ + "name": "test-github-features", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "test-github-features", + "version": "1.0.0", + "license": "ISC" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..3854508 --- /dev/null +++ b/package.json @@ -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" +}