Skip to content

Commit

Permalink
Merge pull request #2 from neutron-org/feat/github-actions
Browse files Browse the repository at this point in the history
Github actions
  • Loading branch information
pr0n00gler authored Dec 20, 2022
2 parents 10dd1b3 + 83bb867 commit 050ad0e
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: PR

on:
pull_request:
types: [assigned, unassigned, labeled, unlabeled, opened, edited, closed, reopened, synchronize, converted_to_draft, ready_for_review, locked, unlocked, review_requested, review_request_removed]
issue_comment:
types: [created]
pull_request_review:
types: [submitted]

jobs:
pr_commented:
# This job only runs for pull request comments
name: PR comment
if: ${{ github.event.issue.pull_request }}
runs-on: ubuntu-latest
steps:
- name: Send Notification
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
User @${{ github.actor }} commented PR #${{ github.event.issue.number }} "${{ github.event.issue.title }}" (${{ github.event.issue.pull_request.html_url }})
pull_requests_and_review:
name: Pull request action or review
if: ${{ !github.event.issue.pull_request }}
runs-on: ubuntu-latest
steps:
- name: Send Notification
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
User @${{ github.actor }} updated PR #${{ github.event.number }} "${{ github.event.pull_request.title }}", action "${{ github.event.action }}" (${{ github.event.pull_request.html_url }})
79 changes: 79 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
on:
push:
branches:
- '**'

name: tests

jobs:
clippy:
name: Actions - clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.60.0
components: clippy
profile: minimal
override: true
- run: cargo fetch --verbose
- run: cargo clippy --all --all-targets -- -D warnings

rustfmt:
name: Actions - rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.60.0
components: rustfmt
profile: minimal
override: true
- run: cargo fmt -- --check

checkbuild:
name: Actions - check artifacts hash sums
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.60.0
components: rustfmt
profile: minimal
override: true
- name: Get hash of checksum file
id: checksum
run: echo "::set-output name=DATA::$(shasum -a 256 ./artifacts/checksums.txt | cut -f1 -d ' ')"
- name: Rebuild artifacts
run: make schema && ./build_release.sh
- name: Verify
run: if [[ "${{steps.checksum.outputs.DATA}}" != $(shasum -a 256 ./artifacts/checksums.txt | cut -f1 -d ' ') ]]; then return 2; fi

unit-test:
name: Actions - unit test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macOS-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.60.0
profile: minimal
- run: cargo fetch --verbose
- run: cargo build
- run: cargo test --verbose --all
env:
RUST_BACKTRACE: 1

0 comments on commit 050ad0e

Please sign in to comment.