Skip to content

Commit 7d58528

Browse files
committed
add release and Docker workflows
1 parent a9917d4 commit 7d58528

3 files changed

Lines changed: 152 additions & 0 deletions

File tree

.github/workflows/docker.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Docker
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
12+
permissions:
13+
contents: read
14+
packages: write
15+
16+
jobs:
17+
docker:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Log in to GHCR
23+
uses: docker/login-action@v3
24+
with:
25+
registry: ${{ env.REGISTRY }}
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Extract metadata
30+
id: meta
31+
uses: docker/metadata-action@v5
32+
with:
33+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
34+
tags: |
35+
type=semver,pattern={{version}}
36+
type=semver,pattern={{major}}.{{minor}}
37+
type=raw,value=latest
38+
39+
- name: Set up Docker Buildx
40+
uses: docker/setup-buildx-action@v3
41+
42+
- name: Build and push
43+
uses: docker/build-push-action@v6
44+
with:
45+
context: .
46+
push: true
47+
tags: ${{ steps.meta.outputs.tags }}
48+
labels: ${{ steps.meta.outputs.labels }}
49+
cache-from: type=gha
50+
cache-to: type=gha,mode=max

.github/workflows/release.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build:
13+
name: Build ${{ matrix.target }}
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
include:
18+
- target: x86_64-unknown-linux-gnu
19+
os: ubuntu-latest
20+
name: emits-linux-x86_64
21+
- target: aarch64-unknown-linux-gnu
22+
os: ubuntu-latest
23+
name: emits-linux-aarch64
24+
- target: x86_64-apple-darwin
25+
os: macos-latest
26+
name: emits-macos-x86_64
27+
- target: aarch64-apple-darwin
28+
os: macos-latest
29+
name: emits-macos-aarch64
30+
31+
steps:
32+
- uses: actions/checkout@v4
33+
34+
- name: Install Rust
35+
uses: dtolnay/rust-toolchain@stable
36+
with:
37+
targets: ${{ matrix.target }}
38+
39+
- name: Install cross-compilation tools
40+
if: matrix.target == 'aarch64-unknown-linux-gnu'
41+
run: |
42+
sudo apt-get update
43+
sudo apt-get install -y gcc-aarch64-linux-gnu
44+
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
45+
46+
- name: Build
47+
run: cargo build --release --target ${{ matrix.target }}
48+
49+
- name: Package
50+
shell: bash
51+
run: |
52+
cd target/${{ matrix.target }}/release
53+
tar czf ../../../${{ matrix.name }}.tar.gz emits
54+
cd ../../..
55+
56+
- name: Upload artifact
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: ${{ matrix.name }}
60+
path: ${{ matrix.name }}.tar.gz
61+
62+
release:
63+
name: Create Release
64+
needs: build
65+
runs-on: ubuntu-latest
66+
steps:
67+
- uses: actions/checkout@v4
68+
69+
- name: Download all artifacts
70+
uses: actions/download-artifact@v4
71+
with:
72+
path: artifacts
73+
74+
- name: Create Release
75+
uses: softprops/action-gh-release@v2
76+
with:
77+
generate_release_notes: true
78+
files: artifacts/**/*.tar.gz
79+
env:
80+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Dockerfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM rust:1.82-slim AS builder
2+
3+
WORKDIR /build
4+
COPY Cargo.toml Cargo.lock* ./
5+
COPY src/ src/
6+
7+
RUN cargo build --release
8+
9+
FROM debian:bookworm-slim
10+
11+
LABEL org.opencontainers.image.source="https://github.com/ayobi/emits"
12+
LABEL org.opencontainers.image.description="EMITS: EM abundance estimation for fungal ITS from long-read sequencing"
13+
LABEL org.opencontainers.image.licenses="MIT"
14+
15+
RUN apt-get update && apt-get install -y --no-install-recommends \
16+
minimap2 \
17+
&& rm -rf /var/lib/apt/lists/*
18+
19+
COPY --from=builder /build/target/release/emits /usr/local/bin/emits
20+
21+
ENTRYPOINT ["emits"]
22+
CMD ["--help"]

0 commit comments

Comments
 (0)