Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Signed-off-by: TheCarlG <[email protected]>
  • Loading branch information
theCarlG committed Jul 4, 2022
0 parents commit 8ff8e73
Show file tree
Hide file tree
Showing 46 changed files with 4,624 additions and 0 deletions.
Binary file added .github/images/app-gui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
102 changes: 102 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Release
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
env:
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER: "clang"
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS: "-C link-arg=-fuse-ld=/usr/local/bin/mold"
CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER: "clang"
CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_RUSTFLAGS: "-C link-arg=-fuse-ld=/usr/local/bin/mold"

jobs:
verify:
name: Verify
uses: ./.github/workflows/verify.yml

create-release:
needs: [verify]
name: Create Github Release
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
upload_url: ${{ steps.release.outputs.upload_url }}
PKG_VERSION: ${{ env.PKG_VERSION }}
steps:
- name: Get the release version from the tag
shell: bash
if: env.PKG_VERSION== ''
run: |
echo "PKG_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
echo "version is: ${{ env.VERSION }}"
- name: Create GitHub release
if: env.GITHUB_TOKEN != ''
id: release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.PKG_VERSION }}
release_name: ${{ env.PKG_VERSION }}

build-release:
name: Build Release
needs: ['create-release']
runs-on: ubuntu-latest
env:
# Emit backtraces on panics.
RUST_BACKTRACE: 1
steps:
- uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
with:
target: x86_64-unknown-linux-gnu
toolchain: stable

- uses: actions-rs/toolchain@v1
with:
target: x86_64-unknown-linux-musl
toolchain: stable

- name: Install dependencies
shell: bash
run: |
sudo ./scripts/install-deps.sh
- name: Build GUI
uses: actions-rs/cargo@v1
with:
command: build
args: --release --bin shortcut-gui --target=x86_64-unknown-linux-gnu

- name: Build Daemon
uses: actions-rs/cargo@v1
with:
command: build
args: --release --bin shortcut-daemon --target=x86_64-unknown-linux-musl

- name: Strip release binaries
run: |
strip target/x86_64-unknown-linux-musl/release/shortcut-daemon
strip target/x86_64-unknown-linux-gnu/release/shortcut-gui
- name: Create archive
run: |
PKG_VERSION=${{ needs.create-release.outputs.PKG_VERSION }} scripts/package.sh
staging="shortcut-${{ needs.create-release.outputs.PKG_VERSION }}"
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
- name: Upload release archive
if: env.GITHUB_TOKEN != ''
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ${{ env.ASSET }}
asset_name: ${{ env.ASSET }}
asset_content_type: application/octet-stream

171 changes: 171 additions & 0 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
name: Verify
on:
workflow_call:
jobs:
setup:
runs-on: ubuntu-latest
strategy:
matrix:
rust_toolchain: [stable, nightly]
name: Setup
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust_toolchain }}
components: clippy, rustfmt

clippy:
runs-on: ubuntu-latest
needs: [setup]
name: Clippy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- uses: actions-rs/toolchain@v1
with:
toolchain: stable

- uses: actions-rs/clippy-check@v1
if: env.GITHUB_TOKEN != ''
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --workspace --all-targets -- -D warnings -W clippy::all

- uses: actions-rs/cargo@v1
if: env.GITHUB_TOKEN == ''
with:
command: clippy
args: --workspace --all-targets -- -D warnings -W clippy::all

checks:
runs-on: ubuntu-latest
needs: [setup]
name: Checks
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake
- uses: actions/checkout@v2
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- uses: actions-rs/toolchain@v1
with:
toolchain: stable

- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

- uses: actions-rs/cargo@v1
with:
command: doc
args: --no-deps

tests:
name: Tests
runs-on: ubuntu-latest
needs: [setup]
strategy:
matrix:
rust_toolchain: [stable, nightly]
steps:
- uses: actions/checkout@v2

- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust_toolchain }}
override: true

- name: Install dependencies
shell: bash
run: |
sudo ./scripts/install-deps.sh
- uses: actions-rs/cargo@v1
with:
command: test
toolchain: ${{ matrix.rust_toolchain }}
args: --workspace --doc

- uses: actions-rs/cargo@v1
with:
command: test
toolchain: ${{ matrix.rust_toolchain }}
args: --workspace --all-targets


cargo-deny:
needs: [setup]
name: Cargo Deny
runs-on: ubuntu-latest
strategy:
matrix:
deny_checks:
- advisories
- bans licenses sources
continue-on-error: ${{ matrix.deny_checks == 'advisories' }}
steps:
- uses: actions/checkout@v2

- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- uses: actions-rs/toolchain@v1
with:
toolchain: stable

- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check ${{ matrix.checks }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
target/
.cargo/
3 changes: 3 additions & 0 deletions COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This project is licensed under MIT licenses.

You may use this code under the terms this license.
Loading

0 comments on commit 8ff8e73

Please sign in to comment.