ci: rewrite
Rewrite github actions inspirated from 3d2c40ce2f/.github/workflows
This commit is contained in:
parent
e614b64bba
commit
b5dd0b3291
|
@ -1,13 +1,8 @@
|
|||
name: Build release binaries (and publish them if this is a tag)
|
||||
name: Build release binaries
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "*"
|
||||
|
||||
# pull_request:
|
||||
|
||||
workflow_dispatch:
|
||||
workflow_call:
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
@ -29,7 +24,7 @@ jobs:
|
|||
include:
|
||||
- os: ubuntu-latest
|
||||
target: x86_64-unknown-linux-musl
|
||||
artifact_name: target/x86_64-unknown-linux-musl/release/homedisk
|
||||
artifact_path: target/x86_64-unknown-linux-musl/release/homedisk
|
||||
release_name: x86_64-unknown-linux-musl
|
||||
cross: true
|
||||
strip: true
|
||||
|
@ -37,7 +32,7 @@ jobs:
|
|||
|
||||
- os: ubuntu-latest
|
||||
target: armv7-unknown-linux-musleabihf
|
||||
artifact_name: target/armv7-unknown-linux-musleabihf/release/homedisk
|
||||
artifact_path: target/armv7-unknown-linux-musleabihf/release/homedisk
|
||||
release_name: armv7-unknown-linux-musleabihf
|
||||
cross: true
|
||||
strip: false
|
||||
|
@ -45,7 +40,7 @@ jobs:
|
|||
|
||||
- os: ubuntu-latest
|
||||
target: aarch64-unknown-linux-musl
|
||||
artifact_name: target/aarch64-unknown-linux-musl/release/homedisk
|
||||
artifact_path: target/aarch64-unknown-linux-musl/release/homedisk
|
||||
release_name: aarch64-unknown-linux-musl
|
||||
cross: true
|
||||
strip: false
|
||||
|
@ -53,7 +48,7 @@ jobs:
|
|||
|
||||
- os: windows-latest
|
||||
target: x86_64-pc-windows-msvc
|
||||
artifact_name: target/x86_64-pc-windows-msvc/release/homedisk.exe
|
||||
artifact_path: target/x86_64-pc-windows-msvc/release/homedisk.exe
|
||||
release_name: x86_64-pc-windows-msvc.exe
|
||||
cross: false
|
||||
strip: true
|
||||
|
@ -61,7 +56,7 @@ jobs:
|
|||
|
||||
- os: macos-latest
|
||||
target: x86_64-apple-darwin
|
||||
artifact_name: target/x86_64-apple-darwin/release/homedisk
|
||||
artifact_path: target/x86_64-apple-darwin/release/homedisk
|
||||
release_name: x86_64-apple-darwin
|
||||
cross: false
|
||||
strip: true
|
||||
|
@ -69,7 +64,7 @@ jobs:
|
|||
|
||||
- os: macos-latest
|
||||
target: aarch64-apple-darwin
|
||||
artifact_name: target/aarch64-apple-darwin/release/homedisk
|
||||
artifact_path: target/aarch64-apple-darwin/release/homedisk
|
||||
release_name: aarch64-apple-darwin
|
||||
cross: false
|
||||
strip: true
|
||||
|
@ -102,27 +97,17 @@ jobs:
|
|||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: build
|
||||
args: --release --target=${{ matrix.target }} ${{ matrix.cargo_flags }}
|
||||
args: --release --target=${{ matrix.target }} ${{ matrix.release_name }}
|
||||
use-cross: ${{ matrix.cross }}
|
||||
|
||||
- name: Prepare artifact
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir release
|
||||
mv ${{ matrix.artifact_path }} release/${{ matrix.artifact_path }}
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.target }}
|
||||
path: ${{ matrix.artifact_name }}
|
||||
|
||||
- name: Get tag name
|
||||
id: tag_name
|
||||
run: |
|
||||
echo ::set-output name=current_version::${GITHUB_REF#refs/tags/v}
|
||||
shell: bash
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
|
||||
- name: Publish
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: ${{ matrix.artifact_name }}
|
||||
tag: ${{ github.ref }}
|
||||
asset_name: cloud-$tag-${{ matrix.release_name }}
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
name: release-${{ matrix.target }}
|
||||
path: ./release/*
|
|
@ -0,0 +1,101 @@
|
|||
name: Build release binaries (and publish them if this is a tag)
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "*"
|
||||
|
||||
# pull_request:
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
build-release:
|
||||
uses: ./.github/workflows/build_releases.yml
|
||||
|
||||
clippy-and-tests:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
rust: [stable, nightly]
|
||||
|
||||
name: ${{ matrix.rust }} on ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Rust toolchain
|
||||
id: rust-toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: ${{ matrix.rust }}
|
||||
override: true
|
||||
components: clippy
|
||||
|
||||
- name: Cache
|
||||
uses: actions/cache@v3
|
||||
id: cache
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry/cache/
|
||||
target/
|
||||
key: clippy-test-${{ runner.os }}-${{ matrix.rust }}-${{ steps.rust-toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: cargo clippy
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: clippy
|
||||
args: --no-deps -- -D warnings
|
||||
|
||||
- name: cargo test
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
||||
args: --all-features
|
||||
|
||||
upload-release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-release]
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
|
||||
steps:
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
path: ./
|
||||
|
||||
- name: Move artifacts
|
||||
run: |
|
||||
mkdir release
|
||||
mv release-*/* release/
|
||||
|
||||
- name: Get tag name
|
||||
id: tag_name
|
||||
run: |
|
||||
echo ::set-output name=current_version::${GITHUB_REF#refs/tags/v}
|
||||
|
||||
- name: Upload release files
|
||||
uses: softprops/action-gh-release@17cd0d34deddf848fc0e7d9be5202c148c270a0a # 0.1.14
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
prerelease: false
|
||||
tag_name: ${{ github.ref }}
|
||||
draft: true
|
||||
fail_on_unmatched_files: true
|
||||
name: ${{ github.ref }} Release
|
||||
body: |
|
||||
<!-- Write summary here -->
|
||||
---
|
||||
## Features
|
||||
## Changes
|
||||
## Bug Fixes
|
||||
## Internal Changes
|
||||
files: |
|
||||
./release/*
|
|
@ -0,0 +1,53 @@
|
|||
name: Nightly
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
build-release:
|
||||
uses: ./.github/workflows/build_releases.yml
|
||||
|
||||
upload-release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-release]
|
||||
|
||||
steps:
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
path: ./
|
||||
|
||||
- name: Move artifacts
|
||||
run: |
|
||||
mkdir release
|
||||
mv release-*/* release/
|
||||
echo "Generated $(ls ./release | wc -l) files:"
|
||||
du -h -d 0 ./release/*
|
||||
|
||||
- name: Delete tag and release
|
||||
uses: dev-drprasad/delete-tag-and-release@085c6969f18bad0de1b9f3fe6692a3cd01f64fe5 # 0.2.0
|
||||
with:
|
||||
delete_release: true
|
||||
tag_name: nightly
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Sleep for a few seconds to prevent timing issues between the deletion and creation of the release
|
||||
run: sleep 10
|
||||
|
||||
- name: Upload all release files
|
||||
uses: softprops/action-gh-release@17cd0d34deddf848fc0e7d9be5202c148c270a0a # 0.1.14
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
prerelease: true
|
||||
tag_name: "nightly"
|
||||
draft: false
|
||||
fail_on_unmatched_files: true
|
||||
files: |
|
||||
./release/*
|
|
@ -1,63 +0,0 @@
|
|||
name: Rust
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
pull_request:
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
rust: [stable, nightly]
|
||||
|
||||
name: ${{ matrix.rust }} on ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Rust toolchain
|
||||
id: rust-toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: ${{ matrix.rust }}
|
||||
override: true
|
||||
components: clippy
|
||||
|
||||
- name: Cache
|
||||
uses: actions/cache@v3
|
||||
id: cache
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry/cache/
|
||||
target/
|
||||
key: ${{ runner.os }}-${{ matrix.rust }}-${{ steps.rust-toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: cargo build
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: build
|
||||
|
||||
- name: cargo clippy
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: clippy
|
||||
args: --no-deps -- -D warnings
|
||||
|
||||
- name: cargo test
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
||||
args: --all-features
|
Loading…
Reference in New Issue