Skip to content

Commit cca71ac

Browse files
author
Patrick Connolly
committed
Merge branch 'dev' into feature/231-dev-email
2 parents e2da854 + 212f811 commit cca71ac

File tree

130 files changed

+18147
-17852
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+18147
-17852
lines changed

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# This helps prevent conflicts (well, at last when GitHub implements it...)
2+
# See: https://github.com/isaacs/github/issues/487
3+
CHANGELOG.md merge=union

.github/workflows/build-nightlies.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
DOCKER_BUILDKIT: 1
1818
steps:
1919
- name: Checkout
20-
uses: actions/[email protected].1
20+
uses: actions/[email protected].2
2121
with:
2222
ref: ${{ env.GHA_BRANCH }}
2323

.github/workflows/bundlewatch.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,20 @@ jobs:
2121
BUNDLEWATCH_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2222

2323
steps:
24-
- uses: actions/[email protected].1
24+
- uses: actions/[email protected].2
2525

2626
- name: Use Node.js
27-
uses: actions/[email protected].0
27+
uses: actions/[email protected].1
2828
with:
2929
node-version: 14.4.0
3030

3131
- name: Get npm cache directory
3232
id: npm-cache
3333
run: |
3434
echo "::set-output name=dir::$(npm config get cache)"
35+
3536
- name: Restore npm cache directory
36-
uses: actions/cache@v2.0.0
37+
uses: actions/cache@v2.1.0
3738
with:
3839
path: ${{ steps.npm-cache.outputs.dir }}
3940
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}

.github/workflows/cypress-tests.yml

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ jobs:
1717
# Platform recommended in cypress-io/github-action docs.
1818
runs-on: ubuntu-16.04
1919
# Manually skip this 10+ minute build based on commit message.
20-
if: "!contains(github.event.head_commit.message, '[skip ci]')"
20+
# Translation: If "skip ci" substring NOT found in push message or title of PR (hack).
21+
if: "! (contains(github.event.head_commit.message, '[skip ci]') || contains(github.event.pull_request.title, '[skip ci]'))"
2122
env:
2223
# Use native docker command within docker-compose
2324
COMPOSE_DOCKER_CLI_BUILD: 1
@@ -31,33 +32,67 @@ jobs:
3132
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3233

3334
- name: Checkout
34-
uses: actions/[email protected]
35+
uses: actions/[email protected]
36+
37+
# This step helps us know when to skip future steps, particularly if
38+
# we're on a fork where upstream secrets won't be available.
39+
- name: Ensure secrets available
40+
env:
41+
GOOGLE_CREDENTIALS_BASE64: ${{ secrets.GOOGLE_CREDENTIALS_BASE64 }}
42+
run: |
43+
if [ -n "$GOOGLE_CREDENTIALS_BASE64" ]; then
44+
echo "::set-env name=DO_COMMENT_TRANSLATION::true"
45+
fi
46+
47+
- name: Enable comment translation
48+
if: env.DO_COMMENT_TRANSLATION
49+
run: |
50+
echo GOOGLE_CREDENTIALS_BASE64=${{ secrets.GOOGLE_CREDENTIALS_BASE64 }} >> server/docker-dev.env
51+
echo SHOULD_USE_TRANSLATION_API=true >> server/docker-dev.env
3552
3653
- name: Serve app via docker-compose
3754
run: docker-compose up --detach
3855

39-
- name: Run Cypress tests
56+
- name: "Run Cypress tests: default"
57+
uses: cypress-io/github-action@v1
58+
env:
59+
CYPRESS_BASE_URL: http://localhost
60+
with:
61+
working-directory: ./e2e
62+
# Ignore all tests with pattern *.secrets.spec.js
63+
spec: "**/polis/**/!(*.secrets).spec.js"
64+
browser: chrome
65+
66+
- name: "Run Cypress tests: comment translation"
67+
if: env.DO_COMMENT_TRANSLATION
4068
uses: cypress-io/github-action@v1
4169
env:
4270
CYPRESS_BASE_URL: http://localhost
4371
with:
72+
install: false
4473
working-directory: ./e2e
45-
spec: cypress/integration/polis/**/*
74+
spec: "**/comment-translation.secrets.spec.js"
75+
# Prevent cypress from discarding screenshots/videos from default test run.
76+
config: "trashAssetsBeforeRuns=false"
4677
browser: chrome
4778

4879
# NOTE: screenshots will be generated only if E2E test failed
4980
# thus we store screenshots only on failures
5081
- name: Save screenshot artefacts
51-
uses: actions/upload-artifact@2.1.0
82+
uses: actions/upload-artifact@v2.1.4
5283
if: failure()
5384
with:
5485
name: cypress-screenshots
5586
path: e2e/cypress/screenshots
5687

5788
# Test run video was always captured, so this action uses "always()" condition
5889
- name: Save video artefacts
59-
uses: actions/upload-artifact@2.1.0
90+
uses: actions/upload-artifact@v2.1.4
6091
if: always()
6192
with:
6293
name: cypress-videos
6394
path: e2e/cypress/videos
95+
96+
- name: Check status of containers
97+
if: failure()
98+
run: docker-compose ps

.github/workflows/depcheck.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: DepCheck
2+
on:
3+
pull_request:
4+
types: ["opened", "reopened", "synchronize"]
5+
paths:
6+
- .github/workflows/depcheck.yml
7+
- client-admin/**
8+
9+
jobs:
10+
run:
11+
runs-on: ubuntu-latest
12+
env:
13+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14+
CI_COMMIT_ID: ${{ github.event.pull_request.head.sha || github.sha }}
15+
CI_REPO_NAME: ${{ github.repository }}
16+
steps:
17+
# See: https://github.community/t/if-expression-with-context-variable/16558/6
18+
- name: Check if secrets available
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
run: |
22+
unset HAS_SECRET
23+
if [ -n "$GITHUB_TOKEN" ]; then HAS_SECRET=true; fi
24+
echo ::set-env name=HAS_SECRET::${HAS_SECRET}
25+
26+
- name: Use Node.js
27+
uses: actions/[email protected]
28+
with:
29+
node-version: 14.4.0
30+
31+
# See: https://github.com/taskworld/commit-status
32+
- name: Install commit-status CLI tool
33+
run: npm install -g commit-status
34+
35+
- name: Initiate commit status placeholders
36+
if: github.event.pull_request.head.repo.full_name == github.repository
37+
run: |
38+
# commit-status <state> <context> <description> <link>
39+
commit-status pending "DepCheck / dependencies" "Detecting unused packages..."
40+
commit-status pending "DepCheck / devDependencies" "Detecting unused packages..."
41+
42+
- uses: actions/[email protected]
43+
44+
- name: Install depcheck CLI tool
45+
run: npm install -g depcheck
46+
47+
- name: Install project dependencies
48+
working-directory: client-admin
49+
run: npm install
50+
51+
- name: Run depcheck and save output
52+
id: depcheck
53+
working-directory: client-admin
54+
env:
55+
# See: https://github.com/depcheck/depcheck#special
56+
DEPCHECK_SPECIALS: "webpack,babel,eslint,prettier,bin"
57+
# Why ignoring?
58+
# - prettier: because it's needed by eslint-plugin-prettier, but peerDependencies aren't yet supported.
59+
# See: https://github.com/depcheck/depcheck/issues/522
60+
# - webpack-cli: Needed for `webpack` command, but provide `webpack-cli` bin, which confuses depcheck.
61+
DEPCHECK_IGNORES: "prettier,webpack-cli"
62+
run: |
63+
# Note: Commit status descriptions can have 140 characters max. (We add an ellipsis in the final step as final char)
64+
# Suppress failing exit codes with `true`.
65+
depcheck --specials "$DEPCHECK_SPECIALS" --ignores "$DEPCHECK_IGNORES" --json > .results.json || true
66+
echo ::set-output name=dependencies::$(cat .results.json | jq '.dependencies | join(", ") | .[:139]' --raw-output)
67+
echo ::set-output name=devdependencies::$(cat .results.json | jq '.devDependencies | join(", ") | .[:139]' --raw-output)
68+
69+
- name: Set commit status messages and success states
70+
if: github.event.pull_request.head.repo.full_name == github.repository
71+
run: |
72+
if [ "${{ steps.depcheck.outputs.dependencies }}" = "" ]; then
73+
commit-status success "DepCheck / dependencies" "No unused packages detected."
74+
else
75+
commit-status failure "DepCheck / dependencies" "${{ steps.depcheck.outputs.dependencies }}…"
76+
fi
77+
78+
if [ "${{ steps.depcheck.outputs.devdependencies }}" = "" ]; then
79+
commit-status success "DepCheck / devDependencies" "No unused packages detected."
80+
else
81+
commit-status failure "DepCheck / devDependencies" "${{ steps.depcheck.outputs.devdependencies }}…"
82+
fi

.github/workflows/lint.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Lint
2+
3+
on:
4+
pull_request:
5+
types: ["opened", "reopened", "synchronize"]
6+
7+
jobs:
8+
eslint:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/[email protected]
12+
13+
- name: Use Node.js
14+
uses: actions/[email protected]
15+
with:
16+
node-version: 14.4.0
17+
18+
- name: Get npm cache directory
19+
id: npm-cache
20+
run: |
21+
echo "::set-output name=dir::$(npm config get cache)"
22+
23+
- name: Restore npm cache directory
24+
uses: actions/[email protected]
25+
with:
26+
path: ${{ steps.npm-cache.outputs.dir }}
27+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
28+
restore-keys: |
29+
${{ runner.os }}-node-
30+
31+
- name: "Install & Build: client-admin"
32+
working-directory: client-admin
33+
run: npm install
34+
35+
- name: "ESLint: client-admin"
36+
working-directory: client-admin
37+
run: npm run lint

.github/workflows/test-clojure.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Test Math/Clojure
2+
3+
on:
4+
push:
5+
branches: ["dev", "504-clj-tests"]
6+
# Note: Only configured for client-admin right now.
7+
paths:
8+
- .github/workflows/test-clojure.yml
9+
- math/**
10+
pull_request:
11+
types: ["opened", "reopened", "synchronize"]
12+
paths:
13+
- .github/workflows/test-clojure.yml
14+
- math/**
15+
16+
jobs:
17+
test-clj:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/[email protected]
21+
22+
- uses: actions/[email protected]
23+
with:
24+
java-version: 1.8
25+
26+
- uses: DeLaGuardo/setup-clojure@master
27+
with:
28+
tools-deps: 1.10.1
29+
lein: 2.9.4
30+
31+
- working-directory: math
32+
# Runs all except integration tests which require database and setup/teardown
33+
run: "lein test :default"

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [unreleased]
9+
10+
### Changed
11+
- Improved docs for configuring comment translation. [`#319`][]
12+
13+
### Added
14+
- Added support for configuring comment translation credentials via base64-encoded string, stored in `GOOGLE_CREDENTIALS_BASE64` envvar. [`#319`][]
15+
16+
[`#319`]: https://github.com/pol-is/polisServer/issues/319

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,17 @@ We look forward to working together :tada:
2626

2727
## 🙋🏾‍♀️ Get Involved
2828

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

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

97+
## 🔍 Testing
98+
99+
We use Cypress for automated, end-to-end browser testing! (See badge above.)
100+
101+
Please see [`e2e/README.md`](/e2e/README.md).
102+
94103
## 🚀 Deployment
95104

96105
Please see [`docs/deployment.md`](/docs/deployment.md)

client-admin/.bundlewatch.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module.exports = {
1111
"files": [
1212
{
1313
"path": "dist/*.js",
14-
"maxSize": "500 kB",
14+
"maxSize": "250 kB",
1515
},
1616
]
1717
};

0 commit comments

Comments
 (0)