Skip to content

Commit

Permalink
Merge branch 'main' into bytesize_transcript_mentoring
Browse files Browse the repository at this point in the history
  • Loading branch information
christopher-hakkaart authored Aug 10, 2023
2 parents b5d2fac + 2a45fc0 commit 59c5af8
Show file tree
Hide file tree
Showing 165 changed files with 64,069 additions and 4,380 deletions.
Binary file modified .cache.tar.xz
Binary file not shown.
11 changes: 6 additions & 5 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ menu:
main:
weight: 10
---
# nf-core/nf-co.re - Contributing Guidelines

# nf-core/website - Contributing Guidelines

Hi there! Many thanks for taking an interest in improving the nf-core website.

Expand Down Expand Up @@ -43,14 +44,14 @@ Please note that`nf-co.re` website makes use of the `light/dark` mode so it's re

## Contribution workflow

If you'd like to write some code for nf-core/nf-co.re, the standard workflow
If you'd like to write some code for nf-core/website, the standard workflow
is as follows:

1. Check that there isn't already an issue about your idea in the
[nf-core/nf-co.re issues](https://github.com/nf-core/nf-co.re/issues) to avoid
[nf-core/website issues](https://github.com/nf-core/website/issues) to avoid
duplicating work.
- If there isn't one already, please create one so that others know you're working on this
2. Fork the [nf-core/nf-co.re repository](https://github.com/nf-core/nf-co.re) to your GitHub account
2. Fork the [nf-core/website repository](https://github.com/nf-core/website) to your GitHub account
3. Make the necessary changes / additions within your forked repository
4. Submit a Pull Request against the `main` branch and wait for the code to be reviewed and merged.

Expand All @@ -64,4 +65,4 @@ For now, the only test is for Markdown syntax, using the `markdownlint` package.

## Getting help

For further information/help, please consult the [nf-core/nf-co.re documentation](https://github.com/nf-core/nf-co.re#documentation) and don't hesitate to get in touch on the nf-core `tools` channel on [Slack](https://nf-co.re/join/slack/).
For further information/help, please consult the [nf-core/website documentation](https://github.com/nf-core/website#documentation) and don't hesitate to get in touch on the nf-core `tools` channel on [Slack](https://nf-co.re/join/slack/).
60 changes: 54 additions & 6 deletions .github/workflows/build-json-files-and-md-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,20 @@ jobs:
build-component-json:
runs-on: ubuntu-latest
environment: static-file-build
if: (github.event_name == 'schedule' && github.repository == 'nf-core/website') || (github.event_name != 'schedule')

steps:
# Set up the main website repo
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Don't do a shallow clone
token: ${{secrets.NF_CORE_BOT_AUTH_TOKEN}} # Needed for pushing back to the repo

# install npm dependencies
- name: Set up node.js
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 18
cache: 'npm'
- run: npm install

Expand All @@ -34,14 +36,60 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.PIPLINE_JSON_BUILD_TOKEN }}


- name: make md cache
run: node bin/build-cache.js && tar -czvf .cache.tar.gz .cache
run: node bin/build-cache.js && tar -cvJf .cache.tar.xz .cache
env:
GITHUB_TOKEN: ${{ secrets.CREATE_CACHE_MD_TOKEN }}

# Commit and push the changes
# check lines if too many lines of code have been changed in /public/pipelines.json and /pulic/components.json
# also check if .cache.tar.xz is smaller than before (shouldn't happen)
- name: check lines
run: |
diff_output=$(git diff --shortstat public/pipelines.json public/components.json)
lines_added=$(echo $diff_output | awk '{print $4}')
lines_removed=$(echo $diff_output | awk '{print $6}')
changes=$((lines_added - lines_removed))
if (($changes < -100)) || (($changes > 100)); then
file_size_before=$(echo $diff_output | awk '{print $4}')
file_size_after=$(echo $diff_output | awk '{print $6}')
changes=true
fi
if [ ! $changes ]; then
diff_output=$(git diff --stat .cache.tar.xz)
file_size_before=$(echo $diff_output | awk '{print $4}')
file_size_after=$(echo $diff_output | awk '{print $6}')
changes_tmp=$((file_size_before - file_size_after))
if ((changes_tmp > 0)); then
changes=true
else
changes=false
fi
fi
echo "changes=$changes" >> "$GITHUB_OUTPUT"
# Commit and push the changes if there are not too many lines changed
- name: Commit and push changes
uses: EndBug/add-and-commit@v9
if: ${{ !steps.check_lines.outputs.changes }}
run: |
git config user.email "core@nf-co.re"
git config user.name "nf-core-bot"
git config push.default upstream
git status
git diff --quiet || (git commit -am "[automated] Update json files and markdown cache" && git push)
# Create a PR if there are too many lines changed
- name: Create PR with changes
if: ${{ steps.check_lines.outputs.changes }}
uses: peter-evans/create-pull-request@v5
with:
default_author: github_actions
token: ${{ secrets.CREATE_PR_TOKEN }}
commit-message: 'chore: update pipeline.json and component.json'
title: 'chore: update pipeline.json and component.json'
body: 'This PR was automatically created by a GitHub Action because there were too many lines changed in the pipeline.json and component.json files.'
branch: 'chore/update-pipeline-json-and-component-json'
delete-branch: true
draft: false
2 changes: 1 addition & 1 deletion .github/workflows/fix-linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
if: >
contains(github.event.comment.html_url, '/pull/') &&
contains(github.event.comment.body, '@nf-core-bot fix linting') &&
github.repository == 'nf-core/nf-co.re'
github.repository == 'nf-core/website'
runs-on: ubuntu-latest
steps:
# Use the @nf-core-bot token to check out so we can push later
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ pnpm-debug.log*

# Local Netlify folder
.netlify
src/content/pipelines
7 changes: 4 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ repos:
rev: 'v2.7.1'
hooks:
- id: prettier
additional_dependencies: [prettier@2.7.1, prettier-plugin-svelte@^2.10.1, prettier-plugin-astro@^0.10.0]
additional_dependencies:
- prettier@2.7.1
- prettier-plugin-svelte@^2.7.1
- prettier-plugin-astro@^0.10.0
args: [--plugin=prettier-plugin-svelte, --plugin=prettier-plugin-astro]
files: \.(astro|svelte)$


10 changes: 8 additions & 2 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,24 @@ module.exports = {
// TODO: REMOVE SINGLE QUOTES CONFIG LATER
// Leaving it for now to minimise diffs, but double quote is more consistent with the rest of nf-core
singleQuote: true,
trailingComma: 'all',
//////

printWidth: 120,

// pnpm support, for VSCode?
plugins: [require.resolve('prettier-plugin-astro')],
plugins: [require.resolve('prettier-plugin-astro'), require.resolve('prettier-plugin-svelte')],
overrides: [
{
files: '*.astro',
options: {
parser: 'astro',
},
},
{
files: '*.svelte',
options: {
parser: 'svelte',
},
},
],
};
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Code of Conduct
description: The nf-core code of conduct
md_github_url: https://github.com/nf-core/nf-co.re/blob/main/CODE_OF_CONDUCT.md
md_github_url: https://github.com/nf-core/website/blob/main/CODE_OF_CONDUCT.md
---

# Code of Conduct at nf-core (v1.4)
Expand Down
35 changes: 4 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<img src="public/images/nf-core-logo.svg#gh-light-mode-only" width="400">
<img src="public/images/nf-core-logo-darkbg.svg#gh-dark-mode-only" width="400">

# [nf-co.re](https://github.com/nf-core/nf-co.re)
# [nf-co.re](https://github.com/nf-core/website)

This repository contains code for the nf-core website: **<http://nf-co.re/>**

Expand All @@ -24,8 +24,8 @@ Here's how the website is built:
To make edits to the website, fork the repository to your own user on GitHub and then clone to your local system.

```bash
gh repo fork nf-core/nf-co.re
cd nf-co.re/
gh repo fork nf-core/website nf-core_website
cd nf-core_website/
```

### Installing dependencies
Expand Down Expand Up @@ -71,38 +71,11 @@ npm run build-component-json
npm run build-cache-force
```

<!-- ## Production Server Setup
### Deployment
The website is deployed via GitHub Actions ([`.github/workflows/web-deploy.yml`](https://github.com/nf-core/nf-co.re/blob/master/.github/workflows/web-deploy.yml)).
This script runs PHP composer and npm, then syncs the required files to the web server via FTP. -->

### Tools API docs

Tools docs are built using GitHub Actions on the nf-core/tools repo using Sphinx.
[These actions](https://github.com/nf-core/tools/blob/master/.github/workflows/tools-api-docs-release.yml) sync the built HTML files via FTP.

<!-- ### GitHub web hooks
There is a GitHub web hook at the nf-core organisation level which triggers the pipeline update script whenever a repo is created, or has a release etc.
This pings the `deploy_pipelines.php` script. -->

<!-- ### Stats cronjob
The web server needs the following cronjobs running to scrape statistics and udates:
```cron
0 0 * * * /usr/local/bin/php /path/to/deployment/update_stats.php >> /home/nfcore/update.log 2>&1
0 2 * * * /usr/local/bin/php /path/to/deployment/update_issue_stats.php >> /home/nfcore/update.log 2>&1
0 0 * * 0 /usr/local/bin/php /path/to/deployment/update_fontawesome_icons.php >> /home/nfcore/update.log 2>&
```
Remember to replace `/path/to/deployment/` with your actual deployment directory.
The `update_issue_stats.php` script can use a lot of GitHub API calls, so should run at least one hour after the `update_stats.php` script last finished.
This is not because the script takes an hour to run, but because the GitHub API rate-limiting counts the number of calls within an hour. -->

## Contribution guidelines

If you are looking forward to contribute to the website or add your institution to the official list of contributors, please have a look at the [CONTRIBUTING.md](./.github/CONTRIBUTING.md).
Expand All @@ -116,6 +89,6 @@ If you have any questions or issues please send us a message on [Slack](https://
Phil Ewels ([@ewels](http://github.com/ewels/)) built the initial website, but there have been many contributors to the content and documentation.
Matthias Hörtenhuber ([@mashehu](https://github.com/mashehu)) worked on the concept and code for the new website rewrite.

See the [repo contributors](https://github.com/nf-core/nf-co.re/graphs/contributors) for more details.
See the [repo contributors](https://github.com/nf-core/website/graphs/contributors) for more details.

Kudos to the excellent [npm website](https://www.npmjs.com), which provided inspiration for the design of the pipeline pages.
17 changes: 17 additions & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import admonitionsPlugin from './bin/remark-admonitions.js';
import { mermaid } from './bin/remark-mermaid.ts';
import pipelines_json from '/public/pipelines.json';
import githubDarkDimmed from '/public/themes/github-dark-dimmed.json';
import mdx from '@astrojs/mdx';
import netlify from '@astrojs/netlify/functions';
Expand All @@ -24,6 +25,16 @@ import emoji from 'remark-emoji';
import remarkGfm from 'remark-gfm';
import remarkMath from 'remark-math';


const latestToolsRelease = await fetch('https://api.github.com/repos/nf-core/tools/releases/latest')
.then((res) => res.json())
.then((json) => json.tag_name);
let latestPipelineReleases = {};

pipelines_json.remote_workflows.map(
(pipeline) => (latestPipelineReleases[pipeline.name] = `/${pipeline.name}/${pipeline.releases[0].tag_name}/`),
);
const latestTollsURL = `/tools/docs/'+${latestToolsRelease}`;
// https://astro.build/config
export default defineConfig({
site: 'https://nf-co.re/',
Expand All @@ -32,6 +43,10 @@ export default defineConfig({
assets: true,
},
adapter: netlify(),
redirects: {
[latestTollsURL]: 'https://oldsite.nf-co.re/tools/docs/latest/',
...latestPipelineReleases,
},
integrations: [
svelte(),
sitemap(),
Expand All @@ -47,6 +62,7 @@ export default defineConfig({
],
build: {
inlineStylesheets: 'auto',
format: 'file',
},
vite: {
plugins: [
Expand All @@ -55,6 +71,7 @@ export default defineConfig({
// avoid flash of unstyled text by interjecting fallback system fonts https://developer.chrome.com/blog/framework-tools-font-fallback/#using-fontaine-library
fallbacks: ['BlinkMacSystemFont', 'Segoe UI', 'Helvetica Neue', 'Arial', 'Noto Sans'],
resolvePath: (id) => new URL(`./public${id}`, import.meta.url),
skipFontFaceGeneration: (fallbackName) => fallbackName === 'Font Awesome 6 Pro) fallback',
}),
],
ssr: {
Expand Down
6 changes: 3 additions & 3 deletions bin/build-cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ export const buildCache = async () => {
cache.set(cache_key, content);
// console.log(`Cached ${cache_key}`);
} else {
console.log(`Already cached ${cache_key}`);
// console.log(`Already cached ${cache_key}`);
}
})
}),
);
}

bar.tick();
bar.tick();
}
return true;
};
Expand Down
11 changes: 5 additions & 6 deletions bin/components.json.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import path, { join } from 'path';
import ProgressBar from 'progress';
import { parse } from 'yaml';


// get current path
const __dirname = path.resolve();

Expand Down Expand Up @@ -66,14 +65,14 @@ export const writeComponentsJson = async () => {
components.modules.push(module);
}
bar.tick();
})
}),
);

// Fetch subworkflows concurrently
const subworkflows = tree
.filter(
(file) =>
file.path.includes('meta.yml') && file.path.includes('subworkflows/') && !file.path.includes('homer/groseq')
file.path.includes('meta.yml') && file.path.includes('subworkflows/') && !file.path.includes('homer/groseq'),
)
.map((file) => ({
name: file.path.replace('subworkflows/nf-core/', '').replace('/meta.yml', ''),
Expand Down Expand Up @@ -120,7 +119,7 @@ export const writeComponentsJson = async () => {
}

bar.tick();
})
}),
);

// Update pipelines that use modules and subworkflows
Expand All @@ -139,7 +138,7 @@ export const writeComponentsJson = async () => {
components.modules[index].pipelines = [entry];
}
}
})
}),
);
}

Expand All @@ -155,7 +154,7 @@ export const writeComponentsJson = async () => {
components.subworkflows[index].pipelines = [entry];
}
}
})
}),
);
}
}
Expand Down
Loading

0 comments on commit 59c5af8

Please sign in to comment.