From 205ed92c05ad207d210f281dd2205b78f795000b Mon Sep 17 00:00:00 2001 From: ChenYing Kuo Date: Fri, 29 Nov 2024 14:56:57 +0800 Subject: [PATCH] Add CI to the project. Signed-off-by: ChenYing Kuo --- .github/release.yaml | 24 +++++++++++++++ .github/workflows/ci.yaml | 29 ++++++++++++++++++ .github/workflows/release.yaml | 56 ++++++++++++++++++++++++++++++++++ .markdownlint.yaml | 5 +++ .pre-commit-config.yaml | 14 +++++++++ 5 files changed, 128 insertions(+) create mode 100644 .github/release.yaml create mode 100644 .github/workflows/ci.yaml create mode 100644 .github/workflows/release.yaml create mode 100644 .markdownlint.yaml create mode 100644 .pre-commit-config.yaml diff --git a/.github/release.yaml b/.github/release.yaml new file mode 100644 index 0000000..30e07ba --- /dev/null +++ b/.github/release.yaml @@ -0,0 +1,24 @@ +changelog: + exclude: + labels: + - duplicate + - wontfix + - invalid + authors: + - octocat + categories: + - title: "🛠️ Breaking Changes" + labels: + - "breaking change" + - title: "✨ Features" + labels: + - enhancement + - title: "🐛 Bug Fixes" + labels: + - bug + - title: "📚 Documentation" + labels: + - documentation + - title: "Other Changes" + labels: + - "*" diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..a227add --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,29 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + paths: + - "src/**" + - "tests/**" + - "examples/**" + - "Cargo.*" + - ".github/**" + workflow_dispatch: + +concurrency: + group: ${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: true + +jobs: + markdown_lint: + runs-on: ubuntu-22.04 + steps: + - uses: articulate/actions-markdownlint@v1 + with: + config: .markdownlint.yaml + files: '*.md' + ignore: target + version: 0.28.1 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..1fc2a64 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,56 @@ +name: Release + +on: + push: + tags: + - v* + workflow_dispatch: + +concurrency: + group: "release-${{ github.head_ref || github.ref }}" + cancel-in-progress: true + +jobs: + ci: + uses: ./.github/workflows/ci.yaml + + tag_release_artifacts: + # This only runs if this workflow is initiated via a tag-push with pattern 'v*' + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + name: collect v-tag release artifacts + runs-on: ubuntu-latest + needs: + - ci + permissions: write-all + steps: + - uses: actions/checkout@v4 + + # README - we later need the download_url output of the upload step + - name: Upload README to release + uses: svenstaro/upload-release-action@v2 + id: upload_readme + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: README.md + tag: ${{ github.ref }} + + - name: Gets latest created release info + id: latest_release_info + uses: joutvhu/get-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Collect all artifacts + uses: anotherdaniel/quevee@v0.4.1 + id: quevee_manifest + with: + release_url: ${{ steps.latest_release_info.outputs.html_url }} + artifacts_readme: ${{ steps.upload_readme.outputs.browser_download_url }} + + - name: Upload manifest to release + uses: svenstaro/upload-release-action@v2 + id: upload_quality_manifest + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ steps.quevee_manifest.outputs.manifest_file }} + tag: ${{ github.ref }} diff --git a/.markdownlint.yaml b/.markdownlint.yaml new file mode 100644 index 0000000..4350d24 --- /dev/null +++ b/.markdownlint.yaml @@ -0,0 +1,5 @@ +{ + "MD013": false, # Line length limitation + "MD033": false, # Enable Inline HTML + "MD041": false, # Allow first line heading +} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..297c2a8 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,14 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + + - repo: https://github.com/igorshubovych/markdownlint-cli + rev: v0.41.0 + hooks: + - id: markdownlint