Skip to content

Commit

Permalink
Github Actions: Dependencies update (#719)
Browse files Browse the repository at this point in the history
* chore: upgrade to latest versions of actions

* chore: change to octocov action for reportin coverage

* chore: update to octocov-action v1

* chore: add in octocov config

* chore: fix flaky samples table metadata toggle test

* chore: remove data-turbo-permanent from localtime elements in workflow executions and samples table and add in listener for turbo morph event to then run localtime js

* chore: fix assert in updated project samples test
  • Loading branch information
ericenns authored Aug 22, 2024
1 parent 376f3be commit 8425955
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 22 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/docs-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ jobs:

steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up PNPM
uses: pnpm/action-setup@v4
with:
version: 9
- name: Use Node.js 20
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
Expand All @@ -48,12 +48,12 @@ jobs:
- name: Build Docs Site
run: pnpm run build
- name: Setup Pages
uses: actions/configure-pages@v3
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: 'docs-site/build'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
uses: actions/deploy-pages@v4
6 changes: 2 additions & 4 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
with:
version: 9
- name: Use Node.js 20
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
Expand All @@ -63,6 +63,4 @@ jobs:
if-no-files-found: ignore
- name: Report coverage
if: github.event_name == 'pull_request'
uses: aki77/simplecov-report-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
uses: k1LoW/octocov-action@v1
2 changes: 1 addition & 1 deletion .github/workflows/sapporo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
with:
version: 7
- name: Use Node.js 19
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 19
cache: "pnpm"
Expand Down
16 changes: 16 additions & 0 deletions .octocov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
coverage:
if: true
acceptable: current >= 90%
diff:
datastores:
- artifact://${GITHUB_REPOSITORY}
push:
if: is_default_branch
comment:
if: is_pull_request
summary:
if: true
report:
if: is_default_branch
datastores:
- artifact://${GITHUB_REPOSITORY}
4 changes: 1 addition & 3 deletions app/components/samples/table_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,7 @@
<%= helpers.local_time(sample[column], :full_date) %>
<% elsif column == :updated_at || column == :attachments_updated_at %>
<% if sample[column].present? %>
<div data-turbo-permanent="true">
<%= helpers.local_time_ago(sample[column]) %>
</div>
<%= helpers.local_time_ago(sample[column]) %>
<% end %>
<% else %>
<%= sample[column.to_sym] %>
Expand Down
4 changes: 1 addition & 3 deletions app/components/workflow_executions/table_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@
<%= helpers.local_time(workflow_execution[column], :full_date) %>
<% elsif column == :updated_at || column == :attachments_updated_at %>
<% if workflow_execution[column].present? %>
<div data-turbo-permanent="true">
<%= helpers.local_time_ago(workflow_execution[column]) %>
</div>
<%= helpers.local_time_ago(workflow_execution[column]) %>
<% end %>
<% else %>
<%= workflow_execution[column.to_sym] %>
Expand Down
4 changes: 4 additions & 0 deletions app/javascript/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import LocalTime from "local-time"
LocalTime.start()
ActiveStorage.start();

document.addEventListener("turbo:morph", () => {
LocalTime.run()
})

Turbo.setConfirmMethod((message, element) => {
const dialog = document.getElementById("turbo-confirm");
if (!dialog) {
Expand Down
8 changes: 6 additions & 2 deletions test/system/groups/samples_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -315,13 +315,17 @@ def retrieve_puids

test 'should be able to toggle metadata' do
visit group_samples_url(@group)

assert_text strip_tags(Viral::Pagy::LimitComponent.translate('.summary', from: 1, to: 20, count: 26,
locale: @user.locale))
assert_selector 'table thead tr th', count: 6

click_on 'Last Updated'
assert_selector 'table thead th:nth-child(5) svg.icon-arrow_up'

assert_selector 'label', text: I18n.t('groups.samples.index.search.metadata'), count: 1
assert_selector 'table thead tr th', count: 6
find('label', text: I18n.t('groups.samples.index.search.metadata')).click
wait_for_network_idle

assert_selector 'table thead tr th', count: 8
within('table tbody tr:first-child') do
assert_text @sample30.name
Expand Down
16 changes: 12 additions & 4 deletions test/system/projects/samples_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ class SamplesTest < ApplicationSystemTestCase
project2 = projects(:project2)
visit namespace_project_samples_url(namespace_id: @namespace.path, project_id: @project.path)
assert_text strip_tags(Viral::Pagy::LimitComponent.translate('.summary', from: 1, to: 3, count: 3,
locale: user.locale))
locale: @user.locale))
within '#samples-table table tbody' do
assert_selector 'tr', count: 3
all('input[type=checkbox]').each { |checkbox| checkbox.click unless checkbox.checked? }
Expand Down Expand Up @@ -535,7 +535,7 @@ class SamplesTest < ApplicationSystemTestCase
assert_selector 'a', text: I18n.t('projects.samples.index.new_button'), count: 0
assert_selector 'h1', text: I18n.t('projects.samples.index.title')
assert_text strip_tags(Viral::Pagy::LimitComponent.translate('.summary', from: 1, to: 3, count: 3,
locale: @user.locale))
locale: user.locale))
assert_selector '#samples-table table tbody tr', count: 3
assert_selector 'a', text: 'Edit', count: 0
assert_selector 'a', text: 'Remove', count: 0
Expand Down Expand Up @@ -1291,11 +1291,19 @@ class SamplesTest < ApplicationSystemTestCase

test 'should be able to toggle metadata' do
visit namespace_project_samples_url(@namespace, @project)
assert_selector 'label', text: I18n.t(:'projects.samples.shared.metadata_toggle.label'), count: 1

assert_text strip_tags(Viral::Pagy::LimitComponent.translate('.summary', from: 1, to: 3, count: 3,
locale: @user.locale))
assert_selector '#samples-table table thead tr th', count: 6

click_on 'Last Updated'
assert_selector 'table thead th:nth-child(4) svg.icon-arrow_up'

assert_selector 'label', text: I18n.t(:'projects.samples.shared.metadata_toggle.label'), count: 1
find('label', text: I18n.t('projects.samples.shared.metadata_toggle.label')).click

assert_selector '#samples-table table thead tr th', count: 8
within('#samples-table table tbody tr:nth-child(3)') do
within('#samples-table table tbody tr:first-child') do
assert_text @sample3.name
assert_selector 'td:nth-child(6)', text: 'value1'
assert_selector 'td:nth-child(7)', text: 'value2'
Expand Down

0 comments on commit 8425955

Please sign in to comment.