diff --git a/.github/workflows/linux-ci.yml b/.github/workflows/linux-ci.yml new file mode 100644 index 00000000..d17e9a08 --- /dev/null +++ b/.github/workflows/linux-ci.yml @@ -0,0 +1,17 @@ +name: Node.js CI (Linux - Ubuntu) + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Run linux CI in dockerfile + run: docker build . --file Dockerfile.test diff --git a/.github/workflows/node.js.yml b/.github/workflows/windows-ci.yml similarity index 96% rename from .github/workflows/node.js.yml rename to .github/workflows/windows-ci.yml index 5e2ae6f2..027dcb69 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/windows-ci.yml @@ -1,7 +1,7 @@ # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions -name: Node.js CI +name: Node.js CI (Windows) on: push: diff --git a/Dockerfile.test b/Dockerfile.test new file mode 100644 index 00000000..d5e687b2 --- /dev/null +++ b/Dockerfile.test @@ -0,0 +1,48 @@ +# Dockerfile for Linux build automation. +# +# Demonstrates developing PoE-Overlay on Linux and produces testable Linux +# builds. Each step will be cached independently, so subsequent builds will be +# faster. First build will take up to 10 minutes. +# IMPORTANT: Set DOCKER_BUILDKIT=1 in your environment variables or you will not +# get any build artifacts in your release folder. +ARG codedir=/opt/PoE-Overlay-Community-Fork + +# Since the Electron builder targets Debian packaging, start with an Ubuntu LTS image. +FROM ubuntu:20.04 AS build-stage + +# Install build environment dependencies. +RUN apt-get update +RUN apt-get install -y libx11-dev libxtst-dev libpng-dev wget make g++ git lsb-release gnupg +# https://github.com/nodesource/distributions/blob/0d3d988/README.md#installation-instructions +RUN wget https://deb.nodesource.com/setup_12.x -O nodesource.sh +RUN bash nodesource.sh +RUN apt-get install -y nodejs +RUN DEBIAN_FRONTEND="noninteractive" TZ="America/New_York" apt-get install -y tzdata + +# Install Google Chrome +RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - +RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' +RUN apt-get update && apt-get install -y google-chrome-stable + +# Set up working directory. +ARG codedir +RUN mkdir $codedir +WORKDIR $codedir + +# Copy the code into the container, avoiding .git and node_modules. +COPY *.json $codedir/ +COPY browserslist $codedir +COPY dev-app-update.yml $codedir +COPY main.ts $codedir +COPY overlay.babel $codedir +COPY electron $codedir/electron +COPY img $codedir/img +COPY src $codedir/src +COPY karma*.conf.js $codedir/ + +# Install NodeJS dependencies/modules. +RUN npm install + +# Run tests +# If you get an out of memory error, increase Docker's resources. +RUN npm run ng:test:ci diff --git a/karma-ci.conf.js b/karma-ci.conf.js index 253abda2..ef1b2f07 100644 --- a/karma-ci.conf.js +++ b/karma-ci.conf.js @@ -3,6 +3,13 @@ var generateBaseConfig = require('./karma-base.conf'); module.exports = function(config) { config.set(Object.assign({}, generateBaseConfig(config), { autoWatch: false, - singleRun: true + singleRun: true, + customLaunchers: { + ChromeCI: { + base: 'ChromeHeadless', + flags: ['--no-sandbox'], + }, + }, + browsers: ['ChromeCI'], })); }