Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
Brainstorming
Browse files Browse the repository at this point in the history
Signed-off-by: Xavier Lau <[email protected]>
  • Loading branch information
AurevoirXavier committed Apr 23, 2023
1 parent 0bc9e46 commit 3f8416e
Show file tree
Hide file tree
Showing 23 changed files with 2,973 additions and 212 deletions.
37 changes: 14 additions & 23 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,24 @@ on:
- main

env:
CARGO_INCREMENTAL: 1
CARGO_TERM_COLOR: always

GITHUB_CACHE_VERSION: 1
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

RUST_BACKTRACE: full
RUSTC_WRAPPER: sccache

SCCACHE_LINK: https://github.com/mozilla/sccache/releases/download
SCCACHE_VERSION: v0.3.0
SCCACHE_DIR: /home/runner/.cache/sccache

jobs:
cargo_checks:
cargo-checks:
name: Task cargo ${{ matrix.action }}
runs-on: ubuntu-latest
strategy:
matrix:
action: [clippy, nextest]
action: [clippy, fmt, nextest]
steps:
- name: Fetch latest code
uses: actions/checkout@v3
- name: Install Sccache
run: |
export SCCACHE_FILE=sccache-${{ env.SCCACHE_VERSION }}-x86_64-unknown-linux-musl
curl -L ${{ env.SCCACHE_LINK }}/${{ env.SCCACHE_VERSION }}/$SCCACHE_FILE.tar.gz | tar xz
sudo mv $SCCACHE_FILE/sccache /usr/bin
sudo chmod u+x /usr/bin/sccache
- name: Cache cargo
uses: actions/cache@v3
with:
Expand All @@ -45,24 +35,25 @@ jobs:
target
key: cargo-${{ env.GITHUB_CACHE_VERSION }}-${{ matrix.action }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: cargo-${{ env.GITHUB_CACHE_VERSION }}-${{ matrix.action }}-
- name: Cache sccache
uses: actions/cache@v3
with:
path: ${{ env.SCCACHE_DIR}}
key: sccache-${{ env.GITHUB_CACHE_VERSION }}-${{ matrix.action }}--${{ hashFiles('**/Cargo.lock') }}
restore-keys: sccache-${{ env.GITHUB_CACHE_VERSION }}-${{ matrix.action }}-
- name: Cargo ${{ matrix.action }}
if: matrix.action == 'clippy'
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --workspace --all-features --all-targets --locked
- name: Cargo ${{ matrix.action }}
if: matrix.action == 'fmt'
run: cargo ${{ matrix.action }} --all -- --check
- name: Install cargo-nextest
if: matrix.action == 'nextest'
uses: taiki-e/install-action@nextest
- name: Cargo nextest
- name: Cargo ${{ matrix.action }}
if: matrix.action == 'nextest'
uses: actions-rs/cargo@v1
run: cargo ${{ matrix.action }} run --release --workspace --all-features --all-targets --locked
- name: Fast fail
uses: vishnudxb/[email protected]
if: failure()
with:
command: nextest
args: run --workspace --all-features --all-targets --locked
repo: hack-ink/subapeye
workflow_id: ${{ github.run_id }}
access_token: ${{ github.token }}
File renamed without changes.
82 changes: 9 additions & 73 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,88 +8,24 @@ env:
CARGO_TERM_COLOR: always

jobs:
build:
name: Build ${{ matrix.target.name }} package
runs-on: ${{ matrix.target.os }}
strategy:
matrix:
target:
[
{ name: x86_64-unknown-linux-gnu, os: ubuntu-latest },
{ name: aarch64-apple-darwin, os: macos-latest },
{ name: x86_64-apple-darwin, os: macos-latest },
{
name: x86_64-pc-windows-msvc,
os: windows-latest,
extension: .exe,
},
]
steps:
- name: Fetch latest code
uses: actions/checkout@v3
- name: Setup Rust toolchain
run: rustup target add ${{ matrix.target.name }}
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --locked --target ${{ matrix.target.name }}
- name: Compress
run: |
mv target/${{ matrix.target.name }}/release/<NAME>${{ matrix.target.extension }} .
zstd --ultra -22 -o <NAME>-${{ matrix.target.name }}.zst <NAME>${{ matrix.target.extension }}
- name: Collect artifact
run: |
mkdir -p artifacts
mv <NAME>-${{ matrix.target.name }}.zst artifacts
- name: Upload artifact
uses: actions/[email protected]
with:
name: artifacts
path: artifacts

release:
name: Release
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: artifacts
path: artifacts
- name: Hash
run: |
cd artifacts
sha256sum * | tee ../SHA256
md5sum * | tee ../MD5
mv ../SHA256 .
mv ../MD5 .
- name: Publish
uses: softprops/action-gh-release@v1
with:
discussion_category_name: Announcements
generate_release_notes: true
files: artifacts/*

# publish-on-crates-io:
# name: Publish on crates.io
# runs-on: ubuntu-latest
# steps:
# - name: Fetch latest code
# uses: actions/checkout@v3
# - name: Login
# run: cargo login ${{ secrets.CARGO_REGISTRY_TOKEN }}
# - name: Publish
# run: .maintain/release.sh

clean-artifacts:
name: Clean artifacts
if: always()
needs: [release]
steps:
- name: Clean artifacts
uses: geekyeggo/delete-artifact@v2
with:
name: artifacts
publish-on-crates-io:
name: Publish on crates.io
runs-on: ubuntu-latest
steps:
- name: Fetch latest code
uses: actions/checkout@v3
- name: Login
run: cargo login ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Publish
run: cargo publish --locked
87 changes: 0 additions & 87 deletions .github/workflows/staging.yml

This file was deleted.

Loading

0 comments on commit 3f8416e

Please sign in to comment.