Skip to content

Commit

Permalink
feat(ci): fix cache + add cargo deb artifact upload to release
Browse files Browse the repository at this point in the history
  • Loading branch information
sassman committed Jan 24, 2021
1 parent 24c3049 commit 7e8ca49
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 67 deletions.
36 changes: 4 additions & 32 deletions .github/workflows/build.yml
Expand Up @@ -33,14 +33,7 @@ jobs:
default: true
profile: minimal
components: clippy, rustfmt
- name: setup | cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: Swatinem/rust-cache@v1
- run: cargo check

lint:
Expand All @@ -63,14 +56,7 @@ jobs:
default: true
profile: minimal
components: clippy, rustfmt
- name: setup | cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: Swatinem/rust-cache@v1
- run: cargo ${{ matrix['cargo-cmd'] }}

tests:
Expand All @@ -92,14 +78,7 @@ jobs:
toolchain: ${{ matrix.rust }}
default: true
profile: minimal
- name: setup | cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: Swatinem/rust-cache@v1
- name: cargo test
run: cargo test --all --locked -- -Z unstable-options

Expand All @@ -115,14 +94,7 @@ jobs:
toolchain: stable
default: true
profile: minimal
- name: setup | cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: Swatinem/rust-cache@v1
- name: audit
uses: actions-rs/audit-check@v1
with:
Expand Down
56 changes: 21 additions & 35 deletions .github/workflows/release.yml
Expand Up @@ -30,14 +30,7 @@ jobs:
default: true
profile: minimal
components: clippy, rustfmt
- name: setup | cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: Swatinem/rust-cache@v1
- run: cargo check

lint:
Expand All @@ -60,14 +53,7 @@ jobs:
default: true
profile: minimal
components: clippy, rustfmt
- name: setup | cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: Swatinem/rust-cache@v1
- run: cargo ${{ matrix['cargo-cmd'] }}

tests:
Expand All @@ -89,14 +75,7 @@ jobs:
toolchain: ${{ matrix.rust }}
default: true
profile: minimal
- name: setup | cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: Swatinem/rust-cache@v1
- name: cargo test
run: cargo test --all --locked -- -Z unstable-options

Expand All @@ -112,14 +91,7 @@ jobs:
toolchain: stable
default: true
profile: minimal
- name: setup | cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: Swatinem/rust-cache@v1
- name: audit
uses: actions-rs/audit-check@v1
with:
Expand All @@ -138,11 +110,11 @@ jobs:
toolchain: stable
default: true
profile: minimal
- uses: Swatinem/rust-cache@v1
- uses: katyo/publish-crates@v1
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}

# https://github.com/marketplace/actions/changelog-reader
release:
name: post / github release
needs: publish
Expand All @@ -155,10 +127,11 @@ jobs:
toolchain: stable
default: true
profile: minimal
- uses: Swatinem/rust-cache@v1
- run: cargo install cargo-deb
- name: Get version from tag
id: tag_name
run: |
echo ::set-output name=current_version::${GITHUB_REF#refs/tags/v}
run: echo ::set-output name=current_version::${GITHUB_REF#refs/tags/v}
shell: bash
- name: Get Changelog Entry
id: changelog_reader
Expand All @@ -167,7 +140,9 @@ jobs:
validation_depth: 10
version: ${{ steps.tag_name.outputs.current_version }}
path: ./CHANGELOG.md
- run: cargo deb
- name: Create Release
# https://github.com/marketplace/actions/changelog-reader
id: create_release
uses: actions/create-release@v1
env:
Expand All @@ -180,6 +155,17 @@ jobs:
body: ${{ steps.changelog_reader.outputs.changes }}
prerelease: ${{ steps.changelog_reader.outputs.status == 'prereleased' }}
draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/debian/t-rec_${{ github.ref }}_amd64.deb
asset_name: t-rec_${{ steps.tag_name.outputs.current_version }}_amd64.deb
asset_content_type: application/vnd.debian.binary-package

# https://github.com/mislav/bump-homebrew-formula-action
publish-to-brew:
Expand Down
25 changes: 25 additions & 0 deletions Cargo.toml
Expand Up @@ -41,3 +41,28 @@ x11rb = "0.7.0"

[features]
e2e_tests = []

[package.metadata.deb]
section = "x11"
depends = "imagemagick"
extended-description = """## Features
- Screenshotting your terminal with 4 frames per second (every 250ms)
- Generates high quality small sized animated gif images
- **Build-In idle frames detection and optimization** (for super fluid
presentations)
- Applies (can be disabled) border decor effects like drop shadow
- Runs on MacOS and Linux
- Uses native efficient APIs
- Runs without any cloud service and entirely offline
- No issues with terminal sizes larger than 80x24
- No issues with fonts or colors
- No issues with curses based programs
- No issues with escape sequences
- No record and replay - just one simple command to rule them all
- Hidden feature: Record every window you want
- Written in Rust 🦀
"""

[package.metadata.rpm.targets]
buildflags = ["--release"]
t-rec = { path = "/usr/bin/t-rec" }

0 comments on commit 7e8ca49

Please sign in to comment.