mirror of
https://github.com/pcvolkmer/fastq-tools.git
synced 2025-09-13 13:12:52 +00:00
build: add Makefile and GitHub workflows
This commit is contained in:
46
.github/workflows/release.yml
vendored
Normal file
46
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
name: Create release and upload assets
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
linuxbuild:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Run tests
|
||||
run: cargo test --verbose
|
||||
- run: make linux-package
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
draft: 'true'
|
||||
make_latest: 'true'
|
||||
generate_release_notes: 'true'
|
||||
files: |
|
||||
*linux.tar.gz
|
||||
windowsbuild:
|
||||
runs-on: windows-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Run tests
|
||||
run: cargo test --verbose
|
||||
- run: make win-package
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
draft: 'true'
|
||||
make_latest: 'true'
|
||||
generate_release_notes: 'true'
|
||||
files: |
|
||||
*win64.zip
|
22
.github/workflows/tests.yml
vendored
Normal file
22
.github/workflows/tests.yml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
name: "Run Tests"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Build
|
||||
run: cargo build --verbose
|
||||
- name: Run tests
|
||||
run: cargo test --verbose
|
53
Makefile
Normal file
53
Makefile
Normal file
@@ -0,0 +1,53 @@
|
||||
ifndef VERBOSE
|
||||
.SILENT:
|
||||
endif
|
||||
|
||||
GITTAG = $(shell git describe --tag --abbrev=0 2>/dev/null | sed -En 's/v(.*)$$/\1/p')
|
||||
ifeq ($(findstring -, $(GITTAG)), -)
|
||||
GITDEV = $(shell git describe --tag 2>/dev/null | sed -En 's/v(.*)-([0-9]+)-g([0-9a-f]+)$$/.dev.\2+\3/p')
|
||||
else
|
||||
GITDEV = $(shell git describe --tag 2>/dev/null | sed -En 's/v(.*)-([0-9]+)-g([0-9a-f]+)$$/-dev.\2+\3/p')
|
||||
endif
|
||||
VERSION := "$(GITTAG)$(GITDEV)"
|
||||
|
||||
package-all: win-package linux-package
|
||||
|
||||
.PHONY: win-package
|
||||
win-package: win-binary-x86_64
|
||||
mkdir fastq-tools || true
|
||||
cp target/x86_64-pc-windows-gnu/release/fastq-tools.exe fastq-tools/
|
||||
cp README.md fastq-tools/
|
||||
cp LICENSE fastq-tools/
|
||||
# first try (linux) zip command, then powershell sub command to create ZIP file
|
||||
zip fastq-tools-$(VERSION)_win64.zip fastq-tools/* || powershell Compress-ARCHIVE fastq-tools fastq-tools-$(VERSION)_win64.zip
|
||||
rm -rf fastq-tools || true
|
||||
|
||||
.PHONY: linux-package
|
||||
linux-package: linux-binary-x86_64
|
||||
mkdir fastq-tools || true
|
||||
cp target/x86_64-unknown-linux-gnu/release/fastq-tools fastq-tools/
|
||||
cp README.md fastq-tools/
|
||||
cp LICENSE fastq-tools/
|
||||
tar -czvf fastq-tools-$(VERSION)_linux.tar.gz fastq-tools/
|
||||
rm -rf fastq-tools || true
|
||||
|
||||
binary-all: win-binary-x86_64 linux-binary-x86_64
|
||||
|
||||
.PHONY: win-binary-x86_64
|
||||
win-binary-x86_64:
|
||||
cargo build --release --target=x86_64-pc-windows-gnu
|
||||
|
||||
.PHONY: linux-binary-x86_64
|
||||
linux-binary-x86_64:
|
||||
cargo build --release --target=x86_64-unknown-linux-gnu
|
||||
|
||||
.PHONY: install
|
||||
install:
|
||||
cargo install --path .
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
cargo clean
|
||||
rm -rf fastq-tools 2>/dev/null || true
|
||||
rm *_win64.zip 2>/dev/null || true
|
||||
rm *_linux.tar.gz 2>/dev/null || true
|
Reference in New Issue
Block a user