Skip to content

Commit 63ef925

Browse files
authored
Merge pull request #5 from sunbeam-labs/4-containerize-and-version
Containerize and version
2 parents 85e463b + 7510c0a commit 63ef925

17 files changed

+323
-100
lines changed

.github/workflows/conda_env_check.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/docker.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Push to DockerHub
2+
3+
on:
4+
workflow_call:
5+
6+
workflow_dispatch:
7+
8+
jobs:
9+
build-and-push-to-dockerhub:
10+
name: Push Docker image to Docker Hub
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Get sbx version
18+
shell: bash
19+
run: |
20+
SBX_VER=$(cat VERSION)
21+
echo "SBX_VER=$SBX_VER" >> $GITHUB_ENV
22+
23+
- name: Log in to Docker Hub
24+
uses: docker/login-action@v3
25+
with:
26+
username: ${{ secrets.DOCKERHUB_USERNAME }}
27+
password: ${{ secrets.DOCKERHUB_TOKEN }}
28+
29+
- name: Extract metadata (tags, labels) for Docker
30+
id: meta
31+
uses: docker/metadata-action@v5
32+
with:
33+
images: sunbeamlabs/sbx_assembly
34+
35+
- name: Build and push Docker image for annotation
36+
uses: docker/build-push-action@v5
37+
with:
38+
context: .
39+
file: envs/sbx_annotation.Dockerfile
40+
push: true
41+
tags: sunbeamlabs/sbx_assembly:${{ env.SBX_VER }}-annotation
42+
labels: ${{ steps.meta.outputs.labels }}
43+
44+
- name: Build and push Docker image for assembly
45+
uses: docker/build-push-action@v5
46+
with:
47+
context: .
48+
file: envs/sbx_assembly.Dockerfile
49+
push: true
50+
tags: sunbeamlabs/sbx_assembly:${{ env.SBX_VER }}-assembly
51+
labels: ${{ steps.meta.outputs.labels }}
52+
53+
- name: Build and push Docker image for coverage
54+
uses: docker/build-push-action@v5
55+
with:
56+
context: .
57+
file: envs/sbx_coverage.Dockerfile
58+
push: true
59+
tags: sunbeamlabs/sbx_assembly:${{ env.SBX_VER }}-coverage
60+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/linter.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.github/workflows/pr.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Tests
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
run-tests:
10+
uses: ./.github/workflows/tests.yml
11+
secrets: inherit
12+

.github/workflows/release.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
workflow_dispatch:
8+
9+
jobs:
10+
run-tests:
11+
uses: ./.github/workflows/tests.yml
12+
secrets: inherit
13+
14+
check-version:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Get sbx version
21+
shell: bash
22+
run: |
23+
SBX_VER=$(cat VERSION)
24+
echo "SBX_VER=$SBX_VER" >> $GITHUB_ENV
25+
26+
- id: get_version
27+
uses: battila7/get-version-action@v2
28+
29+
- name: Check version
30+
shell: bash
31+
run: |
32+
RELEASE_VERSION=${{ steps.get_version.outputs.version-without-v }}
33+
echo "Release version: ${RELEASE_VERSION}"
34+
echo "Sbx version: ${{ env.SBX_VER }}"
35+
36+
if [[ $RELEASE_VERSION == ${{ env.SBX_VER }} ]]; then
37+
echo "Versions match, continuing..."
38+
else
39+
echo "Versions don't match, exiting..."
40+
exit 1
41+
fi
42+
43+
push-to-dockerhub:
44+
uses: ./.github/workflows/docker.yml
45+
secrets: inherit
46+
needs:
47+
- run-tests
48+
- check-version
49+
50+
test-apptainer:
51+
name: Apptainer Test
52+
runs-on: ubuntu-latest
53+
needs: push-to-dockerhub
54+
55+
steps:
56+
- name: Checkout Code
57+
uses: actions/checkout@v4
58+
59+
- name: Set test env
60+
run: echo "SUNBEAM_TEST_PROFILE=apptainer" >> $GITHUB_ENV
61+
62+
- uses: eWaterCycle/setup-apptainer@v2
63+
with:
64+
apptainer-version: 1.1.2
65+
66+
- name: Test with Sunbeam
67+
uses: sunbeam-labs/sbx_test_action@v1
68+
with:
69+
test-directory: ".tests/e2e/"
70+
71+
- name: Dump Logs
72+
shell: bash
73+
if: always()
74+
run: tail -n +1 logs/*
75+
76+
- name: Dump Stats
77+
shell: bash
78+
if: always()
79+
run: cat stats/*

.github/workflows/tests.yml

Lines changed: 55 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,73 @@
11
name: Tests
22

33
on:
4-
pull_request:
5-
branches: [ master, main ]
64
push:
75
branches: [ master, main ]
6+
workflow_call:
7+
workflow_dispatch:
88
schedule:
99
- cron: "0 13 * * 1"
1010

11-
jobs:
11+
jobs:
12+
lint:
13+
name: Lint Code
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout Code
18+
uses: actions/checkout@v4
19+
20+
- uses: actions/setup-python@v5
21+
with:
22+
python-version: 3.12
23+
24+
- name: Install Dependencies
25+
run: pip install black snakefmt
26+
27+
- name: Run Linter
28+
run: |
29+
black --check .
30+
snakefmt --check *.smk
31+
32+
test-unit:
33+
name: Run Extension Unit Tests
34+
runs-on: ubuntu-latest
35+
36+
steps:
37+
- name: Checkout Code
38+
uses: actions/checkout@v4
39+
40+
- uses: actions/setup-python@v5
41+
with:
42+
python-version: 3.12
43+
44+
- name: Install Dependencies
45+
run: pip install pytest
46+
47+
- name: Run Unit Tests
48+
run: true #pytest .tests/unit/
49+
# This'll require having a lib within scripts with internal tests
50+
1251
test-e2e:
1352
name: Test Extension with Sunbeam
1453
runs-on: ubuntu-latest
54+
needs:
55+
- test-unit
56+
- lint
1557

1658
steps:
1759
- name: Checkout Code
18-
uses: actions/checkout@v3
60+
uses: actions/checkout@v4
1961

2062
- name: Test with Sunbeam
2163
uses: sunbeam-labs/sbx_test_action@v1
22-
23-
- name: Dump Logs
24-
shell: bash
25-
if: always()
26-
run: tail -n +1 logs/*
64+
65+
#- name: Dump Logs
66+
# shell: bash
67+
# if: always()
68+
# run: tail -n +1 logs/*
2769

28-
- name: Dump Stats
29-
shell: bash
30-
if: always()
31-
run: cat stats/*
70+
#- name: Dump Stats
71+
# shell: bash
72+
# if: always()
73+
# run: cat stats/*

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__pycache__

.tests/test_megahit.sh

Lines changed: 0 additions & 33 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<!-- Begin badges -->
66
[![Tests](https://github.com/sunbeam-labs/sbx_assembly/actions/workflows/tests.yml/badge.svg)](https://github.com/sunbeam-labs/sbx_assembly/actions/workflows/tests.yml)
7-
[![Super-Linter](https://github.com/sunbeam-labs/sbx_assembly/actions/workflows/linter.yml/badge.svg)](https://github.com/sunbeam-labs/sbx_assembly/actions/workflows/linter.yml)
7+
[![DockerHub](https://img.shields.io/docker/pulls/sunbeamlabs/sbx_assembly)](https://hub.docker.com/repository/docker/sunbeamlabs/sbx_assembly/)
88
<!-- End badges -->
99

1010
A [Sunbeam](https://github.com/sunbeam-labs/sunbeam) extension for assembly of contigs using Megahit, gene annotation using Prodigal, and annotation using [Blast](https://blast.ncbi.nlm.nih.gov/Blast.cgi) and [Diamond](https://github.com/bbuchfink/diamond). It can also map reads to contigs and calculat per-base coverage using [Minimap2](https://github.com/lh3/minimap2) and [samtools](https://github.com/samtools/samtools).

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.0.0

0 commit comments

Comments
 (0)