support for github actions #6
2 changed files with 126 additions and 0 deletions
60
.github/workflows/release.yaml
vendored
Normal file
60
.github/workflows/release.yaml
vendored
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
name: "Release"
|
||||||
|
permissions:
|
||||||
|
contents: "write"
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
jobs:
|
||||||
|
get-tag:
|
||||||
|
name: "Get Tag From Package Version"
|
||||||
|
runs-on: "ubuntu-latest"
|
||||||
|
outputs:
|
||||||
|
pkg-version: ${{ steps.pkg-version.outputs.PKG_VERSION }}
|
||||||
|
steps:
|
||||||
|
- name: "Check out the repo"
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: "Get tag"
|
||||||
|
id: "pkg-version"
|
||||||
|
shell: "bash"
|
||||||
|
run: |
|
||||||
|
echo PKG_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/["]/, "", $2); printf("%s",$2) }' Cargo.toml) >> $GITHUB_OUTPUT
|
||||||
|
create-release:
|
||||||
|
name: "Create release"
|
||||||
|
needs: "get-tag"
|
||||||
|
runs-on: "ubuntu-latest"
|
||||||
|
steps:
|
||||||
|
- name: "Check out the repo"
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: "Create release"
|
||||||
|
uses: "taiki-e/create-gh-release-action@v1"
|
||||||
|
with:
|
||||||
|
# (optional) Path to changelog.
|
||||||
|
# changelog: CHANGELOG.md
|
||||||
|
branch: "master"
|
||||||
|
ref: refs/tags/v${{ needs.get-tag.outputs.pkg-version }}
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
upload-assets:
|
||||||
|
name: "Upload assets to Github releases"
|
||||||
|
needs:
|
||||||
|
- "get-tag"
|
||||||
|
- "create-release"
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- target: "x86_64-unknown-linux-gnu"
|
||||||
|
os: "ubuntu-latest"
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: "Check out the repo"
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: "Upload Binaries"
|
||||||
|
uses: "taiki-e/upload-rust-binary-action@v1"
|
||||||
|
with:
|
||||||
|
bin: "frogbot"
|
||||||
|
target: ${{ matrix.target }}
|
||||||
|
archive: $bin-${{ matrix.target }}
|
||||||
|
ref: refs/tags/v${{ needs.get-tag.outputs.pkg-version }}
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
66
.github/workflows/test.yaml
vendored
Normal file
66
.github/workflows/test.yaml
vendored
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
name: Test
|
||||||
|
on: [pull_request, push]
|
||||||
|
jobs:
|
||||||
|
check:
|
||||||
|
name: "Cargo check"
|
||||||
|
runs-on: "ubuntu-latest"
|
||||||
|
steps:
|
||||||
|
- name: "Check out the repo"
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- uses: "actions-rs/toolchain@v1"
|
||||||
|
with:
|
||||||
|
profile: "minimal"
|
||||||
|
toolchain: "stable"
|
||||||
|
override: true
|
||||||
|
- uses: "actions-rs/cargo@v1"
|
||||||
|
with:
|
||||||
|
command: "check"
|
||||||
|
|
||||||
|
test:
|
||||||
|
name: "Cargo test"
|
||||||
|
runs-on: "ubuntu-latest"
|
||||||
|
steps:
|
||||||
|
- name: "Check out the repo"
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- uses: "actions-rs/toolchain@v1"
|
||||||
|
with:
|
||||||
|
profile: "minimal"
|
||||||
|
toolchain: "stable"
|
||||||
|
override: true
|
||||||
|
- uses: "actions-rs/cargo@v1"
|
||||||
|
with:
|
||||||
|
command: "test"
|
||||||
|
|
||||||
|
fmt:
|
||||||
|
name: "Cargo format"
|
||||||
|
runs-on: "ubuntu-latest"
|
||||||
|
steps:
|
||||||
|
- name: "Check out the repo"
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- uses: "actions-rs/toolchain@v1"
|
||||||
|
with:
|
||||||
|
profile: "minimal"
|
||||||
|
toolchain: "stable"
|
||||||
|
override: true
|
||||||
|
- run: "rustup component add rustfmt"
|
||||||
|
- uses: "actions-rs/cargo@v1"
|
||||||
|
with:
|
||||||
|
command: "fmt"
|
||||||
|
args: "--all -- --check"
|
||||||
|
|
||||||
|
clippy:
|
||||||
|
name: "Cargo clippy"
|
||||||
|
runs-on: "ubuntu-latest"
|
||||||
|
steps:
|
||||||
|
- name: "Check out the repo"
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- uses: "actions-rs/toolchain@v1"
|
||||||
|
with:
|
||||||
|
profile: "minimal"
|
||||||
|
toolchain: "stable"
|
||||||
|
override: true
|
||||||
|
- run: "rustup component add clippy"
|
||||||
|
- uses: "actions-rs/cargo@v1"
|
||||||
|
with:
|
||||||
|
command: "clippy"
|
||||||
|
args: "-- -D warnings"
|
Loading…
Reference in a new issue