Skip to content

Commit

Permalink
[BUILD] Add CI pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
openhoat committed Oct 21, 2023
1 parent 77126c9 commit ca98bc9
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/actions/install-action/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: install
description: Install specific version of Node and NPM

inputs:
node-version:
description: NodeJS version
required: true
npm-version:
description: NPM version
required: true

runs:
using: composite
steps:
- name: Install NodeJS version ${{ inputs.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node-version }}
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: npm-
- name: Install NPM
shell: bash
run: npm i -g npm@${NPM_VERSION}
- name: Install dependencies
shell: bash
run: npm ci --prefer-offline --include=dev --ignore-scripts
30 changes: 30 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: build

env:
NODE_VERSION: '18.17.1'
NPM_VERSION: '9.8.1'

on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Install project prerequisite
uses: ./.github/actions/install-action
with:
node-version: ${{env.NODE_VERSION}}
npm-version: ${{env.NPM_VERSION}}
- name: Validate project
run: npm run validate
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![build](https://github.com/NijiDigital/space-invaders-ascii-nodejs/actions/workflows/build.yaml/badge.svg)](https://github.com/NijiDigital/space-invaders-ascii-nodejs/actions/workflows/build.yaml)

## Space Invaders

A space invaders game in ASCII art made with love, NodeJS and TypeScript.
Expand Down

0 comments on commit ca98bc9

Please sign in to comment.