Skip to content

Commit

Permalink
Merge branch 'edge' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
NewJerseyStyle authored Oct 10, 2024
2 parents 9f6ec2c + 3adde83 commit e0c6a0f
Show file tree
Hide file tree
Showing 429 changed files with 56,535 additions and 83,295 deletions.
32 changes: 16 additions & 16 deletions .bundlewatch.config.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
module.exports = {
"ci": {
"trackBranches": [
process.env.CI_BRANCH_DEFAULT,
],
ci: {
trackBranches: [process.env.CI_BRANCH_DEFAULT],
baseBranch: process.env.CI_BRANCH_DEFAULT,
// Allows bundlewatch GitHub Actions workflow to work on: pull_request, or push
"commitSha": process.env.PR_COMMIT_SHA || process.env.PUSH_COMMIT_SHA,
"repoBranchBase": process.env.PR_BRANCH_BASE || process.env.PUSH_BRANCH_BASE,
"repoCurrentBranch": process.env.PR_BRANCH || process.env.PUSH_BRANCH,
commitSha: process.env.PR_COMMIT_SHA || process.env.PUSH_COMMIT_SHA,
repoBranchBase: process.env.PR_BRANCH_BASE || process.env.PUSH_BRANCH_BASE,
repoCurrentBranch: process.env.PR_BRANCH || process.env.PUSH_BRANCH,
},
"files": [
files: [
{
"path": "client-admin/dist/*.js",
"maxSize": "180 kB",
path: "client-admin/build/static/js/*.js",
maxSize: "250 kB",
},
{
"path": "client-participation/dist/cached/*/js/polis.js",
"maxSize": "150 kB",
path: "client-participation/dist/js/*.js",
maxSize: "450 kB",
},
{
"path": "client-participation/dist/cached/*/js/vis_bundle.js",
"maxSize": "200 kB",
},
]
path: "client-report/dist/*.js",
maxSize: "200 kB",
}
],
normalizeFileNames: /^.+?(\..+?)\.\w+$/,
};
1 change: 0 additions & 1 deletion .env

This file was deleted.

18 changes: 0 additions & 18 deletions .github/CODEOWNERS

This file was deleted.

53 changes: 23 additions & 30 deletions .github/workflows/bundlewatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,41 @@ name: "Bundlewatch Github Action"
on:
push:
# Required so that baseline for comparison is pushed to bundlewatch service.
branches: ["dev"]
branches:
- edge
paths:
- .github/workflows/bundlewatch.yml
- client-admin/**
- client-participation/**
- client-report/**
pull_request:
types: ["opened", "reopened", "synchronize"]
paths:
- .github/workflows/bundlewatch.yml
- client-admin/**
- client-participation/**
- client-report/**

jobs:
bundlewatch:
runs-on: ubuntu-latest
env:
BUNDLEWATCH_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2.3.4
- uses: actions/checkout@v4

# Both components use this version
# Client components all use this version
- name: Use Node version for app builds
uses: actions/setup-node@v2.1.5
uses: actions/setup-node@v4
with:
node-version: 11.15.0
node-version: 18

- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
- name: Restore npm cache directory
uses: actions/cache@v2.1.5
uses: actions/cache@v4
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
Expand All @@ -47,33 +48,25 @@ jobs:
working-directory: client-admin
run: |
npm install
npm run build:webpack
npm run build:prod
- name: "Install & Build: client-participation"
working-directory: client-participation
run: |
npm install
cp polis.config.template.js polis.config.js
npm run deploy:prod
# So directory stays consistent between builds for comparison.
mv dist/cached/* dist/cached/xxxxxxxxx
npm run build:prod
- name: "Install & Build: client-report"
working-directory: client-report
run: |
npm install
npm run build:prod
- name: Install Bundlewatch
run: npm install -g bundlewatch@0.2.6
run: npm install -g bundlewatch@0.3.3

- name: "Run Bundlewatch"
# TODO: Move config to root directory, so easier to run against all components.
# See: https://github.com/bundlewatch/bundlewatch/pull/170
env:
CI_BRANCH_DEFAULT: ${{ github.event.repository.default_branch }}

PR_COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
PR_BRANCH: ${{ github.event.pull_request.head.ref }}
# Overrides `ci.repoBranchBase` (bundlewatch config)
PR_BRANCH_BASE: ${{ github.event.pull_request.base.ref }}

PUSH_COMMIT_SHA: ${{ github.event.after }}
# PUSH_BRANCH: see below (needs processing)
PUSH_BRANCH_BASE: ${{ github.event.repository.default_branch }}
# GITHUB_REF is in format `refs/heads/branch-name`, so need to strip first part.
run: PUSH_BRANCH=${GITHUB_REF#refs/heads/} npx bundlewatch --config .bundlewatch.config.js
uses: jackyef/bundlewatch-gh-action@master
with:
bundlewatch-github-token: ${{ secrets.GITHUB_TOKEN }}
bundlewatch-config: .bundlewatch.config.js
111 changes: 29 additions & 82 deletions .github/workflows/cypress-tests.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Changes to workflow name require changes to badge URL in README.md
name: E2E Tests

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

on:
push:
branches:
- dev
- edge
paths-ignore:
- "**.md"

Expand All @@ -14,102 +17,46 @@ on:

jobs:
cypress-run:
# Platform recommended in cypress-io/github-action docs.
runs-on: ubuntu-20.04
env:
# Use native docker command within docker-compose
COMPOSE_DOCKER_CLI_BUILD: 1
# Use buildkit to speed up docker command
DOCKER_BUILDKIT: 1
runs-on: ubuntu-latest
steps:
# This ensures only the most recently push commit will keep running.
- name: Cancel other active runs of this workflow
uses: rokroskar/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout
uses: actions/[email protected]

# 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 "DO_COMMENT_TRANSLATION=true" >> $GITHUB_ENV
fi
uses: actions/checkout@v4

- 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: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Set server configuration
- name: Build and start Docker containers
run: |
# Test email transport failovers
# mailgun: unconfigured transport (will fail)
# aws-ses: unconfigured transport (will fail)
# nonexistent: nonexistent transport (will fail)
# maildev: catch-all dev email server running in container (will work)
echo EMAIL_TRANSPORT_TYPES=mailgun,aws-ses,nonexistent,maildev >> server/docker-dev.env
- name: Ensure embed test html is served
run: cp e2e/cypress/fixtures/html/embed.html client-admin/embed.html
docker compose -f docker-compose.yml -f docker-compose.test.yml --env-file test.env --profile postgres up -d --build
- name: Serve app via docker-compose
run: docker-compose up --detach

- name: "Run Cypress tests: default"
uses: cypress-io/github-action@v2
env:
CYPRESS_BASE_URL: https://localhost
- name: Health Check the Server http response
uses: jtalk/url-health-check-action@v4
with:
working-directory: ./e2e
# Ignore all tests with pattern *.secrets.spec.js
spec: "**/polis/**/!(*.secrets).spec.js"
browser: chrome
url: http://localhost/api/v3/testConnection
max-attempts: 10
retry-delay: 10s

- name: "Run Cypress tests: comment translation"
if: env.DO_COMMENT_TRANSLATION
uses: cypress-io/github-action@v2
env:
CYPRESS_BASE_URL: https://localhost
- name: Cypress Run
uses: cypress-io/github-action@v6
with:
install: false
working-directory: ./e2e
spec: "**/comment-translation.secrets.spec.js"
# Prevent cypress from discarding screenshots/videos from default test run.
config: "trashAssetsBeforeRuns=false"
browser: chrome
config: baseUrl=http://localhost
spec: cypress/e2e/!(third-party)/**/*.cy.js
working-directory: e2e

# NOTE: screenshots will be generated only if E2E test failed
# thus we store screenshots only on failures
- name: Save screenshot artefacts
uses: actions/[email protected]
- name: Upload Cypress screenshots
uses: actions/upload-artifact@v4
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/[email protected]
if: always()
- name: Upload Cypress videos
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-videos
path: e2e/cypress/videos

- name: Check status of containers
if: failure()
run: docker-compose ps

- name: 'Check logs: server'
if: failure()
run: docker-compose logs server

- name: 'Check logs: nginx-proxy'
if: failure()
run: docker-compose logs nginx-proxy
- name: Stop Docker containers
if: always()
run: docker compose -f docker-compose.yml -f docker-compose.test.yml --env-file test.env --profile postgres down
8 changes: 4 additions & 4 deletions .github/workflows/depcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ jobs:
echo "name=HAS_SECRET" >> $GITHUB_ENV
- name: Use Node.js
uses: actions/setup-node@v2.1.5
uses: actions/setup-node@v4
with:
node-version: 14.4.0
node-version: 18

# See: https://github.com/taskworld/commit-status
- name: Install commit-status CLI tool
Expand All @@ -39,7 +39,7 @@ jobs:
commit-status pending "DepCheck / dependencies" "Detecting unused packages..."
commit-status pending "DepCheck / devDependencies" "Detecting unused packages..."
- uses: actions/checkout@v2.3.4
- uses: actions/checkout@v4

- name: Install depcheck CLI tool
run: npm install -g depcheck
Expand All @@ -58,7 +58,7 @@ jobs:
# - 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,prettier-config-standard,webpack-cli,gulp-cli"
DEPCHECK_IGNORES: "prettier,prettier-config-standard,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`.
Expand Down
41 changes: 0 additions & 41 deletions .github/workflows/deploy-preprod.yml

This file was deleted.

Loading

0 comments on commit e0c6a0f

Please sign in to comment.