Skip to content

Commit

Permalink
Merge branch 'dev' into feature/231-dev-email
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Connolly committed Aug 12, 2020
2 parents e2da854 + 212f811 commit cca71ac
Show file tree
Hide file tree
Showing 130 changed files with 18,147 additions and 17,852 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This helps prevent conflicts (well, at last when GitHub implements it...)
# See: https://github.com/isaacs/github/issues/487
CHANGELOG.md merge=union
2 changes: 1 addition & 1 deletion .github/workflows/build-nightlies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
DOCKER_BUILDKIT: 1
steps:
- name: Checkout
uses: actions/checkout@v2.3.1
uses: actions/checkout@v2.3.2
with:
ref: ${{ env.GHA_BRANCH }}

Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/bundlewatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,20 @@ jobs:
BUNDLEWATCH_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2.3.1
- uses: actions/checkout@v2.3.2

- name: Use Node.js
uses: actions/setup-node@v2.1.0
uses: actions/setup-node@v2.1.1
with:
node-version: 14.4.0

- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Restore npm cache directory
uses: actions/cache@v2.0.0
uses: actions/cache@v2.1.0
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
Expand Down
47 changes: 41 additions & 6 deletions .github/workflows/cypress-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ jobs:
# Platform recommended in cypress-io/github-action docs.
runs-on: ubuntu-16.04
# Manually skip this 10+ minute build based on commit message.
if: "!contains(github.event.head_commit.message, '[skip ci]')"
# Translation: If "skip ci" substring NOT found in push message or title of PR (hack).
if: "! (contains(github.event.head_commit.message, '[skip ci]') || contains(github.event.pull_request.title, '[skip ci]'))"
env:
# Use native docker command within docker-compose
COMPOSE_DOCKER_CLI_BUILD: 1
Expand All @@ -31,33 +32,67 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout
uses: actions/checkout@v2.3.1
uses: actions/checkout@v2.3.2

# This step helps us know when to skip future steps, particularly if
# we're on a fork where upstream secrets won't be available.
- name: Ensure secrets available
env:
GOOGLE_CREDENTIALS_BASE64: ${{ secrets.GOOGLE_CREDENTIALS_BASE64 }}
run: |
if [ -n "$GOOGLE_CREDENTIALS_BASE64" ]; then
echo "::set-env name=DO_COMMENT_TRANSLATION::true"
fi
- name: Enable comment translation
if: env.DO_COMMENT_TRANSLATION
run: |
echo GOOGLE_CREDENTIALS_BASE64=${{ secrets.GOOGLE_CREDENTIALS_BASE64 }} >> server/docker-dev.env
echo SHOULD_USE_TRANSLATION_API=true >> server/docker-dev.env
- name: Serve app via docker-compose
run: docker-compose up --detach

- name: Run Cypress tests
- name: "Run Cypress tests: default"
uses: cypress-io/github-action@v1
env:
CYPRESS_BASE_URL: http://localhost
with:
working-directory: ./e2e
# Ignore all tests with pattern *.secrets.spec.js
spec: "**/polis/**/!(*.secrets).spec.js"
browser: chrome

- name: "Run Cypress tests: comment translation"
if: env.DO_COMMENT_TRANSLATION
uses: cypress-io/github-action@v1
env:
CYPRESS_BASE_URL: http://localhost
with:
install: false
working-directory: ./e2e
spec: cypress/integration/polis/**/*
spec: "**/comment-translation.secrets.spec.js"
# Prevent cypress from discarding screenshots/videos from default test run.
config: "trashAssetsBeforeRuns=false"
browser: chrome

# NOTE: screenshots will be generated only if E2E test failed
# thus we store screenshots only on failures
- name: Save screenshot artefacts
uses: actions/upload-artifact@2.1.0
uses: actions/upload-artifact@v2.1.4
if: failure()
with:
name: cypress-screenshots
path: e2e/cypress/screenshots

# Test run video was always captured, so this action uses "always()" condition
- name: Save video artefacts
uses: actions/upload-artifact@2.1.0
uses: actions/upload-artifact@v2.1.4
if: always()
with:
name: cypress-videos
path: e2e/cypress/videos

- name: Check status of containers
if: failure()
run: docker-compose ps
82 changes: 82 additions & 0 deletions .github/workflows/depcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: DepCheck
on:
pull_request:
types: ["opened", "reopened", "synchronize"]
paths:
- .github/workflows/depcheck.yml
- client-admin/**

jobs:
run:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CI_COMMIT_ID: ${{ github.event.pull_request.head.sha || github.sha }}
CI_REPO_NAME: ${{ github.repository }}
steps:
# See: https://github.community/t/if-expression-with-context-variable/16558/6
- name: Check if secrets available
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
unset HAS_SECRET
if [ -n "$GITHUB_TOKEN" ]; then HAS_SECRET=true; fi
echo ::set-env name=HAS_SECRET::${HAS_SECRET}
- name: Use Node.js
uses: actions/setup-node@v2.1.1
with:
node-version: 14.4.0

# See: https://github.com/taskworld/commit-status
- name: Install commit-status CLI tool
run: npm install -g commit-status

- name: Initiate commit status placeholders
if: github.event.pull_request.head.repo.full_name == github.repository
run: |
# commit-status <state> <context> <description> <link>
commit-status pending "DepCheck / dependencies" "Detecting unused packages..."
commit-status pending "DepCheck / devDependencies" "Detecting unused packages..."
- uses: actions/checkout@v2.3.2

- name: Install depcheck CLI tool
run: npm install -g depcheck

- name: Install project dependencies
working-directory: client-admin
run: npm install

- name: Run depcheck and save output
id: depcheck
working-directory: client-admin
env:
# See: https://github.com/depcheck/depcheck#special
DEPCHECK_SPECIALS: "webpack,babel,eslint,prettier,bin"
# Why ignoring?
# - prettier: because it's needed by eslint-plugin-prettier, but peerDependencies aren't yet supported.
# See: https://github.com/depcheck/depcheck/issues/522
# - webpack-cli: Needed for `webpack` command, but provide `webpack-cli` bin, which confuses depcheck.
DEPCHECK_IGNORES: "prettier,webpack-cli"
run: |
# Note: Commit status descriptions can have 140 characters max. (We add an ellipsis in the final step as final char)
# Suppress failing exit codes with `true`.
depcheck --specials "$DEPCHECK_SPECIALS" --ignores "$DEPCHECK_IGNORES" --json > .results.json || true
echo ::set-output name=dependencies::$(cat .results.json | jq '.dependencies | join(", ") | .[:139]' --raw-output)
echo ::set-output name=devdependencies::$(cat .results.json | jq '.devDependencies | join(", ") | .[:139]' --raw-output)
- name: Set commit status messages and success states
if: github.event.pull_request.head.repo.full_name == github.repository
run: |
if [ "${{ steps.depcheck.outputs.dependencies }}" = "" ]; then
commit-status success "DepCheck / dependencies" "No unused packages detected."
else
commit-status failure "DepCheck / dependencies" "${{ steps.depcheck.outputs.dependencies }}…"
fi
if [ "${{ steps.depcheck.outputs.devdependencies }}" = "" ]; then
commit-status success "DepCheck / devDependencies" "No unused packages detected."
else
commit-status failure "DepCheck / devDependencies" "${{ steps.depcheck.outputs.devdependencies }}…"
fi
37 changes: 37 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Lint

on:
pull_request:
types: ["opened", "reopened", "synchronize"]

jobs:
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.2

- name: Use Node.js
uses: actions/setup-node@v2.1.0
with:
node-version: 14.4.0

- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Restore npm cache directory
uses: actions/cache@v2.0.0
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: "Install & Build: client-admin"
working-directory: client-admin
run: npm install

- name: "ESLint: client-admin"
working-directory: client-admin
run: npm run lint
33 changes: 33 additions & 0 deletions .github/workflows/test-clojure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Test Math/Clojure

on:
push:
branches: ["dev", "504-clj-tests"]
# Note: Only configured for client-admin right now.
paths:
- .github/workflows/test-clojure.yml
- math/**
pull_request:
types: ["opened", "reopened", "synchronize"]
paths:
- .github/workflows/test-clojure.yml
- math/**

jobs:
test-clj:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.2

- uses: actions/setup-java@v1.4.1
with:
java-version: 1.8

- uses: DeLaGuardo/setup-clojure@master
with:
tools-deps: 1.10.1
lein: 2.9.4

- working-directory: math
# Runs all except integration tests which require database and setup/teardown
run: "lein test :default"
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [unreleased]

### Changed
- Improved docs for configuring comment translation. [`#319`][]

### Added
- Added support for configuring comment translation credentials via base64-encoded string, stored in `GOOGLE_CREDENTIALS_BASE64` envvar. [`#319`][]

[`#319`]: https://github.com/pol-is/polisServer/issues/319
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,17 @@ We look forward to working together :tada:

## 🙋🏾‍♀️ Get Involved

1. Say hi in our **chat** [:speech_balloon:][chat] [`gitter.com/pol-is/polisDeployment`][chat]
1. Say hi in one of our **chat rooms** :speech_balloon:
- 🦸🏼 General [`gitter.im/pol-is/polis-community`][chat]
- 👩🏿‍💻 Software Development [`gitter.com/pol-is/polisDeployment`][chat-dev]
2. Join one of our weekly **open calls** :microphone:
- Please please please... Newcomers welcome! [Learn more...][calls-about]
3. Visit our [**issue tracker**][issues] [:white_check_mark:][issues] to offer your skills & energies
- We also keep a [project kanban board][board] [:checkered_flag:][board]
- :ear: Pssssst! [Learn how...][contributing] (labels, etc.)

[chat]: https://gitter.im/pol-is/polisDeployment
[chat]: https://gitter.im/pol-is/polis-community
[chat-dev]: https://gitter.im/pol-is/polisDeployment
[calls-about]: /CONTRIBUTING.md#telephone_receiver-open-calls
[issues]: https://github.com/pol-is/polisServer/issues
[board]: https://github.com/orgs/pol-is/projects/1
Expand Down Expand Up @@ -91,6 +94,12 @@ Sign up at `/createuser` path. You'll be logged in right away; no email validati
git config --local include.path ../.gitconfig
```

## 🔍 Testing

We use Cypress for automated, end-to-end browser testing! (See badge above.)

Please see [`e2e/README.md`](/e2e/README.md).

## 🚀 Deployment

Please see [`docs/deployment.md`](/docs/deployment.md)
Expand Down
2 changes: 1 addition & 1 deletion client-admin/.bundlewatch.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = {
"files": [
{
"path": "dist/*.js",
"maxSize": "500 kB",
"maxSize": "250 kB",
},
]
};
14 changes: 0 additions & 14 deletions client-admin/.eslintrc

This file was deleted.

29 changes: 29 additions & 0 deletions client-admin/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
env:
browser: true
es2020: true
jquery: true
globals:
Intercom: readonly
FB: readonly
plugins:
- babel
- react
extends:
- standard
- prettier-standard
- eslint:recommended
- plugin:react/recommended
- prettier/react
rules:
# TODO: Migrate to camelcase.
# snake_case API params and properties makes this a tangled process.
camelcase: off
parser: babel-eslint
parserOptions:
ecmaFeatures:
jsx: true
ecmaVersion: 11
sourceType: module
settings:
react:
version: detect

0 comments on commit cca71ac

Please sign in to comment.