Skip to content

Commit

Permalink
12: add ci
Browse files Browse the repository at this point in the history
closes #12
  • Loading branch information
lowitea committed Dec 19, 2024
1 parent eba460e commit 5a62a6e
Show file tree
Hide file tree
Showing 5 changed files with 166 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: cargo
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
27 changes: 27 additions & 0 deletions .github/workflows/auto_dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Auto Dependabot
on: pull_request

permissions:
contents: write
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1.1.1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve a PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
16 changes: 16 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Release

on:
release:
types: [released]

jobs:
release-crate:
name: release crate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: "1.81.0"
- run: cargo publish --locked --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
75 changes: 75 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Tests

on:
push:
branches:
- master
pull_request:

jobs:
pre_job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
skip_after_successful_duplicate: "true"
paths_ignore: '["**/*.md", "**/*.svg", "**/*.png", ".gitignore"]'

lint_check:
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: "1.81.0"
components: clippy
override: true
- name: Checking code format
run: cargo fmt -- --check --config use_try_shorthand=true
- name: Clippy
uses: clechasseur/rs-clippy-check@v3
with:
args: --all-features --bins --examples --tests --benches -- -D warnings

tests:
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
container:
image: docker.binary.picodata.io/picodata:24.6.1
options: --user root
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install system dependencies
run: dnf install -y gcc git
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: "1.81.0"
override: true
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features
41 changes: 41 additions & 0 deletions MAINTENANCE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Maintenance guide

## Making a new release

1. Update master branch

```shell
git checkout master && git pull
```

1. Update project version in `Cargo.toml`

```shell
vim Cargo.toml
```

1. Update `Cargo.lock`

```shell
cargo update
```

1. Commit `Cargo.toml` and `Cargo.lock` with the version

```shell
git commit -m "bump version" Cargo.toml Cargo.lock
```

1. Make a new git tag

```shell
git tag <NEW_VERSION>
```

1. Push all to upstream

```shell
git push origin master --tags
```

1. [Create](https://github.com/lowitea/gitlobster/releases/new) a new release specifying pushed tag

0 comments on commit 5a62a6e

Please sign in to comment.