Skip to content

Commit

Permalink
GitHub workflows (test & release)
Browse files Browse the repository at this point in the history
  • Loading branch information
ecarrara committed Jul 31, 2023
1 parent 567acd2 commit 2266bca
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: release

on:
release:
types: [published]

jobs:
release-binaries:
name: Publish for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
artifact_name: obsidian-garden
asset_name: obsidian-garden-linux-amd64
- os: macos-latest
artifact_name: obsidian-garden
asset_name: obsidian-garden-macos-amd64

steps:
- uses: actions/checkout@v3

- name: Build
run: cargo build --release

- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/release/${{ matrix.artifact_name }}
asset_name: ${{ matrix.asset_name }}
tag: ${{ github.ref }}

release-default-template:
name: Publish default template
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- run: zip -r default-template.zip templates/default

- uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: default-template.zip
tag: ${{ github.ref }}
61 changes: 61 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: test

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: install rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-unknown-linux-gnu
override: true
default: true

- name: rustfmt
uses: actions-rs/cargo@v1
with:
command: clippy

- name: rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check

test:
runs-on: "${{ matrix.platform.os }}"
strategy:
fail-fast: false
matrix:
platform:
- os: ubuntu-latest
toolchain: stable
target: x86_64-unknown-linux-gnu
- os: macos-latest
toolchain: stable
target: x86_64-apple-darwin
steps:
- uses: actions/checkout@v3

- name: install rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.platform.toolchain }}
target: ${{ matrix.platform.target }}
override: true
default: true

- name: test
uses: actions-rs/cargo@v1
with:
command: test
args: --target ${{ matrix.platform.target }}

0 comments on commit 2266bca

Please sign in to comment.