Skip to content

Commit

Permalink
Merge branch 'redesign2023' of https://github.com/nearform/bioconduct…
Browse files Browse the repository at this point in the history
…or.org into nearform-redesign2023
  • Loading branch information
lshep committed Aug 24, 2023
2 parents 229b8e9 + 05b39bb commit a61bbe9
Show file tree
Hide file tree
Showing 230 changed files with 13,116 additions and 4,293 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
assets/js/search.js
assets/js/bioconductor.js
assets/js/bioc_views.js
14 changes: 14 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"env": {
"browser": true,
"es2021": true,
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {}
}
35 changes: 35 additions & 0 deletions .github/workflows/linter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Run Linters
on:
pull_request:
types: [opened, reopened, synchronize]

jobs:
build:
if: github.event.pull_request.draft == false
name: Run Linters
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
statuses: write
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Lint Code Base
uses: super-linter/super-linter/slim@v5
env:
LINTER_RULES_PATH: /
VALIDATE_ALL_CODEBASE: false
VALIDATE_GITHUB_ACTIONS: false
VALIDATE_MARKDOWN: false
VALIDATE_NATURAL_LANGUAGE: false
VALIDATE_JSCPD: false
VALIDATE_JSON: false
VALIDATE_R: false
VALIDATE_RUBY: false
VALIDATE_JAVASCRIPT_STANDARD: false
JAVASCRIPT_ES_CONFIG_FILE: .eslintrc.json
DEFAULT_BRANCH: redesign2023
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32 changes: 32 additions & 0 deletions .github/workflows/pr_close.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: PR - Closed
on:
pull_request:
types: [closed]

jobs:
dev-pr-close-s3:
runs-on: ubuntu-latest
environment: dev
steps:
- name: Empty Website Bucket
run: |
if aws s3api head-bucket --bucket pr-preview-bioconductor-pr${{github.event.number}} 2>/dev/null; then
aws s3 rm s3://pr-preview-bioconductor-pr${{github.event.number}} --recursive
echo "BUCKET_EXISTS=true" >> "$GITHUB_ENV"
else
echo "Bucket does not exist"
echo "BUCKET_EXISTS=false" >> "$GITHUB_ENV"
fi
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: "us-east-1"
- name: Delete Website Bucket
if: ${{env.BUCKET_EXISTS == 'true'}}
uses: danburtenshaw/[email protected]
with:
bucket-prefix: "pr-preview-bioconductor"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107 changes: 107 additions & 0 deletions .github/workflows/pr_deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: Pr - Preview
on:
pull_request:
types: [opened, reopened, synchronize]
jobs:
dev-pr-create-s3:
if: github.event.pull_request.draft == false

runs-on: ubuntu-latest
environment: dev
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Restore Nanoc Cache
id: cache-nanoc-tmp
uses: actions/cache/restore@v3
with:
path: tmp
key: ${{ runner.os }}-nanoc-tmp

- name: Restore Site Output Cache
id: cache-site-output
uses: actions/cache/restore@v3
with:
path: output
key: ${{ runner.os }}-site-output

- name: Set up ruby
uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1
with:
ruby-version: "2.6.5"

- name: Install dependencies
run: bundle install --jobs 4 --retry 3

- name: build website
run: rake

- name: Create Bucket
run: |
if aws s3api head-bucket --bucket pr-preview-bioconductor-pr${{github.event.number}} 2>/dev/null; then
echo "Bucket already exists"
else
aws s3 mb s3://pr-preview-bioconductor-pr${{github.event.number}}
aws s3api delete-public-access-block --bucket pr-preview-bioconductor-pr${{github.event.number}}
aws s3api delete-bucket-ownership-controls --bucket pr-preview-bioconductor-pr${{github.event.number}}
aws s3api put-bucket-website --bucket pr-preview-bioconductor-pr${{github.event.number}} \
--website-configuration '{"IndexDocument":{"Suffix":"index.html"},"ErrorDocument":{"Key":"404.html"}}'
fi
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: "us-east-1"
- name: Deploy S3 Website
uses: danburtenshaw/[email protected]
with:
bucket-prefix: "pr-preview-bioconductor"
folder-to-copy: "./output"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
kpi_metrics:
needs: dev-pr-create-s3
permissions:
pull-requests: write
name: All KPI metrics
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: Setup Node.js environment
uses: actions/[email protected]
with:
node-version: 18
- name: install psi and axe
run: |
npm install psi
npm install @axe-core/cli
- name: run desktop psi
run: |
echo "DESKTOP_PSI_RESULTS<<EOF" >> $GITHUB_ENV
echo "$(node PageSpeed.js url=http://pr-preview-bioconductor-pr${{github.event.number}}.s3-website-us-east-1.amazonaws.com,strategy=desktop,threshold=50,apiKey=none)" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: run mobile psi
run: |
echo "MOBILE_PSI_RESULTS<<EOF" >> $GITHUB_ENV
echo "$(node PageSpeed.js url=http://pr-preview-bioconductor-pr${{github.event.number}}.s3-website-us-east-1.amazonaws.com,strategy=mobile,threshold=50,apiKey=none)" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: add_comment_pageSpeed
uses: mshick/add-pr-comment@v2
with:
message: |
${{env.DESKTOP_PSI_RESULTS}}
${{env.MOBILE_PSI_RESULTS}}
message-id: psi
- name: run axe accesibility test
run: |
echo "AXE_RESULTS<<EOF" >> $GITHUB_ENV
echo "$(npx axe http://pr-preview-bioconductor-pr${{github.event.number}}.s3-website-us-east-1.amazonaws.com)" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: add_comment_axe
uses: mshick/add-pr-comment@v2
with:
message: ${{env.AXE_RESULTS}}
message-id: axe
99 changes: 99 additions & 0 deletions .github/workflows/staging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Deploy To staging

on:
push:
branches:
- redesign2023
jobs:
staging-deploy:
concurrency: ci-${{ github.ref }}
runs-on: ubuntu-latest
environment: staging

steps:
- name: checkout
uses: actions/checkout@v3

- name: Use Nanoc Cache
id: cache-nanoc-tmp
uses: actions/cache@v3
with:
path: tmp
key: ${{ runner.os }}-nanoc-tmp

- name: Use Site Output Cache
id: cache-site-output
uses: actions/cache@v3
with:
path: output
key: ${{ runner.os }}-site-output

- name: Set up ruby
uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1
with:
ruby-version: "2.6.5"

- name: Install dependencies
run: bundle install --jobs 4 --retry 3

- name: Build website
run: rake

- name: Deploy website to staging s3
uses: Reggionick/[email protected]
with:
folder: output
bucket: ${{secrets.S3_BUCKET}}
bucket-region: us-east-1
delete-removed: true
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
kpi_metrics:
needs: staging-deploy
permissions:
pull-requests: write
name: All KPI metrics
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: Setup Node.js environment
uses: actions/[email protected]
with:
node-version: 18
- name: install psi and axe
run: |
npm install psi
npm install @axe-core/cli
- name: run desktop psi
run: |
echo "DESKTOP_PSI_RESULTS<<EOF" >> $GITHUB_ENV
echo "$(node PageSpeed.js url=${{vars.STAGING_URL}},strategy=desktop,threshold=50,apiKey=none)" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: run mobile psi
run: |
echo "MOBILE_PSI_RESULTS<<EOF" >> $GITHUB_ENV
echo "$(node PageSpeed.js url=${{vars.STAGING_URL}},strategy=mobile,threshold=50,apiKey=none)" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: run axe accesibility test
run: |
echo "AXE_RESULTS<<EOF" >> $GITHUB_ENV
echo "$(npx axe ${{vars.STAGING_URL}})" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: send notification psi
if: ${{ github.ref == 'refs/heads/redesign2023' }}
uses: 8398a7/action-slack@v2
with:
status: ${{ job.status }}
text: "${{env.DESKTOP_PSI_RESULTS}} \n ${{env.MOBILE_PSI_RESULTS}}"
env:
SLACK_WEBHOOK_URL: ${{secrets.SLACK_WEBHOOK}}
- name: send notification axe
if: ${{ github.ref == 'refs/heads/redesign2023' }}
uses: 8398a7/action-slack@v2
with:
status: ${{ job.status }}
text: "${{env.AXE_RESULTS}}"
env:
SLACK_WEBHOOK_URL: ${{secrets.SLACK_WEBHOOK}}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ assets/help/workflows/*
workflows_tmp/
content/help/workflows/*
postgresql_password
manifest/*
manifest/*
node_modules/
package
21 changes: 21 additions & 0 deletions .htmlhintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"doctype-first": false,
"spec-char-escape": false,
"head-script-disabled": true,
"style-disabled": true,
"attr-lowercase": true,
"attr-no-duplications": true,
"attr-no-unnecessary-whitespace": true,
"attr-value-single-quotes": false,
"attr-value-double-quotes": true,
"attr-whitespace": true,
"alt-require": true,
"input-requires-lable": true,
"tag-pair": false,
"tagname-lowercase": true,
"tagname-specialchars": true,
"src-not-empty": true,
"id-class-value": "dash",
"inline-script-disabled": true,
"inline-style-disabled": true
}
3 changes: 3 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["stylelint-config-standard"]
}
37 changes: 20 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
FROM ruby:2.6.5

## System dependencies

RUN apt-get update && apt install -y \
rsync \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y \
rsync \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

## Install gems
COPY Gemfile /opt
COPY Gemfile.lock /opt

## Set the working directory to /opt/bioconductor.org
WORKDIR /opt/bioconductor.org

## Copy the remaining files from bioconductor.org/ to /opt/bioconductor.org
COPY . .

COPY Gemfile /tmp
COPY Gemfile.lock /tmp
WORKDIR /tmp
## RUN bundle lock
## Install bundle and dependencies
RUN gem install bundler
RUN bundle install --jobs=4 && bundle clean --force

## Set up web server

EXPOSE 3000

## Create startup script

RUN echo '#! /bin/bash \n\
cd /bioconductor.org \n\
rake \n\
cd output \n\
adsf\n' > .startup.sh \\
RUN echo '#! /bin/bash' > .startup.sh \
&& echo 'cd /opt/bioconductor.org' >> .startup.sh \
&& echo 'rake' >> .startup.sh \
&& echo 'cd output' >> .startup.sh \
&& echo 'adsf' >> .startup.sh \
&& chmod +x .startup.sh

CMD ["./.startup.sh"]
CMD ["/opt/bioconductor.org/.startup.sh"]
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
raise 'Ruby version must be 2.3 or greater' unless RUBY_VERSION.to_f >= 2.3
source 'http://rubygems.org'
gem "nanoc", "~> 4.0"
gem "nanoc", "~> 4.9.5"
gem "pry"
gem "pry-byebug"
gem "rdiscount"
Expand Down
Loading

0 comments on commit a61bbe9

Please sign in to comment.