CI: Update workflows #715
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
branches: | |
- master | |
paths-ignore: | |
- '**.md' | |
jobs: | |
node: | |
name: Node.js (${{matrix.node_version_file}}) | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
node_version_file: | |
- .nvmrc | |
- package.json | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js from ${{matrix.node_version_file}} file | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: ${{matrix.node_version_file}} | |
cache: npm | |
cache-dependency-path: 'package-lock.json' | |
- name: Install modules from package.json | |
run: npm clean-install --ignore-scripts | |
- name: Run postinstall scripts | |
run: npm run postinstall | |
- name: Run tests | |
run: npm run test:js | |
docker: | |
name: Docker | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Build image from Dockerfile | |
run: docker build --tag dr4ft-app . | |
- name: Run container from image | |
run: docker run --detach --name dr4ft -p 1337:1337 dr4ft-app | |
# TODO: Extend this and test e.g. creating a game via API | |
- name: Access dr4ft page | |
run: wget http://localhost:1337 | |
- name: Show information | |
run: | | |
docker --version | |
echo | |
docker images dr4ft-app | |
echo | |
docker ps | |
echo | |
echo "Node version (dr4ft-app image)" | |
docker run dr4ft-app node --version | |
echo | |
docker top dr4ft | |
lint: | |
name: ESLint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js from .nvmrc file | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: npm | |
cache-dependency-path: 'package-lock.json' | |
- name: Install ESLint | |
run: npm clean-install eslint --ignore-scripts | |
- name: Run ESLint | |
run: | | |
echo "Node version" | |
node --version | |
echo "ESLint version" | |
npx eslint --version | |
npm run lint |