Skip to content

Commit

Permalink
add GitHub configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
lonepeon committed Jun 22, 2022
1 parent 279bcf3 commit bb3309f
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 2 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: ci
on:
pull_request:
push:
branches:
- main
jobs:
test:
name: test
runs-on: "ubuntu-latest"
env:
TARGET_DIR: ./target
RUST_BACKTRACE: 1
steps:
- name: "checkout code"
uses: actions/checkout@v2
- name: "install rust"
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: "build application"
run: cargo build --verbose
- name: "run tests"
run: make test-unit

rustfmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- name: "checkout code"
uses: actions/checkout@v2
- name: "install rust"
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
components: rustfmt
- name: "check formatting"
run: make test-style
- name: "check linting"
run: make test-lint
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: release
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
build:
name: "build release"
runs-on: "ubuntu-latest"
steps:
- name: "checkout code"
uses: actions/checkout@v2
- name: "install rust"
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: "build application"
run: VERSION=${{ github.ref_name }} cargo build --verbose --release
- name: "get github release metadata"
id: get_release
uses: bruceadams/get-release@v1.2.1
env:
GITHUB_TOKEN: ${{ github.token }}
- name: "upload release to github"
uses: actions/upload-release-asset@v1
id: upload_release
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./target/release/ipcalc
asset_name: ipcalc-linux-amd64-${{ github.ref_name }}
asset_content_type: application/octet-stream
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ setup: .git/hooks/pre-commit

.PHONY: test-unit
test-unit:
$(CARGO_BIN) test
$(CARGO_BIN) test --verbose

.PHONY: test-style
test-style:
$(CARGO_BIN) fmt --check
$(CARGO_BIN) fmt --all -- --check

.PHONY: test-lint
test-lint:
Expand Down

0 comments on commit bb3309f

Please sign in to comment.