Skip to content

Commit

Permalink
Merge pull request #5 from phac-nml/dev
Browse files Browse the repository at this point in the history
Rustify
  • Loading branch information
ktmeaton authored Nov 22, 2023
2 parents ae94b53 + ac8de87 commit 8484a3e
Show file tree
Hide file tree
Showing 83 changed files with 10,979 additions and 5,890 deletions.
24 changes: 24 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Add the contents of this file to `config.toml` to enable "fast build" configuration. Please read the notes below.

# NOTE: For maximum performance, build using a nightly compiler
# If you are using rust stable, remove the "-Zshare-generics=y" below.

[target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = ["-Clink-arg=-fuse-ld=lld"]

# NOTE: you must install [Mach-O LLD Port](https://lld.llvm.org/MachO/index.html) on mac. you can easily do this by installing llvm which ilslsncludes lld with the "brew" package manager:
# `brew install llvm`
[target.x86_64-apple-darwin]
rustflags = ["-C", "link-arg=-fuse-ld=/usr/local/opt/llvm/bin/ld64.lld"]

[target.aarch64-apple-darwin]
rustflags = ["-C", "link-arg=-fuse-ld=/opt/homebrew/opt/llvm/bin/ld64.lld"]

[target.x86_64-pc-windows-msvc]
linker = "rust-lld.exe"

# Optional: Uncommenting the following improves compile times, but reduces the amount of debug info to 'line number tables only'
# In most cases the gains are negligible, but if you are on macos and have slow compile times you should see significant gains.
#[profile.dev]
#debug = 1
58 changes: 58 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Build

on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
release:
types: [published]
workflow_call:

jobs:

# ---------------------------------------------------------------------------
build:

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
arch:
#- aarch64-apple-darwin
#- aarch64-unknown-linux-gnu
#- aarch64-unknown-linux-musl
#- x86_64-apple-darwin
#- x86_64-pc-windows-gnu
- x86_64-unknown-linux-gnu
#- x86_64-unknown-linux-musl

steps:
- name: checkout repo
uses: actions/checkout@v3

- name: setup rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.74.0

- name: build
run: |
cargo build --release --all-features --target ${{ matrix.arch }}
- name: compress with upx
uses: crazy-max/ghaction-upx@v3
with:
version: v4.1.0
files: |
target/${{ matrix.arch }}/release/rebar
args: --best --lzma

- name: upload binary
uses: actions/upload-artifact@v3
with:
name: rebar-${{ matrix.arch }}
path: target/${{ matrix.arch }}/release/rebar
33 changes: 0 additions & 33 deletions .github/workflows/deploy.yaml

This file was deleted.

47 changes: 0 additions & 47 deletions .github/workflows/examples.yaml

This file was deleted.

37 changes: 0 additions & 37 deletions .github/workflows/install.yaml

This file was deleted.

77 changes: 77 additions & 0 deletions .github/workflows/latest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Latest

on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
release:
types: [published]

schedule:
- cron: '0 0 * * *'

env:
tag: "latest"

jobs:

build:
uses: ./.github/workflows/build.yaml

# ---------------------------------------------------------------------------
latest:

needs: build

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
arch:
#- aarch64-apple-darwin
#- aarch64-unknown-linux-gnu
#- aarch64-unknown-linux-musl
#- x86_64-apple-darwin
#- x86_64-pc-windows-gnu
- x86_64-unknown-linux-gnu
#- x86_64-unknown-linux-musl

steps:
- name: checkout repo
uses: actions/checkout@v3

- name: download binary from build
uses: actions/download-artifact@v3
with:
name: rebar-${{ matrix.arch }}
path: target/${{ matrix.arch }}/release

- name: install
run: |
mkdir -p /home/runner/.local/bin
mv target/${{ matrix.arch }}/release/rebar ~/.local/bin
chmod +x ~/.local/bin/rebar
rebar --help
- name: dataset download
run: |
rebar dataset download --name sars-cov-2 --tag $tag --output-dir dataset/sars-cov-2/$tag
- name: validate
run: |
rebar run --dataset-dir dataset/sars-cov-2/$tag --output-dir validate --populations "*" --threads 2
if [[ $(grep "fail" validate/linelist.tsv) ]]; then exit 1; fi
- name: plot
run: |
rebar plot --dataset-dir dataset/sars-cov-2/$tag --output-dir validate --plot-dir validate/plots
- name: upload
uses: actions/upload-artifact@v3
with:
name: validate-${{ matrix.arch }}
path: validate
9 changes: 6 additions & 3 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ on:
- '*'
release:
types: [published]
# schedule:
# - cron: "0 0 * * *"

jobs:

Expand All @@ -22,11 +20,16 @@ jobs:
- name: checkout repo
uses: actions/checkout@v3

- name: setup Python
- name: setup python
uses: actions/setup-python@v2
with:
python-version: '3.9'

- name: setup rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.74.0

- name: setup linters
run: |
pip install pre-commit==2.17.0
Expand Down
68 changes: 27 additions & 41 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,55 +7,41 @@ on:

jobs:

release-notes:
name: Release Notes 📰
runs-on: ubuntu-latest
build:
uses: ./.github/workflows/build.yaml

steps:
- name: checkout repo
uses: actions/checkout@v3
with:
lfs: true
fetch-depth: 0
#----------------------------------------------------------------------------
release:

- name: update submodules
run: git submodule update --init --recursive

# Check 2 most recent tags, overwrites
- name: Tagged Release Notes
run: |
./autologs/autologs \
--release \
-o release-notes.md \
--old-tag `git tag | tail -n2 | head -n1` \
--new-tag `git tag | tail -n1`
- name: Upload Release Notes
uses: actions/upload-artifact@v2
with:
name: release-notes
path: release-notes.md
retention-days: 7

tagged-release:
name: Tagged Release
needs: [release-notes]
needs: build
runs-on: ubuntu-latest

steps:

- name: Download Release Notes
uses: actions/download-artifact@v2
- name: download binaries from build
uses: actions/download-artifact@v3
with:
name: release-notes
path: target

- name: rename binaries by architecture
run: |
mkdir target/release
mv target/rebar-x86_64-unknown-linux-gnu/rebar target/release/rebar-x86_64-unknown-linux-gnu
ls -l target/release/
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: create release
uses: ncipollo/release-action@v1
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
# comma-separated
artifacts: "target/release/rebar-x86_64-unknown-linux-gnu"
# aarch64-apple-darwin
# aarch64-unknown-linux-gnu
# aarch64-unknown-linux-musl
# x86_64-apple-darwin
# x86_64-pc-windows-gnu
# x86_64-unknown-linux-musl
artifactErrorsFailBuild: true
draft: true
generateReleaseNotes: true
makeLatest: true
prerelease: true
body_path: release-notes.md
Loading

0 comments on commit 8484a3e

Please sign in to comment.