Skip to content

Commit

Permalink
Merge branch 'main' into mrsa-nanopore-update
Browse files Browse the repository at this point in the history
  • Loading branch information
bebatut authored Mar 4, 2024
2 parents 2e4603f + 3e78ac7 commit 3fcf948
Show file tree
Hide file tree
Showing 65 changed files with 125,235 additions and 129 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/cron-commit-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: "[Cron] Update Commit Cache"
on:
workflow_dispatch:
schedule:
- cron: '45 0 * * 1'
jobs:
runner-job:
runs-on: ubuntu-latest
# Only run on main repo on and PRs that match the main repo.
if: |
github.repository == 'galaxyproject/training-material' &&
(github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name == github.repository)
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1000

# BEGIN Dependencies
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.0"
- uses: actions/cache@v2
with:
path: |
vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install dependencies
run: |
gem install bundler
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
bundle pristine ffi
# END Dependencies

- name: Update commit cache
id: generate
run: |
# Check if the oldest commit of the commit cache is known in this history
last_cached_commit=$(ls metadata/git-mod-*.txt | cut -d- -f 3 | cut -d. -f 1)
git show $last_cached_commit
ec=$?
if (( ec != 0 )); then
# Worst case, we need to fetch more. just fetch everything to be safe.
git fetch --unshallow
fi
ruby bin/commit-cache-update.rb >> $GITHUB_OUTPUT
- name: Create Pull Request
# If it's not a Pull Request then commit any changes as a new PR.
if: |
github.event_name != 'pull_request' &&
steps.generate.outputs.new_ids != ''
uses: peter-evans/create-pull-request@v3
with:
title: Update Cached Commit Data
branch-suffix: commitcache
commit-message: Update Cached Commit Data
add-paths: metadata/git-*.txt
9 changes: 8 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
# Avg commits between successive monday:
# Min. : 2.0
# 1st Qu.: 25.0
# Median : 54.5
# Mean : 65.2
# 3rd Qu.: 94.0
# Max. :282.0
fetch-depth: 400

# BEGIN Dependencies
- uses: actions/setup-python@v2
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion .github/workflows/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
fetch-depth: 200

# BEGIN Dependencies
- uses: ruby/setup-ruby@v1
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/monthly-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ jobs:

- uses: actions/checkout@v2
with:
fetch-depth: 0
# Based on logic in deploy.yml
fetch-depth: 1200

# BEGIN Dependencies
- uses: actions/setup-python@v2
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/video-dry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ jobs:
runs-on: ubuntu-latest
services:
# Label used to access the service container
mozillatts:
image: synesthesiam/mozillatts
ports:
- 5002:5002
# mozillatts:
# image: synesthesiam/mozillatts
# ports:
# - 5002:5002
steps:
# Shallow should be fine for video
- uses: actions/checkout@v2
with:
fetch-depth: 0
fetch-depth: 1

# BEGIN Dependencies
- uses: actions/setup-python@v2
Expand Down
58 changes: 58 additions & 0 deletions _layouts/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,62 @@ <h2 class="alert-heading">{{ site.announcement.title }}</h2>
<div class="row">
<div class="col-lg-7 col-md-7 col-sm-12">
<h2>Galaxy for Scientists</h2>
<p>We have separated the tutorials into several categories based on field and technology. We are exploring other ways to organise the tutorials going forward!</p>

<h3>Introduction</h3>
<table class="table table-striped">
<thead>
<tr>
<th scope="col">Topic</th>
<th scope="col">Tutorials</th>
</tr>
</thead>
<tbody>
{% for topic_name in sorted_topics %}
{% assign topic = site.data[topic_name] %}
{% if topic.name == "introduction" %}
{% if topic.draft != true or jekyll.environment != "production" %}
<tr>
{% assign tutorial_number = site | topic_filter_tutorial_count:topic.name %}
<td><a href="{{ site.baseurl }}/topics/{{ topic.name }}/">{{ topic.title }}</a>{% if topic.draft %} <div class="label label-default tutorial_tag" style="{{ 'work-in-progress' | colour_tag }}">work-in-progress</div>{% endif %}</td>
<td>{{ tutorial_number }}</td>
</tr>
{% endif %}
{% endif %}
{% endfor %}
</tbody>
</table>


<h3>Fields</h3>
<table class="table table-striped">
<thead>
<tr>
<th scope="col">Topic</th>
<th scope="col">Tutorials</th>
</tr>
</thead>
<tbody>
{% for topic_name in sorted_topics %}
{% assign topic = site.data[topic_name] %}
{% if topic.type == "use" %}
{% if topic.name != "introduction" %}
{% if topic.topic_type != "technology" %}
{% if topic.draft != true or jekyll.environment != "production" %}
<tr>
{% assign tutorial_number = site | topic_filter_tutorial_count:topic.name %}
<td><a href="{{ site.baseurl }}/topics/{{ topic.name }}/">{{ topic.title }}</a>{% if topic.draft %} <div class="label label-default tutorial_tag" style="{{ 'work-in-progress' | colour_tag }}">work-in-progress</div>{% endif %}</td>
<td>{{ tutorial_number }}</td>
</tr>
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
</tbody>
</table>

<h3>Technologies</h3>
<table class="table table-striped">
<thead>
<tr>
Expand All @@ -43,6 +99,7 @@ <h2>Galaxy for Scientists</h2>
{% for topic_name in sorted_topics %}
{% assign topic = site.data[topic_name] %}
{% if topic.type == "use" %}
{% if topic.topic_type == "technology" %}
{% if topic.draft != true or jekyll.environment != "production" %}
<tr>
{% assign tutorial_number = site | topic_filter_tutorial_count:topic.name %}
Expand All @@ -51,6 +108,7 @@ <h2>Galaxy for Scientists</h2>
</tr>
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
</tbody>
</table>
Expand Down
4 changes: 2 additions & 2 deletions _plugins/gtn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -511,10 +511,10 @@ def tutorials_over_time_bar_chart(site)
# https://stackoverflow.com/questions/71745593/how-to-do-a-single-line-cumulative-count-for-hash-values-in-ruby
graph
# Turns it into an array
.sort_by{|k, v| k}
.sort_by { |k, _v| k }
# Cumulative sum
.each_with_object([]) { |(k, v), a| a << [k, v + a.last&.last.to_i] }.to_h
.map{ |k, v| { 'x' => k, 'y' => v } }
.map { |k, v| { 'x' => k, 'y' => v } }
.to_json
end

Expand Down
76 changes: 73 additions & 3 deletions _plugins/gtn/mod.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def self.init_cache
@@TIME_CACHE = {}
@@COMMIT_COUNT_CACHE = Hash.new(0)
Jekyll.logger.info '[GTN/Time/Mod] Filling Time Cache'
`git log --name-only --pretty='GTN_GTN:%ct'`
cached_command
.split('GTN_GTN:')
.map { |x| x.split("\n\n") }
.select { |x| x.length > 1 }
Expand All @@ -26,6 +26,40 @@ def self.init_cache
end
end

def self.discover_caches
# Really there should only be one, but maybe someone's been silly so
# we'll just take the first one we find.
Dir.glob('metadata/git-mod-*.txt').first
end

def self.generate_cache
rev = `git rev-list -n 1 main`.strip

if discover_caches.nil?
File.write("metadata/git-mod-#{rev}.txt", command)
else
prev = discover_caches
results = cached_command
File.delete(prev)
File.write("metadata/git-mod-#{rev}.txt", results)
end
end

def self.cached_command
return command if discover_caches.nil?

Jekyll.logger.info '[GTN/Time/Mod] Using cached modification times'

previous_commit = discover_caches.split('-').last.split('.').first
previous = File.read(discover_caches)

`git log --name-only --pretty='GTN_GTN:%ct' #{previous_commit}..` + previous
end

def self.command
`git log --name-only --pretty='GTN_GTN:%ct'`
end

def self.time_cache
@@TIME_CACHE
end
Expand All @@ -51,6 +85,7 @@ def self.obtain_time(f)
begin
# Non git file.
@@TIME_CACHE[f] = File.mtime(f)
Jekyll.logger.warning "[GTN/Time/Mod] No git cached time available for #{f}, defaulting to checkout"
@@TIME_CACHE[f]
rescue StandardError
Time.at(0)
Expand Down Expand Up @@ -80,7 +115,7 @@ def self.init_cache
renames = {}

Jekyll.logger.info '[GTN/Time/Pub] Filling Publication Time Cache'
`git log --first-parent --name-status --diff-filter=AR --pretty='GTN_GTN:%ct' main`
cached_command
.split('GTN_GTN:')
.map { |x| x.split("\n\n") }
.select { |x| x.length > 1 }
Expand All @@ -100,6 +135,40 @@ def self.init_cache
# pp renames
end

def self.discover_caches
# Really there should only be one, but maybe someone's been silly so
# we'll just take the first one we find.
Dir.glob('metadata/git-pub-*.txt').first
end

def self.generate_cache
rev = `git rev-list -n 1 main`.strip

if discover_caches.nil?
File.write("metadata/git-pub-#{rev}.txt", command)
else
prev = discover_caches
results = cached_command
File.delete(prev)
File.write("metadata/git-pub-#{rev}.txt", results)
end
end

def self.cached_command
return command if discover_caches.nil?

Jekyll.logger.info '[GTN/Time/Pub] Using cached publication times'

previous_commit = discover_caches.split('-').last.split('.').first
previous = File.read(discover_caches)

`git log --first-parent --name-status --diff-filter=AR --pretty='GTN_GTN:%ct' #{previous_commit}..` + previous
end

def self.command
`git log --first-parent --name-status --diff-filter=AR --pretty='GTN_GTN:%ct' `
end

def self.time_cache
@@TIME_CACHE
end
Expand All @@ -112,6 +181,7 @@ def self.obtain_time(f)
begin
# Non git file.
@@TIME_CACHE[f] = File.mtime(f)
Jekyll.logger.warning "[GTN/Time/Pub] No git cached time available for #{f}, defaulting to checkout"
@@TIME_CACHE[f]
rescue StandardError
Time.at(0)
Expand All @@ -125,7 +195,7 @@ def self.obtain_time(f)
# Gtn::ModificationTimes.init_cache
# pp Gtn::ModificationTimes.commit_count_cache

puts ' Moved tobin/list-recently-modified.rb'
puts ' Moved to bin/list-recently-modified.rb'
# Gtn::PublicationTimes.init_cache
# Gtn::PublicationTimes.time_cache.select do |_, v|
# # Things in last 6 months
Expand Down
11 changes: 7 additions & 4 deletions _plugins/jekyll-tool-tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,24 @@ def render(context)
# check if a variable was provided for the tool id
tool = context[m[2].tr('{}', '')] || m[2]
version = tool.split('/').last
# url encode
q = URI.encode_www_form_component("?tool_id=#{tool}")
tool_redirect = "https://my.galaxy.training/?path=#{q}"

if tool.count('/').zero?
"<span class=\"tool\" data-tool=\"#{tool}\" title=\"#{m[1]} tool\" aria-role=\"button\">" \
"<a class=\"tool\" data-tool=\"#{tool}\" title=\"#{m[1]} tool\" href=\"#{tool_redirect}\">" \
'<i class="fas fa-wrench" aria-hidden="true"></i> ' \
"<strong>#{m[1]}</strong>" \
'</span>'
'</a>'
else
"<span class=\"tool\" data-tool=\"#{tool}\" title=\"#{m[1]} tool\" aria-role=\"button\">" \
"<a class=\"tool\" data-tool=\"#{tool}\" title=\"#{m[1]} tool\" href=\"#{tool_redirect}\">" \
'<i class="fas fa-wrench" aria-hidden="true"></i> ' \
"<strong>#{m[1]}</strong> " \
'(' \
'<i class="fas fa-cubes" aria-hidden="true"></i> ' \
"Galaxy version #{version}" \
')' \
'</span>'
'</a>'
end
else
%(<span><strong>#{@text}</strong> <i class="fas fa-wrench" aria-hidden="true"></i></span>)
Expand Down
Loading

0 comments on commit 3fcf948

Please sign in to comment.