Skip to content

Commit

Permalink
configure the general CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
arthur3486 committed May 1, 2023
1 parent 0b853c0 commit ff36934
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
CLICOLOR: 1

jobs:
build-debug:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Configure Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Build Debug
run: cargo build

build-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Configure Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Build Debug
run: cargo build --release

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Configure Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Test
run: cargo test
26 changes: 26 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Lint

on: pull_request

env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
CLICOLOR: 1

jobs:
clippy:
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
steps:
- uses: actions/checkout@v3
- name: Configure Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: clippy
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GH_TOKEN }}
args: --all-features
58 changes: 58 additions & 0 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Release

on:
push:
tags:
- 'v*.*.*'

jobs:
release:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
arch: [x86_64, arm64]

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Build release binary
run: cargo build --release

- name: Rename binary (Linux)
if: matrix.os == 'ubuntu-latest'
run: mv target/release/cryptic target/release/cryptic-linux-${{ matrix.arch }}

- name: Rename binary (MacOS)
if: matrix.os == 'macos-latest'
run: mv target/release/cryptic target/release/cryptic-mac-os-${{ matrix.arch }}

- name: Rename binary (Windows)
if: matrix.os == 'windows-latest'
run: ren target\release\cryptic.exe cryptic-win-${{ matrix.arch }}.exe

- name: Release (Linux)
uses: softprops/action-gh-release@v1
if: matrix.os == 'ubuntu-latest'
with:
token: ${{ secrets.GH_TOKEN }}
body: "stub"
files: target/release/cryptic-linux-${{ matrix.arch }}

- name: Release (MacOS)
uses: softprops/action-gh-release@v1
if: matrix.os == 'macos-latest'
with:
token: ${{ secrets.GH_TOKEN }}
body: "stub"
files: target/release/cryptic-mac-os-${{ matrix.arch }}

- name: Release (Windows)
uses: softprops/action-gh-release@v1
if: matrix.os == 'windows-latest'
with:
token: ${{ secrets.GH_TOKEN }}
body: "stub"
files: target/release/cryptic-win-${{ matrix.arch }}.exe
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

A simple self-contained CLI tool that makes it easy to efficiently encrypt/decrypt your files.

[![Build](https://github.com/arthur3486/cryptic/workflows/CI/badge.svg?branch=main)](https://github.com/arthur3486/cryptic/actions)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

## Contents
Expand Down

0 comments on commit ff36934

Please sign in to comment.