Skip to content

Commit

Permalink
Merge pull request #5 from skimhub/develop
Browse files Browse the repository at this point in the history
Merging develop to master
  • Loading branch information
wrightlahiff authored May 24, 2021
2 parents 60d935b + b7034e6 commit 7a32e71
Show file tree
Hide file tree
Showing 253 changed files with 6,454 additions and 39,266 deletions.
13 changes: 13 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/.git/
/.github/
/.idea/
/build/
/docs/
/node_modules/
/resources/
.dockerignore
.gitignore
.npmignore
LICENSE
NOTICE
README.md
49 changes: 49 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build

on:
push:
branches:
- master
pull_request:

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [ 12.x, 14.x ]

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install dependencies
run: npm ci

- name: Lint
run: npm run lint

- name: Build
run: npm run build

- name: Unit Test
run: npm run test

- name: E2E Test
run: npm run e2e
51 changes: 51 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Deploy

on:
push:
branches:
- master

jobs:
deploy:

runs-on: ubuntu-latest

env:
IMAGE_NAME: eu.gcr.io/${{ secrets.GCP_PROJECT_ID }}/turnilo

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Authenticate on GCP
uses: google-github-actions/setup-gcloud@master
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true

- name: Configure Docker
run: gcloud auth configure-docker --quiet

- name: Build Docker image
run: docker build . -t $IMAGE_NAME:latest

- name: Push Docker image
run: docker push $IMAGE_NAME:latest

- name: Deploy on GCP
run: |
gcloud run deploy turnilo \
--image $IMAGE_NAME:latest \
--region europe-west1 \
--platform managed \
--allow-unauthenticated \
--quiet \
--port 9090 \
--cpu 1 --memory 1G --max-instances 1 --concurrency 80 \
--args="--examples"
- name: Delete previous Docker image
run: |
gcloud container images list-tags $IMAGE_NAME --filter='-tags:*' --format='get(digest)' --limit=unlimited | \
xargs -I {digest} gcloud container images delete "$IMAGE_NAME@{digest}" --quiet
66 changes: 66 additions & 0 deletions .github/workflows/release-beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Release Beta

on:
workflow_dispatch:
inputs:
increment:
description: 'Defines which part of a SemVer should be increased during the release process, e.g "major", "minor", "patch" or empty for consecutive release'

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
with:
# changelog is generated from git log
fetch-depth: 0
# release must bypass branch protection rules, built-in GITHUB_TOKEN doesn't work
token: ${{ secrets.RELEASE_GH_TOKEN }}

- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '14.x'

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install dependencies
run: npm ci

- name: Lint
run: npm run lint

- name: Build
run: npm run build

- name: Unit Test
run: npm run test

- name: E2E Test
run: npm run e2e

- name: Configure GIT
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Install release-it
run: npm install -g release-it@13.7.1

- name: Beta Release
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_USERCONFIG: .npmrc-publish
run: |
release-it ${{ github.event.inputs.increment }} --preRelease=beta --ci
72 changes: 72 additions & 0 deletions .github/workflows/release-final.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Release Final

on:
workflow_dispatch:
inputs:
increment:
description: 'Defines which part of a SemVer should be increased during the release process, e.g "major", "minor" or "patch"'
default: 'minor'
required: true

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
with:
# changelog is generated from git log
fetch-depth: 0
# release must bypass branch protection rules, built-in GITHUB_TOKEN doesn't work
token: ${{ secrets.RELEASE_GH_TOKEN }}

- name: Check if branch is not master
if: github.ref != 'refs/heads/master'
run: exit 1

- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '14.x'

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install dependencies
run: npm ci

- name: Lint
run: npm run lint

- name: Build
run: npm run build

- name: Unit Test
run: npm run test

- name: E2E Test
run: npm run e2e

- name: Configure GIT
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Install release-it
run: npm install -g release-it@13.7.1

- name: Final Release
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_USERCONFIG: .npmrc-publish
run: |
release-it ${{ github.event.inputs.increment }} --ci
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/.idea/
/node_modules/
/build/
/.idea/*
/node_modules/*
/build/*
/docs/_site/*
*.iml
*.tgz
config.yml
Expand Down
5 changes: 4 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/.git/
/.github/
/.idea/
/config/
/docs/
Expand All @@ -12,8 +14,9 @@
*.ts
*.tgz
*.iml
.dockerignore
.release-it.json
.sass-lint.yml
.travis.yml
Dockerfile
tsconfig*.json
tslint.json
2 changes: 2 additions & 0 deletions .npmrc-publish
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//registry.npmjs.org/:_authToken=${NPM_TOKEN}

13 changes: 9 additions & 4 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{
"pkgFiles": [
"package.json",
"package-lock.json"
]
"git": {
"requireCleanWorkingDir": false
},
"github": {
"release": true
},
"npm": {
"skipChecks": true
}
}
28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

46 changes: 46 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#
# BUILD stage
#
FROM node:14.15.4 AS build

WORKDIR /usr/src/app

# Install and cache dependencies
COPY package.json package-lock.json ./
RUN npm ci

# Copy sources (see .dockerignore)
COPY . ./

# Build and test
RUN npm run build

# Prune dev dependencies from node_modules
RUN npm prune --production

#
# RUNTIME stage
#
FROM gcr.io/distroless/nodejs:14 as runtime

WORKDIR /app

# Example configuration and packages.json
COPY --from=build /usr/src/app/config-examples.yaml /usr/src/app/package.json /usr/src/app/package-lock.json ./

# Wikiticker dataset
COPY --from=build /usr/src/app/assets ./assets

# Main JS
COPY --from=build /usr/src/app/bin ./bin

# Build results
COPY --from=build /usr/src/app/build ./build

# Dependencies
COPY --from=build /usr/src/app/node_modules ./node_modules

# Expose default port
EXPOSE 9090

ENTRYPOINT [ "/nodejs/bin/node", "bin/turnilo" ]
Loading

0 comments on commit 7a32e71

Please sign in to comment.