From 26235415bdef97637a7fa607bb4e4d9391051ef5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 11 Oct 2025 17:22:43 +0000 Subject: [PATCH 1/5] Initial plan From abef0bb3893a0b230644908da4aee413779681df Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 11 Oct 2025 17:26:01 +0000 Subject: [PATCH 2/5] Add GitHub Actions CI workflow and semantic-release configuration Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com> --- .github/workflows/ci.yml | 46 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 38 +++++++++++++++++++++++++++++ .releaserc.json | 22 +++++++++++++++++ 3 files changed, 106 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml create mode 100644 .releaserc.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..45b40ac --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,46 @@ +name: CI + +on: + pull_request: + branches: + - master + - main + push: + branches: + - master + - main + +jobs: + test: + name: Test + runs-on: ubuntu-latest + strategy: + matrix: + elixir: ['1.14.2'] + otp: ['25.1.1'] + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Elixir + uses: erlef/setup-beam@v1 + with: + elixir-version: ${{ matrix.elixir }} + otp-version: ${{ matrix.otp }} + + - name: Restore dependencies cache + uses: actions/cache@v3 + with: + path: deps + key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} + restore-keys: ${{ runner.os }}-mix- + + - name: Install dependencies + run: mix deps.get + + - name: Check formatting + run: mix format --check-formatted + + - name: Run tests + run: mix test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c11b137 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,38 @@ +name: Release + +on: + push: + branches: + - master + - main + +jobs: + release: + name: Release + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, 'skip ci')" + + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '18' + + - name: Install semantic-release + run: | + npm install -g \ + semantic-release@21 \ + @semantic-release/git@10 \ + @semantic-release/changelog@6 \ + @semantic-release/exec@6 + + - name: Run semantic-release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: npx semantic-release diff --git a/.releaserc.json b/.releaserc.json new file mode 100644 index 0000000..749ecd5 --- /dev/null +++ b/.releaserc.json @@ -0,0 +1,22 @@ +{ + "branches": ["master", "main"], + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + "@semantic-release/changelog", + [ + "@semantic-release/exec", + { + "prepareCmd": "sed -i 's/version: \"[0-9]\\+\\.[0-9]\\+\\.[0-9]\\+\"/version: \"${nextRelease.version}\"/' mix.exs" + } + ], + [ + "@semantic-release/git", + { + "assets": ["CHANGELOG.md", "mix.exs"], + "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" + } + ], + "@semantic-release/github" + ] +} From 6945278e3ad5fbc4513458a4a0fe963bb1965703 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 11 Oct 2025 17:27:37 +0000 Subject: [PATCH 3/5] docs: add CONTRIBUTING.md and CI badge to README Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com> --- .releaserc.json | 2 +- CONTRIBUTING.md | 133 ++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 3 ++ 3 files changed, 137 insertions(+), 1 deletion(-) create mode 100644 CONTRIBUTING.md diff --git a/.releaserc.json b/.releaserc.json index 749ecd5..d181aff 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -7,7 +7,7 @@ [ "@semantic-release/exec", { - "prepareCmd": "sed -i 's/version: \"[0-9]\\+\\.[0-9]\\+\\.[0-9]\\+\"/version: \"${nextRelease.version}\"/' mix.exs" + "prepareCmd": "sed -i 's/version: \"[0-9]\\.[0-9]\\+\\.[0-9]\\+\"/version: \"${nextRelease.version}\"/' mix.exs" } ], [ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..9f16f77 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,133 @@ +# Contributing to casbin-ex + +Thank you for your interest in contributing to casbin-ex! This document provides guidelines and information about the development workflow. + +## Development Setup + +### Prerequisites + +- Elixir 1.14.2 or higher +- Erlang/OTP 25.1.1 or higher + +### Getting Started + +1. Fork and clone the repository +2. Install dependencies: + ```bash + mix deps.get + ``` +3. Run tests to ensure everything is working: + ```bash + mix test + ``` + +## Code Quality + +### Formatting + +We use the standard Elixir formatter. Before submitting a PR, ensure your code is properly formatted: + +```bash +mix format +``` + +### Testing + +All new features and bug fixes should include tests. Run the test suite with: + +```bash +mix test +``` + +## Continuous Integration + +### CI Workflow + +Every pull request automatically triggers our CI workflow which: + +- Sets up Elixir and Erlang environment +- Installs dependencies +- Checks code formatting with `mix format --check-formatted` +- Runs the full test suite with `mix test` + +All checks must pass before a PR can be merged. + +## Commit Message Convention + +We use [Conventional Commits](https://www.conventionalcommits.org/) for automatic versioning and changelog generation. + +### Commit Message Format + +``` +(): + + + +