Use github action
This commit is contained in:
108
.github/workflows/ci.yml
vendored
Normal file
108
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
name: Build
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build in ${{ matrix.os }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
|
|
||||||
|
env:
|
||||||
|
NAME: updns
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install Rust toolchain
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: stable
|
||||||
|
components: rustfmt, clippy
|
||||||
|
|
||||||
|
- name: Cache cargo registry
|
||||||
|
uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: ~/.cargo/registry
|
||||||
|
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
|
- name: Cache cargo index
|
||||||
|
uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: ~/.cargo/git
|
||||||
|
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
|
- name: Cache cargo build
|
||||||
|
uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: target
|
||||||
|
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
|
- name: Cargo fmt
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: fmt
|
||||||
|
args: --all -- --check
|
||||||
|
|
||||||
|
- name: Cargo clippy
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: clippy
|
||||||
|
|
||||||
|
- name: Cargo test
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: test
|
||||||
|
args: --release
|
||||||
|
|
||||||
|
- name: Cargo build
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: build
|
||||||
|
args: --release
|
||||||
|
|
||||||
|
# -------------- Relese --------------
|
||||||
|
|
||||||
|
- name: Get release version (windows)
|
||||||
|
if: startsWith(github.ref, 'refs/tags/') && startsWith(matrix.os, 'windows')
|
||||||
|
id: GITHUB_RELEASE
|
||||||
|
shell: bash
|
||||||
|
run: echo ::set-output name=TAG::${GITHUB_REF:10}
|
||||||
|
|
||||||
|
- name: Package zip (linux)
|
||||||
|
if: startsWith(github.ref, 'refs/tags/') && startsWith(matrix.os, 'ubuntu')
|
||||||
|
run: |
|
||||||
|
cd ./target/release/
|
||||||
|
zip ${{ env.NAME }}-${GITHUB_REF:10}-linux.zip ${{ env.NAME }}
|
||||||
|
|
||||||
|
- name: Package zip (osx)
|
||||||
|
if: startsWith(github.ref, 'refs/tags/') && startsWith(matrix.os, 'macos')
|
||||||
|
run: |
|
||||||
|
cd ./target/release/
|
||||||
|
zip ${{ env.NAME }}-${GITHUB_REF:10}-osx.zip ${{ env.NAME }}
|
||||||
|
|
||||||
|
- name: Package zip (windows)
|
||||||
|
if: startsWith(github.ref, 'refs/tags/') && startsWith(matrix.os, 'windows')
|
||||||
|
run: |
|
||||||
|
cd ./target/release/
|
||||||
|
Compress-Archive -CompressionLevel Optimal -Force -Path ${{ env.NAME }}.exe -DestinationPath ${{ env.NAME }}-${{ steps.GITHUB_RELEASE.outputs.TAG }}-windows.zip
|
||||||
|
|
||||||
|
- name: GitHub release
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
files: ./target/release/*.zip
|
||||||
|
|
||||||
|
- name: Cargo publish
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
if: startsWith(github.ref, 'refs/tags/') && startsWith(matrix.os, 'ubuntu')
|
||||||
|
with:
|
||||||
|
command: publish
|
||||||
|
args: --token ${{ secrets.CARGO_TOKEN }} -v
|
||||||
|
|
||||||
|
|
||||||
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -577,7 +577,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "updns"
|
name = "updns"
|
||||||
version = "0.2.0"
|
version = "0.1.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ace 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ace 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "updns"
|
name = "updns"
|
||||||
version = "0.2.0"
|
version = "0.1.2"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
authors = ["wyhaya <wyhaya@gmail.com>"]
|
authors = ["wyhaya <wyhaya@gmail.com>"]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
|
|
||||||
# updns
|
# updns
|
||||||
|
[](https://github.com/wyhaya/updns/actions)
|
||||||
[](https://travis-ci.org/wyhaya/updns)
|
[](https://travis-ci.org/wyhaya/updns)
|
||||||
[](https://crates.io/crates/updns)
|
[](https://crates.io/crates/updns)
|
||||||
[](https://github.com/wyhaya/updns/blob/master/LICENSE)
|
[](https://github.com/wyhaya/updns/blob/master/LICENSE)
|
||||||
|
|||||||
Reference in New Issue
Block a user