Merge branch 'main' into add_readme

This commit is contained in:
Orhun Parmaksız 2022-04-07 23:47:33 +03:00
commit 7394eeec3b
No known key found for this signature in database
GPG key ID: F83424824B3E4B90
7 changed files with 175 additions and 3 deletions

163
.github/workflows/cd.yml vendored Normal file
View file

@ -0,0 +1,163 @@
name: Continuous Deployment
on:
push:
tags:
- "v*.*.*"
jobs:
publish-github:
name: Publish on GitHub
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
TOOLCHAIN: [stable]
CONFIG:
- { TARGET: x86_64-unknown-linux-gnu, FEATURES: "" }
- { TARGET: x86_64-unknown-linux-musl, FEATURES: "" }
- {
TARGET: x86_64-unknown-linux-gnu,
FEATURES: "--no-default-features",
}
- {
TARGET: x86_64-unknown-linux-musl,
FEATURES: "--no-default-features",
}
- {
TARGET: i686-unknown-linux-gnu,
FEATURES: "--no-default-features",
}
- {
TARGET: i686-unknown-linux-musl,
FEATURES: "--no-default-features",
}
- {
TARGET: aarch64-unknown-linux-gnu,
FEATURES: "--no-default-features",
}
- {
TARGET: aarch64-unknown-linux-musl,
FEATURES: "--no-default-features",
}
- {
TARGET: armv5te-unknown-linux-gnueabi,
FEATURES: "--no-default-features",
}
- {
TARGET: armv7-unknown-linux-gnueabihf,
FEATURES: "--no-default-features",
}
- {
TARGET: arm-unknown-linux-gnueabi,
FEATURES: "--no-default-features",
}
- {
TARGET: arm-unknown-linux-gnueabihf,
FEATURES: "--no-default-features",
}
- {
TARGET: riscv64gc-unknown-linux-gnu,
FEATURES: "--no-default-features",
}
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
--no-install-recommends \
--allow-unauthenticated \
libxcb-shape0-dev \
libxcb-xfixes0-dev \
libxkbcommon-dev \
musl-tools
- name: Checkout the repository
uses: actions/checkout@v3
- name: Set the release version
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.TOOLCHAIN }}
target: ${{ matrix.CONFIG.TARGET }}
profile: minimal
override: true
- name: Build
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.CONFIG.FEATURES != '' }}
command: build
args: >
--release
--locked
--target ${{ matrix.CONFIG.TARGET }}
${{ matrix.CONFIG.FEATURES }}
- name: Prepare release assets
id: assets
shell: bash
run: |
release_dir="systeroid-${{ env.RELEASE_VERSION }}"
if [ -z "${{ matrix.CONFIG.FEATURES }}" ]; then
artifact_name="$release_dir-${{ matrix.CONFIG.TARGET }}_all-features.tar.gz"
else
artifact_name="$release_dir-${{ matrix.CONFIG.TARGET }}.tar.gz"
fi
mkdir -p release/man8
cp {LICENSE-APACHE,LICENSE-MIT} release/
cp man8/* release/man8/
for bin in 'systeroid' 'systeroid-tui'; do
cp "target/${{ matrix.CONFIG.TARGET }}/release/$bin" release/
done
mv release/ "$release_dir/"
tar -czvf "$artifact_name" "$release_dir/"
echo "::set-output name=artifact_name::$artifact_name"
- name: Sign assets & generate checksums
run: |
sha512sum ${{ steps.assets.outputs.artifact_name }} > \
${{ steps.assets.outputs.artifact_name }}.sha512
echo "${{secrets.GPG_KEY}}" | base64 --decode > signing.key
echo "${{secrets.GPG_PASSPHRASE}}" | \
gpg --pinentry-mode=loopback --passphrase-fd 0 --import signing.key
echo "${{secrets.GPG_PASSPHRASE}}" | \
gpg --pinentry-mode=loopback --passphrase-fd 0 --detach-sign \
${{ steps.assets.outputs.artifact_name }}
- name: Upload the release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.assets.outputs.artifact_name }}*
file_glob: true
overwrite: true
tag: ${{ github.ref }}
publish-crates-io:
name: Publish on crates.io
needs: publish-github
runs-on: ubuntu-20.04
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
--no-install-recommends \
--allow-unauthenticated \
libxcb-shape0-dev \
libxcb-xfixes0-dev \
libxkbcommon-dev \
musl-tools
- name: Checkout the repository
uses: actions/checkout@master
- name: Publish
uses: actions-rs/cargo@v1
with:
command: publish
args: --locked --token ${{ secrets.CARGO_TOKEN }}

View file

@ -43,7 +43,7 @@ jobs:
override: true
- name: Cache Cargo dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
@ -86,7 +86,7 @@ jobs:
override: true
- name: Cache Cargo dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/

View file

@ -40,7 +40,7 @@ jobs:
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}

8
CHANGELOG.md Normal file
View file

@ -0,0 +1,8 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
Initial release.

View file

@ -5,6 +5,7 @@ RUN cargo build --locked --release -p systeroid
RUN cargo build --locked --release --no-default-features -p systeroid-tui
RUN mkdir -p build-out/
RUN ["/bin/bash", "-c", "cp target/x86_64-unknown-linux-musl/release/systeroid{,-tui} build-out/"]
RUN ["/bin/bash", "-c", "strip build-out/systeroid{,-tui}"]
RUN ["/bin/bash", "-c", "scripts/clone-linux-docs.sh"]
FROM scratch