forked from allegro/turnilo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from skimhub/develop
Merging develop to master
- Loading branch information
Showing
253 changed files
with
6,454 additions
and
39,266 deletions.
There are no files selected for viewing
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
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 |
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
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 |
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
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 |
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
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 |
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
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 |
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
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 | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
//registry.npmjs.org/:_authToken=${NPM_TOKEN} | ||
|
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
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 | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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
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" ] |
Oops, something went wrong.