Skip to content

Commit c801d8a

Browse files
CI testing (test.yaml) (#8)
* Update Cargo.lock * Bump version * Add some sanity checks * Add GH Actions release and test workflows * Update license * Update README
1 parent 4195c49 commit c801d8a

File tree

7 files changed

+163
-4
lines changed

7 files changed

+163
-4
lines changed

.github/workflows/release.yaml

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
on:
2+
push:
3+
# Sequence of patterns matched against refs/tags
4+
tags:
5+
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
6+
7+
name: Build and Upload Release
8+
9+
env:
10+
CARGO_INCREMENTAL: 0
11+
12+
jobs:
13+
14+
linux:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout git repository
18+
uses: actions/checkout@master
19+
- name: Login to GitHub Package Registry
20+
run: docker login docker.pkg.github.com -u 10xbuild -p ${{secrets.GH_PAT}}
21+
- name: Make release build
22+
run: >
23+
docker run -v ${{github.workspace}}:/root
24+
-e GITHUB_SHA -e GITHUB_REF
25+
docker.pkg.github.com/10xdev/toolchain-scripts/toolchain:latest
26+
/bin/bash -lec '
27+
cargo build --release;
28+
target/release/subset-bam --help | grep -q subset-bam;
29+
readelf -V target/release/subset-bam;
30+
';
31+
mkdir ${{runner.temp}}/artifacts;
32+
cp -a target/release/subset-bam ${{runner.temp}}/artifacts/subset-bam-linux
33+
- name: Upload build artifact
34+
uses: actions/upload-artifact@v1
35+
with:
36+
name: subset-bam
37+
path: ${{runner.temp}}/artifacts
38+
macos:
39+
runs-on: macos-latest
40+
env:
41+
MACOSX_DEPLOYMENT_TARGET: 10.7
42+
steps:
43+
- name: Checkout git repository
44+
uses: actions/checkout@master
45+
- name: Make release build
46+
run: |
47+
cargo build --release
48+
target/release/subset-bam --help | grep -q subset-bam
49+
mkdir ${{runner.temp}}/artifacts
50+
cp -a target/release/subset-bam ${{runner.temp}}/artifacts/subset-bam-macos
51+
- name: Upload build artifact
52+
uses: actions/upload-artifact@v1
53+
with:
54+
name: subset-bam
55+
path: ${{runner.temp}}/artifacts
56+
57+
setup-release:
58+
needs: [linux, macos]
59+
runs-on: ubuntu-latest
60+
steps:
61+
- uses: actions/download-artifact@v1
62+
with:
63+
name: subset-bam
64+
path: ${{runner.temp}}/artifacts
65+
66+
- run: ls ${{runner.temp}}/artifacts
67+
68+
- name: Create Release
69+
id: create_release
70+
uses: actions/create-release@v1
71+
env:
72+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
with:
74+
tag_name: ${{ github.ref }}
75+
release_name: Release ${{ github.ref }}
76+
draft: false
77+
prerelease: false
78+
79+
- name: Upload Linux
80+
id: upload-linux-release
81+
uses: actions/upload-release-asset@v1
82+
env:
83+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+
with:
85+
upload_url: ${{ steps.create_release.outputs.upload_url }}
86+
asset_path: ${{runner.temp}}/artifacts/subset-bam-linux
87+
asset_name: subset-bam_linux
88+
asset_content_type: application/octet-stream
89+
90+
- name: Upload Mac
91+
id: upload-mac-release
92+
uses: actions/upload-release-asset@v1
93+
env:
94+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
95+
with:
96+
upload_url: ${{ steps.create_release.outputs.upload_url }}
97+
asset_path: ${{runner.temp}}/artifacts/subset-bam-macos
98+
asset_name: subset-bam_macos
99+
asset_content_type: application/octet-stream

.github/workflows/test.yaml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Test subset-bam
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
9+
env:
10+
CARGO_INCREMENTAL: 0
11+
12+
jobs:
13+
test-mac:
14+
# This job runs on MacOS Catalina
15+
runs-on: macos-latest
16+
steps:
17+
- name: rust version
18+
run: rustup default 1.44.0
19+
- name: add rustfmt
20+
run: rustup component add rustfmt
21+
- name: Checkout subset-bam master
22+
uses: actions/checkout@master
23+
- name: Check Rust formatting
24+
run: cargo fmt -- --check
25+
- name: build-subset-bam
26+
run: cargo build --release
27+
- name: unit tests
28+
run: cargo test --release -- --nocapture
29+
30+
test-linux:
31+
# This job runs on Linux
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: rust version
35+
run: rustup default 1.44.0
36+
- name: add rustfmt
37+
run: rustup component add rustfmt
38+
- name: Checkout subset-bam master
39+
uses: actions/checkout@master
40+
- name: Check Rust formatting
41+
run: cargo fmt -- --check
42+
- name: build-subset-bam
43+
run: cargo build --release
44+
- name: unit tests
45+
run: cargo test --release -- --nocapture

Cargo.lock

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ tempfile = "*"
1616
rayon = "*"
1717
ring = "0.14.6"
1818
data-encoding = "*"
19+
faccess="0.2.3"
1920

2021
[profile.release]
2122
debug = 1

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2018 10x Genomics, Inc.
3+
Copyright (c) 2020 10x Genomics, Inc.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# subset-bam
22

3-
`subset-bam` is a tool to subset a 10x Genomics BAM file based on a tag, most commonly the cell barcode tag.
3+
`subset-bam` is a tool to subset a 10x Genomics BAM file based on a tag, most commonly the cell barcode tag. The latest version is `v1.1.0` and can be found [on the releases page](https://github.com/10XGenomics/subset-bam/releases).
44

55
## Overview of how it works
66
`subset-bam` is a simple tool implemented in Rust that takes a 10x Genomics BAM file, a CSV file defining the subset of cells you want to isolate, and produces a new BAM file with only alignments associated with those cells.

src/main.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ extern crate tempfile;
1212
extern crate terminal_size;
1313
#[macro_use]
1414
extern crate log;
15+
extern crate faccess;
1516
extern crate human_panic;
1617

1718
use clap::{App, Arg};
19+
use faccess::{AccessMode, PathExt};
1820
use failure::Error;
1921
use rayon::prelude::*;
2022
use rust_htslib::bam;
@@ -34,8 +36,8 @@ use terminal_size::{terminal_size, Width};
3436
fn get_args() -> clap::App<'static, 'static> {
3537
let args = App::new("subset-bam")
3638
.set_term_width(if let Some((Width(w), _)) = terminal_size() { w as usize } else { 120 })
37-
.version("1.0.0")
38-
.author("Ian Fiddes <ian.fiddes@10xgenomics.com>")
39+
.version("1.1.0")
40+
.author("Ian Fiddes <ian.fiddes@10xgenomics.com>, Wyatt McDonnell <wyatt.mcdonnell@10xgenomics.com>")
3941
.about("Subsetting 10x Genomics BAM files")
4042
.arg(Arg::with_name("bam")
4143
.short("b")

0 commit comments

Comments
 (0)