Skip to content
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
48 changes: 39 additions & 9 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,39 @@
*
!requirements.txt
!Cargo.toml
!Cargo.lock
!utils
!openssl
!uv.lock
!pyproject.toml
!Makefile
# Exclude build and development files
.git/
.github/
*.nf
workflows/
tests/
containers/
Dockerfile.old
.dockerignore
.gitignore
.pre-commit-config.yaml
pytest.ini
.python-version
RELEASE.rst
LICENSE
README.md
*.md

# Python artifacts
__pycache__/
*.py[cod]
*$py.class
.pytest_cache/
.coverage
htmlcov/
*.egg-info/
dist/
build/

# IDE
.vscode/
.idea/
*.swp
*.swo
*~

# OS
.DS_Store
Thumbs.db
68 changes: 68 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,75 @@ jobs:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
MSG_MINIMAL: true

wait-for-rust-build:
runs-on: ubuntu-latest
outputs:
rust_changed: ${{ steps.check-rust.outputs.changed }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2

- name: Check if Rust files changed
id: check-rust
run: |
if git diff --name-only HEAD^ HEAD | grep -qE '^(utils/|Cargo\.(toml|lock))'; then
echo "changed=true" >> $GITHUB_OUTPUT
echo "Rust files changed, waiting for rust-container workflow..."
else
echo "changed=false" >> $GITHUB_OUTPUT
echo "No Rust changes, skipping wait"
fi

- name: Wait for Rust container build
if: steps.check-rust.outputs.changed == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Waiting for rust-container workflow to complete..."
sleep 10 # Give workflow time to start
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will 10 seconds be enough?


# Wait up to 30 minutes for rust-container workflow to complete
timeout=1800
elapsed=0
while [ $elapsed -lt $timeout ]; do
# Check for running or completed rust-container workflows for this commit
status=$(gh run list \
--workflow=rust-container.yaml \
--commit=${{ github.sha }} \
--json status,conclusion \
--jq '.[0] | "\(.status):\(.conclusion)"')

if [ -z "$status" ]; then
echo "No rust-container workflow found yet, waiting..."
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
echo "No rust-container workflow found yet, waiting..."
echo "Warning: rust-container workflow not found yet, waiting..."

sleep 10
elapsed=$((elapsed + 10))
continue
fi

workflow_status=$(echo "$status" | cut -d: -f1)
workflow_conclusion=$(echo "$status" | cut -d: -f2)

if [ "$workflow_status" = "completed" ]; then
if [ "$workflow_conclusion" = "success" ]; then
echo "✓ Rust container build completed successfully"
exit 0
else
echo "✗ Rust container build failed with conclusion: $workflow_conclusion"
exit 1
fi
fi

echo "Rust container build status: $workflow_status (elapsed: ${elapsed}s)"
sleep 15
elapsed=$((elapsed + 15))
done

echo "✗ Timeout waiting for rust-container workflow"
exit 1

create-docker-image:
needs: wait-for-rust-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/rust-container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# GitHub Actions workflow for building and pushing Rust utilities container
# Rebuilds when Rust code changes (utils/**, Cargo.toml, Cargo.lock)

name: Build Rust Utilities Container

on:
push:
branches: ['master', 'dev']
paths:
- 'utils/**'
- 'Cargo.toml'
- 'Cargo.lock'
- 'containers/rust-utils/**'
- '.github/workflows/rust-container.yaml'
workflow_dispatch:
inputs:
force_rebuild:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The force_rebuild input is defined but never used in the workflow?

description: 'Force rebuild Rust utilities container'
required: false
type: boolean
default: false

jobs:
build-rust-utils:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Docker login
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: docker login -u $DOCKER_USER -p $DOCKER_PASSWORD

- name: Build Rust utilities container
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow will continue pushing even if the build fails. Consider adding:

Suggested change
- name: Build Rust utilities container
- name: Build Rust utilities container
if: success() # Only push if build succeeded

run: docker build -t rnacentral/rust-utils:latest -f containers/rust-utils/Dockerfile .

- name: Push to Docker Hub
run: docker push rnacentral/rust-utils:latest

- name: Slack notification
if: always()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_MESSAGE: 'Rust utilities container built and pushed: ${{ job.status }}'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
MSG_MINIMAL: true
119 changes: 119 additions & 0 deletions .github/workflows/tool-containers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# GitHub Actions workflow for building and pushing tool containers
# These containers cache slow-to-build bioinformatics tools (Infernal, Samtools)

name: Build and Push Tool Containers

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like this

Suggested change
env:
INFERNAL_VERSION: "1.1.2"
SAMTOOLS_VERSION: "1.18"

or creating version files might be preferable than hardcoding x3 times

# containers/infernal/VERSION
1.1.2

on:
push:
branches: ['master', 'dev']
paths:
- 'containers/infernal/**'
- 'containers/samtools/**'
- '.github/workflows/tool-containers.yaml'
workflow_dispatch:
inputs:
force_rebuild:
description: 'Force rebuild all tool containers'
required: false
type: boolean
default: false

jobs:
detect-changes:
runs-on: ubuntu-latest
outputs:
infernal: ${{ steps.changes.outputs.infernal }}
samtools: ${{ steps.changes.outputs.samtools }}
force: ${{ github.event.inputs.force_rebuild == 'true' }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2

- name: Detect changed files
id: changes
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ "${{ github.event.inputs.force_rebuild }}" = "true" ]; then
echo "infernal=true" >> $GITHUB_OUTPUT
echo "samtools=true" >> $GITHUB_OUTPUT
else
# Check if infernal files changed
if git diff --name-only HEAD^ HEAD | grep -q "^containers/infernal/"; then
echo "infernal=true" >> $GITHUB_OUTPUT
else
echo "infernal=false" >> $GITHUB_OUTPUT
fi
# Check if samtools files changed
if git diff --name-only HEAD^ HEAD | grep -q "^containers/samtools/"; then
echo "samtools=true" >> $GITHUB_OUTPUT
else
echo "samtools=false" >> $GITHUB_OUTPUT
fi
fi
build-infernal:
needs: detect-changes
if: needs.detect-changes.outputs.infernal == 'true' || needs.detect-changes.outputs.force == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Docker login
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: docker login -u $DOCKER_USER -p $DOCKER_PASSWORD

- name: Build Infernal container
run: docker build -t rnacentral/infernal:1.1.2 -f containers/infernal/Dockerfile containers/infernal/
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build context is inconsistent between the Makefile and the workflow. The Makefile (line 30) uses . as the build context, while the workflow uses containers/infernal/. Since the Infernal Dockerfile doesn't copy any local files, both work, but this inconsistency could cause confusion.

For consistency, either:

  1. Use . in both places (Makefile and workflow)
  2. Use infernal/ in the Makefile and adjust the working directory accordingly

The same issue exists for the Samtools container (line 102).

Copilot uses AI. Check for mistakes.

- name: Tag as latest
run: docker tag rnacentral/infernal:1.1.2 rnacentral/infernal:latest

- name: Push versioned tag
run: docker push rnacentral/infernal:1.1.2

- name: Push latest tag
run: docker push rnacentral/infernal:latest

- name: Slack notification
if: always()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_MESSAGE: 'Infernal container built and pushed: ${{ job.status }}'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
MSG_MINIMAL: true

build-samtools:
needs: detect-changes
if: needs.detect-changes.outputs.samtools == 'true' || needs.detect-changes.outputs.force == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Docker login
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: docker login -u $DOCKER_USER -p $DOCKER_PASSWORD

- name: Build Samtools container
run: docker build -t rnacentral/samtools:1.18 -f containers/samtools/Dockerfile containers/samtools/
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build context is inconsistent between the Makefile and the workflow. The Makefile (line 36 in containers/Makefile) uses . as the build context, while the workflow uses containers/samtools/. Since the Samtools Dockerfile doesn't copy any local files, both work, but this inconsistency could cause confusion and maintainability issues.

For consistency, use the same build context in both places.

Suggested change
run: docker build -t rnacentral/samtools:1.18 -f containers/samtools/Dockerfile containers/samtools/
run: docker build -t rnacentral/samtools:1.18 -f containers/samtools/Dockerfile .

Copilot uses AI. Check for mistakes.

- name: Tag as latest
run: docker tag rnacentral/samtools:1.18 rnacentral/samtools:latest

- name: Push versioned tag
run: docker push rnacentral/samtools:1.18

- name: Push latest tag
run: docker push rnacentral/samtools:latest

- name: Slack notification
if: always()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_MESSAGE: 'Samtools container built and pushed: ${{ job.status }}'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
MSG_MINIMAL: true
12 changes: 11 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
[workspace]
members = [
"utils/*",
"utils/bed-expander",
"utils/expand-urs",
"utils/ftp-export",
"utils/json2dfasta",
"utils/json2fasta",
"utils/precompute",
"utils/rnc-core",
"utils/rnc-test-utils",
"utils/rnc-utils",
"utils/search-export",
"utils/split-ena",
]
Loading