Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
saindriches committed Nov 1, 2022
0 parents commit af058ed
Show file tree
Hide file tree
Showing 39 changed files with 4,303 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
ci:
name: Check, test, rustfmt and clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install Rust, clippy and rustfmt
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt

- name: Check
run: |
cargo check --workspace --all-features
# TODO: Test
# - name: Test
# run: |
# cargo test --workspace --all-features

- name: Rustfmt
run: |
cargo fmt --all --check
- name: Clippy
run: |
cargo clippy --workspace --all-features --all-targets --tests -- --deny warnings --verbose
96 changes: 96 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
on:
workflow_dispatch:

name: Artifacts

env:
RELEASE_BIN: dovi_meta
RELEASE_DIR: artifacts
WINDOWS_TARGET: x86_64-pc-windows-msvc
MACOS_TARGET: x86_64-apple-darwin
LINUX_TARGET: x86_64-unknown-linux-musl

jobs:
build:
name: Build artifacts
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [Linux, macOS, Windows]
include:
- build: Linux
os: ubuntu-latest
- build: macOS
os: macos-latest
- build: Windows
os: windows-latest

steps:
- uses: actions/checkout@v3

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Get the version
shell: bash
run: |
echo "RELEASE_PKG_VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)" >> $GITHUB_ENV
- name: Install musl-tools (Linux)
if: matrix.build == 'Linux'
run: |
sudo apt-get update -y
sudo apt-get install musl-tools -y
- name: Build (Linux)
if: matrix.build == 'Linux'
run: |
rustup target add ${{ env.LINUX_TARGET }}
cargo build --release --target ${{ env.LINUX_TARGET }}
- name: Build (macOS)
if: matrix.build == 'macOS'
run: cargo build --release

- name: Build (Windows)
if: matrix.build == 'Windows'
run: cargo build --release

- name: Install cargo-c (Windows)
if: matrix.build == 'Windows'
run: |
$LINK = "https://github.com/lu-zero/cargo-c/releases/latest/download"
$CARGO_C_FILE = "cargo-c-windows-msvc"
curl -LO "$LINK/$CARGO_C_FILE.zip"
7z e -y "$CARGO_C_FILE.zip" -o"${env:USERPROFILE}\.cargo\bin"
- name: Create artifact directory
run: |
mkdir ${{ env.RELEASE_DIR }}
- name: Create tarball (Linux)
if: matrix.build == 'Linux'
run: |
strip ./target/${{ env.LINUX_TARGET }}/release/${{ env.RELEASE_BIN }}
mv ./target/${{ env.LINUX_TARGET }}/release/${{ env.RELEASE_BIN }} ./${{ env.RELEASE_BIN }}
tar -cvzf ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ env.RELEASE_PKG_VERSION }}-${{ env.LINUX_TARGET }}.tar.gz ./${{ env.RELEASE_BIN }}
- name: Create zipfile (Windows)
if: matrix.build == 'Windows'
shell: bash
run: |
mv ./target/release/${{ env.RELEASE_BIN }}.exe ./${{ env.RELEASE_BIN }}.exe
7z a ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ env.RELEASE_PKG_VERSION }}-${{ env.WINDOWS_TARGET }}.zip ./${{ env.RELEASE_BIN }}.exe
- name: Create zipfile (macOS)
if: matrix.build == 'macOS'
run: |
strip ./target/release/${{ env.RELEASE_BIN }}
mv ./target/release/${{ env.RELEASE_BIN }} ./${{ env.RELEASE_BIN }}
zip -9 ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ env.RELEASE_PKG_VERSION }}-${{ env.MACOS_TARGET }}.zip ./${{ env.RELEASE_BIN }}
- name: Upload Zip
uses: actions/upload-artifact@v1
with:
name: ${{ matrix.build }}
path: ./${{ env.RELEASE_DIR }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
Loading

0 comments on commit af058ed

Please sign in to comment.