Commit f312541f authored by Exbrayat Cédric's avatar Exbrayat Cédric
Browse files

chore(build): add gitlab-ci.yml for ci

parent ba264c35
# Image source available on https://github.com/Ninja-Squad/docker-rare
image: ninjasquad/docker-rare
# Disable the Gradle daemon for Continuous Integration servers as correctness
# is usually a priority over speed in CI environments. Using a fresh
# runtime for each build is more reliable since the runtime is completely
# isolated from any previous builds.
variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
test:
stage: test
script: ./gradlew build
cache:
key: "$CI_COMMIT_REF_NAME"
policy: pull
paths:
- build
- .gradle
# Rare project - Data discovery
## Setup
### Backend
The project uses Spring (5.x) for the backend,
with Spring Boot.
You need to install:
- a recent enough JDK8
Then at the root of the application, run `./gradlew build` to download the dependencies.
Then run `./gradlew bootRun` to start the app.
### Frontend
The project uses Angular (6.x) for the frontend,
with the Angular CLI.
You need to install:
- a recent enough NodeJS (8.11+)
- Yarn as a package manager (see [here to install](https://yarnpkg.com/en/docs/install))
Then in the `frontend` directory, run `yarn` to download the dependencies.
Then run `yarn start` to start the app, using the proxy conf to reroute calls to `/api` to the backend.
The application will be available on http://localhost:4200
## Build
To build the app, just run:
./gradlew assemble
This will build a standalone jar at `backend/build/libs/rare.jar`, that you can run with:
java -jar backend/build/libs/rare.jar
And the full app runs on http://localhost:8080
## CI
The `.gitlab-ci.yml` file describes how Gitlab is running the CI jobs.
It uses a base docker image named `ninjasquad/docker-rare`
available on [DockerHub](https://hub.docker.com/r/ninjasquad/docker-rare/)
and [Github](https://github.com/Ninja-Squad/docker-rare).
The image is based on `openjdk:8` and adds a Chrome binary to let us run the frontend tests
(with a headless Chrome in `--no-sandbox` mode).
We install `node` and `yarn` in `/tmp` (this is not the case for local builds)
to avoid symbolic links issues on Docker.
You can approximate what runs on CI by executing:
docker run --rm -v "$PWD":/home/rare -w /home/rare ninjasquad/docker-rare ./gradlew build
......@@ -3,10 +3,17 @@ plugins {
id("com.moowork.node") version "1.2.0"
}
val isCi = System.getenv("CI") != null
node {
version = "8.11.3"
npmVersion = "6.2.0"
yarnVersion = "1.7.0"
if (isCi) {
// we specify a custom installation directory because of permission issues on Docker
workDir = file("/tmp/node")
yarnWorkDir = file("/tmp/yarn")
}
download = true
}
......@@ -22,6 +29,7 @@ tasks {
}
val yarn_build by getting {
dependsOn(yarn_install)
inputs.dir("src")
outputs.dir("dist")
}
......
......@@ -25,7 +25,13 @@ module.exports = function (config) {
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
browsers: ['ChromeHeadlessNoSandbox'],
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: ['--no-sandbox'] // required for Gitlab CI
}
},
singleRun: false
});
};
\ No newline at end of file
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment