Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lighthouse 1 #1

Open
wants to merge 11 commits into
base: lighthouse
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/lighthouse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: CI
on:
push:
branches: [ main, lighthouse-1 ]
pull_request:
branches: [ main ]
jobs:
lhci:
name: Lighthouse
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Lighthouse CI Action
uses: treosh/lighthouse-ci-action@v3
with:
urls: |
https://stable.publiclab.org/
https://stable.publiclab.org/notes/

configPath: './lighthouserc.json'
uploadArtifacts: true # save results as an action artifacts
temporaryPublicStorage: true # upload lighthouse report to the temporary storage:
96 changes: 64 additions & 32 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,82 @@
sudo: required

language: generic
language: ruby

rvm:
- 2.4.4

services:
- docker
- redis-server

addons:
mariadb: '10.2'

cache:
directories:
- $PWD/vendor/.bundle/
- $PWD/public/lib/

git:
depth: false

env:
global:
- COMPOSE_FILE=./containers/docker-compose-testing.yml
matrix:
- TASK="rake test:all"
- TASK="rails test test/unit"
- TASK="rails test test/functional"
- TASK="rails test test/integration"
- TASK="rails test:system"
- CI=true
- GENERATE_REPORT=true
- RAILS_ENV=test
- RAILS_SYSTEM_TESTING_SCREENSHOT=simple

before_install:
- echo -e "repo_token:\n $COVERALLS_REPO_TOKEN" >> ./.coveralls.yml

branches:
only:
- master
- unstable
- sudo wget https://chromedriver.storage.googleapis.com/73.0.3683.68/chromedriver_linux64.zip
- sudo unzip chromedriver_linux64.zip -d /usr/local/bin/
- sudo chmod +x /usr/local/bin/chromedriver
- google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
- yes | gem update --system --force
- gem install bundler

install:
- rm -rf test/reports
- cp config/database.yml.example config/database.yml
- cp db/schema.rb.example db/schema.rb
- docker-compose build
- docker-compose up -d
- docker-compose exec web sleep 15 # wait until mysql is up
- netstat -ltpn
- docker-compose exec web bash -c "rake db:setup"
- docker-compose exec web bash -c "rake db:migrate"
- docker-compose exec web bash -c "rake assets:precompile"
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then bash -c "docker-compose exec web gem install danger danger-junit google-cloud-storage"; fi'

script:
- docker-compose exec web bash -c 'echo "$GOOGLE_APPLICATION_CREDENTIALS_JSON" > /tmp/credentials.json' # needs to be a path to a json file, so we shuffle...
- docker-compose exec web bash -c "CI=TRUE GENERATE_REPORT=true $TASK"
- if [ $TASK != "rake test:all" ]; then
echo -e '<?xml version="1.0" encoding="UTF-8"?>' > output.xml;
tail -n +2 -q ./test/reports/TEST*.xml >> output.xml;
- bundle config set path 'vendor/.bundle/'
- bundle install
- gem list
- if [ $RAILS_ENV != 'production' ]; then
yarn check || yarn install;
fi
- if [ $TRAVIS_PULL_REQUEST != "false" ]; then
docker-compose exec web danger --verbose;
- mysql -e "CREATE DATABASE plots;";
- bundle exec rake db:schema:load
- bundle exec rake db:migrate
- if [ "$TRAVIS_PULL_REQUEST" == "true" ]; then
gem install danger danger-junit google-cloud-storage;
fi
- echo "$GOOGLE_APPLICATION_CREDENTIALS_JSON" > /tmp/credentials.json # needs to be a path to a json file, so we shuffle...

jobs:
include:
- name: "Unit Tests"
script: bundle exec rails test test/unit
- name: "Functional Tests"
script: bundle exec rails test test/functional
- name: "Integration Tests"
script: bundle exec rails test test/integration
- name: "System Tests"
script: bundle exec rails test:system
- name: "Run lighthouse"
script: lhci autorun

after_script:
- echo -e '<?xml version="1.0" encoding="UTF-8"?>' > output.xml;
- tail -n +2 -q ./test/reports/TEST*.xml >> output.xml
- if [ $TRAVIS_PULL_REQUEST == "true" ]; then
bundle exec danger --verbose;
fi

branches:
only:
- main
- unstable
- codecov
- lighthouse
- master
11 changes: 11 additions & 0 deletions lighthouserc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
ci: {
collect: {
url: ['http://localhost:3000/'],
startServerCommand: 'passenger start',
},
upload: {
target: 'temporary-public-storage',
},
},
};
16 changes: 16 additions & 0 deletions lighthouserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

{
"ci": {
"collect": {
"numberOfRuns": 5
},
"assert": {
"preset": "lighthouse:recommended",
"assertions": {
"render-blocking-resources": ["warn", { "numericValue": 0 }],
"uses-rel-preconnect": ["warn", { "numericValue": 0 }],
"maskable-icon": ["warn", { "minScore": 0.9 }]
}
}
}
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
"simple-data-grapher": "^2.0.0",
"typeahead.js": "^0.11.1",
"typeahead.js-browserify": "Javier-Rotelli/typeahead.js-browserify#~1.0.7",
"woofmark": "~4.2.0"
"woofmark": "~4.2.0",
"@lhci/cli":"^0.4.1"
},
"devDependencies": {},
"homepage": "https://github.com/publiclab/plots2",
Expand Down