diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..2efc76a --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,72 @@ +# Contributing + +## Request for changes/ Pull Requests +You first need to create a fork of the [payable](https://github.com/unusualify/payable/) repository to commit your changes to it. Methods to fork a repository can be found in the [GitHub Documentation](https://docs.github.com/en/get-started/quickstart/fork-a-repo). + +Then add your fork as a local project: + +```sh +# Using HTTPS +git clone https://github.com/unusualify/payable.git + +# Using SSH +git clone git@github.com:unusualify/payable.git +``` + +> [Which remote URL should be used ?](https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories) + +Then, go to your local folder + +```sh +cd payable +``` + +Add git remote controls : + +```sh +# Using HTTPS +git remote add fork https://github.com/YOUR-USERNAME/payable.git +git remote add upstream https://github.com/unusualify/payable.git + + +# Using SSH +git remote add fork git@github.com:YOUR-USERNAME/payable.git +git remote add upstream git@github.com:unusualify/payable.git +``` + +You can now verify that you have your two git remotes: + +```sh +git remote -v +``` + +## Receive remote updates +In view of staying up to date with the central repository : + +```sh +git pull upstream main +``` + +## Choose a base branch +Before starting development, you need to know which branch to base your modifications/additions on. When in doubt, use main. + +| Type of change | | Branches | +| :------------------ |:---------:| ---------------------:| +| Bug fixes | | `dev` | +| New features | | `dev` | +| Hot fixes | | `main` | +| Documentation | | `main` | +| New issues models | | `YOUR-USERNAME:patch` | + +```sh +# Switch to the desired branch +git switch main + +# Pull down any upstream changes +git pull + +# Create a new branch to work on +git switch --create patch/1234-name-issue +``` + +Commit your changes, then push the branch to your fork with `git push -u fork` and open a pull request on [the payable repository](https://github.com/unusualify/payable/) following the template provided. diff --git a/.github/ISSUE_TEMPLATE/1-bug.yml b/.github/ISSUE_TEMPLATE/1-bug.yml new file mode 100644 index 0000000..c20cd65 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/1-bug.yml @@ -0,0 +1,105 @@ +name: "🐛 Bug Report" +description: Create a new ticket for a bug. +# title: "🐛 [BUG] - " +title: "🐛 [BUG]: " +labels: [ + "bug" +] +body: + - type: textarea + id: description + attributes: + label: "Description" + description: Please enter an explicit description of your issue + placeholder: Short and explicit description of your incident... + validations: + required: true + - type: dropdown + id: severity + attributes: + label: "Severity" + description: Select the severity of the bug (this will determine if it's a hotfix) + options: + - Low + - Medium + - High + - Critical + validations: + required: true + # - type: dropdown + # id: version + # attributes: + # label: "Version" + # description: Select which version of the software the bug is in + # options: + # - Low + # - Medium + # - High + # - Critical + # validations: + # required: true + - type: textarea + id: reprod + attributes: + label: "Reproduction steps" + description: Please enter an explicit description of your issue + value: | + 1. Go to '...' + 2. Click on '....' + 3. Scroll down to '....' + 4. See error + render: bash + validations: + required: true + - type: textarea + id: screenshot + attributes: + label: "Screenshots" + description: If applicable, add screenshots to help explain your problem. + value: | + ![DESCRIPTION](LINK.png) + # render: bash + validations: + required: false + - type: textarea + id: logs + attributes: + label: "Logs" + description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. + render: bash + validations: + required: false + - type: input + id: reprod-url + attributes: + label: "Reproduction URL" + description: Please enter your GitHub URL to provide a reproduction of the issue + placeholder: ex. https://github.com/USERNAME/REPO-NAME + validations: + required: false + - type: dropdown + id: browsers + attributes: + label: "Browsers" + description: What browsers are you seeing the problem on ? + multiple: true + options: + - Firefox + - Chrome + - Safari + - Microsoft Edge + - Opera + validations: + required: false + - type: dropdown + id: os + attributes: + label: "OS" + description: What is the impacted environment ? + multiple: true + options: + - Windows + - Linux + - Mac + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/2-feature.yml b/.github/ISSUE_TEMPLATE/2-feature.yml new file mode 100644 index 0000000..26065c0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/2-feature.yml @@ -0,0 +1,31 @@ +name: "💡 Feature Request" +description: Create a new ticket for a new feature request +# title: "💡 [REQUEST] - <title>" +title: "💡 [FEATURE]: " +labels: [ + "enhancement", +] +body: + - type: textarea + id: description + attributes: + label: "Description" + description: Provide a brief explanation of the feature + placeholder: Describe in a few lines your feature request + validations: + required: true + - type: textarea + id: basic_example + attributes: + label: "Basic Example" + description: Indicate here some basic examples of your feature. + placeholder: A few specific words about your feature request. + validations: + required: true + - type: textarea + id: screenshot + attributes: + label: "Screenshots" + description: If applicable, add screenshots to help explain your problem. + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/3-documentation.yml b/.github/ISSUE_TEMPLATE/3-documentation.yml new file mode 100644 index 0000000..957d082 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/3-documentation.yml @@ -0,0 +1,44 @@ +name: "📚 Documentation" +description: Create a new ticket for documentation +title: "📚 [DOCS]: " +labels: [ + "documentation" +] +body: + - type: textarea + id: description + attributes: + label: "Description" + description: Provide a brief explanation of what documentation is needed + placeholder: Describe what documentation needs to be added or updated + validations: + required: true + - type: dropdown + id: doc_type + attributes: + label: "Documentation Type" + description: Select the type of documentation needed + options: + - API Documentation + - User Guide + - Developer Guide + - Installation Guide + - Other + validations: + required: true + - type: textarea + id: current_documentation + attributes: + label: "Current Documentation" + description: If this is an update, please provide links to the current documentation + placeholder: Links to existing documentation or N/A if this is new + validations: + required: false + - type: textarea + id: proposed_changes + attributes: + label: "Proposed Changes" + description: Describe the specific changes or additions needed + placeholder: List the specific sections or topics that need to be documented + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/4-performance.yml b/.github/ISSUE_TEMPLATE/4-performance.yml new file mode 100644 index 0000000..d05e89a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/4-performance.yml @@ -0,0 +1,59 @@ +name: "⚡ Performance Issue" +description: Create a new ticket for a performance issue or optimization request +title: "⚡ [PERF]: " +labels: [ + "performance" +] +body: + - type: textarea + id: description + attributes: + label: "Description" + description: Please describe the performance issue in detail + placeholder: Explain what performance problem you're experiencing... + validations: + required: true + - type: textarea + id: current_behavior + attributes: + label: "Current Performance" + description: Describe the current performance metrics or behavior + placeholder: e.g., Page takes 5 seconds to load, API response time is 3 seconds + validations: + required: true + - type: textarea + id: expected_behavior + attributes: + label: "Expected Performance" + description: Describe what performance level you expect or need + placeholder: e.g., Page should load within 2 seconds, API should respond within 500ms + validations: + required: true + - type: textarea + id: reproduction + attributes: + label: "Steps to Reproduce" + description: Please provide steps to reproduce the performance issue + value: | + 1. Go to '...' + 2. Click on '....' + 3. Observe performance issue + validations: + required: true + - type: textarea + id: metrics + attributes: + label: "Performance Metrics" + description: If available, provide any performance metrics, profiling data, or benchmarks + render: bash + validations: + required: false + - type: textarea + id: screenshot + attributes: + label: "Screenshots/Recordings" + description: If applicable, add screenshots or recordings showing the performance issue + value: | + ![DESCRIPTION](LINK.png) + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/5-question.yml b/.github/ISSUE_TEMPLATE/5-question.yml new file mode 100644 index 0000000..2c74141 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/5-question.yml @@ -0,0 +1,40 @@ +name: "❓ Question" +description: Create a new ticket for a question +title: "❓ [QUESTION]: " +labels: [ + "question" +] +body: + - type: textarea + id: question + attributes: + label: "Question" + description: Please provide your question with as much detail as possible + placeholder: Describe what you're trying to understand or accomplish... + validations: + required: true + - type: textarea + id: context + attributes: + label: "Context" + description: Provide any relevant context or background information + placeholder: What have you tried? What documentation have you read? + validations: + required: true + - type: textarea + id: examples + attributes: + label: "Code Examples" + description: If applicable, provide code examples related to your question + render: bash + validations: + required: false + - type: textarea + id: screenshot + attributes: + label: "Screenshots" + description: If applicable, add screenshots to help explain your question + value: | + ![DESCRIPTION](LINK.png) + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..3ba13e0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..8d95f16 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,29 @@ +## Checklist +<!--- Please make sure all the following are checked before submitting: --> +- [ ] I have read the **CONTRIBUTING** document. +- [ ] My code follows the code style of this project. +- [ ] My change requires a change to the documentation. +- [ ] I have updated the documentation accordingly. +- [ ] I have added tests to cover my changes. +- [ ] All new and existing tests passed. + + +## Types of changes +<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> +- [ ] feat: A new feature +- [ ] fix: A bug fix +- [ ] docs: Documentation only changes +- [ ] style: Changes that do not affect the meaning of the code (white-space, formatting, etc) +- [ ] refactor: A code change that neither fixes a bug nor adds a feature +- [ ] perf: A code change that improves performance +- [ ] test: Adding missing tests or correcting existing tests +- [ ] build: Changes that affect the build system or external dependencies +- [ ] ci: Changes to our CI configuration files and scripts +- [ ] chore: Other changes that don't modify src or test files +- [ ] revert: Reverts a previous commit + +## Description +<!--- Please describe your changes in detail --> + +## Related Issue +<!--- Please link to the issue here if applicable: --> diff --git a/.github/workflows/close-issue-on-merge.yml b/.github/workflows/close-issue-on-merge.yml new file mode 100644 index 0000000..359c110 --- /dev/null +++ b/.github/workflows/close-issue-on-merge.yml @@ -0,0 +1,32 @@ +name: Close Issue on PR Merge + +on: + pull_request: + types: [closed] + +permissions: + issues: write + pull-requests: read + +jobs: + close_issue: + runs-on: ubuntu-latest + if: github.event.pull_request.merged == true + steps: + - name: Extract Issue Number + id: extract + run: | + # Extract issue number from branch name (assuming format ends with -issue-NUMBER) + BRANCH_NAME="${{ github.event.pull_request.head.ref }}" + ISSUE_NUMBER=$(echo $BRANCH_NAME | grep -oE 'issue-[0-9]+$' | grep -oE '[0-9]+') + if [ ! -z "$ISSUE_NUMBER" ]; then + echo "issue_number=$ISSUE_NUMBER" >> $GITHUB_OUTPUT + fi + + - name: Close Issue + if: steps.extract.outputs.issue_number != '' + run: | + gh issue close ${{ steps.extract.outputs.issue_number }} --repo ${{ github.repository }} --comment "Closing issue as PR [#${{ github.event.pull_request.number }}](${{ github.event.pull_request.html_url }}) has been merged." + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/create-issue-branch.yml b/.github/workflows/create-issue-branch.yml new file mode 100644 index 0000000..761f14f --- /dev/null +++ b/.github/workflows/create-issue-branch.yml @@ -0,0 +1,142 @@ +name: Create Issue Branch + +on: + issues: + types: [opened, labeled] + +permissions: + contents: write + issues: write + +jobs: + create_branch: + runs-on: ubuntu-latest + if: | + contains(github.event.issue.labels.*.name, 'accepted') && + (contains(github.event.issue.labels.*.name, 'enhancement') || contains(github.event.issue.labels.*.name, 'bug')) + steps: + - name: Parse Issue + if: contains(github.event.issue.labels.*.name, 'bug') + uses: stefanbuck/github-issue-parser@v3 + id: issue-parser + # with: + # template-path: .github/ISSUE_TEMPLATE/1-bug.yml # optional but recommended + + - name: Print Issue Body + if: contains(github.event.issue.labels.*.name, 'bug') + run: cat ${HOME}/issue-parser-result.json + + - name: Extract Issue Details + id: extract + run: | + SEVERITY="" + if [[ "${{ contains(github.event.issue.labels.*.name, 'bug') }}" == "true" ]]; then + SEVERITY="${{ steps.issue-parser.outputs.issueparser_severity }}" + fi + TITLE="${{ github.event.issue.title }}" + TITLE=$(echo "$TITLE" | awk -F ']:' '{print $NF}') + echo "title=$TITLE" >> $GITHUB_OUTPUT + echo "severity=$SEVERITY" >> $GITHUB_OUTPUT + + - name: Determine Branch Type + id: prefix + run: | + SOURCE="dev" + if [[ "${{ contains(github.event.issue.labels.*.name, 'enhancement') }}" == "true" ]]; then + PREFIX="feature/" + elif [[ "${{ contains(github.event.issue.labels.*.name, 'bug') }}" == "true" ]]; then + SEVERITY=${{ steps.extract.outputs.severity }} + if [ "$SEVERITY" == "Critical" ]; then + PREFIX="hotfix/" + SOURCE="main" + else + PREFIX="bugfix/" + fi + else + PREFIX="" + fi + + echo "Prefix: $PREFIX" + echo "Source: $SOURCE" + + echo "prefix=$PREFIX" >> $GITHUB_OUTPUT + echo "source=$SOURCE" >> $GITHUB_OUTPUT + + - name: Sanitize Branch Name + id: branch_name + run: | + TITLE="${{ steps.extract.outputs.title }}" + # Convert to lowercase, trim whitespace, replace multiple spaces/special chars with single hyphen + SANITIZED=$(echo "$TITLE" | \ + tr '[:upper:]' '[:lower:]' | \ + sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | \ + sed -e 's/[^[:alnum:]]/-/g' | \ + sed -e 's/-\{2,\}/-/g' | \ + sed -e 's/^-//' -e 's/-$//') + SANITIZED="$SANITIZED-issue-${{ github.event.issue.number}}" + echo "Branch Name: $SANITIZED" + echo "branch=$SANITIZED" >> $GITHUB_OUTPUT + + - name: Checkout Branch + if: steps.prefix.outputs.prefix != '' + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ steps.prefix.outputs.source }} + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Configure Git and Create Branch + if: steps.prefix.outputs.prefix != '' + run: | + # Configure Git + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + + BRANCH_NAME="${{ steps.prefix.outputs.prefix }}${{ steps.branch_name.outputs.branch }}" + + # Get the SHA of the source branch + SOURCE_SHA=$(git rev-parse ${{ steps.prefix.outputs.source }}) + + # Get Repository Node ID + REPO_ID=$(gh api graphql -f query=' + query($owner:String!, $name:String!) { + repository(owner:$owner, name:$name) { + id + } + }' -f owner="${{ github.repository_owner }}" -f name="${{ github.event.repository.name }}" --jq '.data.repository.id') + + # Get Issue Node ID (converting issue number to integer) + ISSUE_ID=$(gh api graphql -f query=' + query($owner:String!, $name:String!, $number:Int!) { + repository(owner:$owner, name:$name) { + issue(number:$number) { + id + } + } + }' -f owner="${{ github.repository_owner }}" -f name="${{ github.event.repository.name }}" -F number=${{ github.event.issue.number }} --jq '.data.repository.issue.id') + + # Create branch using GraphQL API to properly link it to the issue + gh api graphql -f query=' + mutation ($repositoryId: ID!, $issueId: ID!, $name: String!, $oid: GitObjectID!) { + createLinkedBranch(input: {repositoryId: $repositoryId, issueId: $issueId, name: $name, oid: $oid}) { + linkedBranch { + id + } + } + }' \ + -f repositoryId="$REPO_ID" \ + -f issueId="$ISSUE_ID" \ + -f name="$BRANCH_NAME" \ + -f oid="$SOURCE_SHA" + + # Fetch the new branch + git fetch origin "$BRANCH_NAME" + git checkout "$BRANCH_NAME" + + # Create comment on issue linking the branch + gh issue comment "${{ github.event.issue.number }}" --body "Created branch [\`$BRANCH_NAME\`](https://github.com/${{ github.repository }}/tree/$BRANCH_NAME) for this issue." + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + diff --git a/.github/workflows/create-project-item-branch.yml b/.github/workflows/create-project-item-branch.yml new file mode 100644 index 0000000..61715f5 --- /dev/null +++ b/.github/workflows/create-project-item-branch.yml @@ -0,0 +1,66 @@ +name: Create Project Item Branch + +on: + project_card: + types: [moved] + +jobs: + create_branch: + runs-on: ubuntu-latest + if: github.event.project_card.project_name == 'payable' + steps: + - name: Get Issue Details + id: issue + run: | + ISSUE_URL=$(jq -r '.project_card.content_url' "${{ github.event_path }}") + ISSUE_DATA=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" $ISSUE_URL) + echo "::set-output name=title::$(echo "$ISSUE_DATA" | jq -r '.title')" + echo "::set-output name=body::$(echo "$ISSUE_DATA" | jq -r '.body')" + + - name: Extract Issue Details + id: extract + run: | + echo "::set-output name=title::$(echo '${{ steps.issue.outputs.title }}' | awk -F ' - ' '{print $2}')" + echo "::set-output name=type::$(echo '${{ steps.issue.outputs.title }}' | awk '{print $1}' | tr -d ':')" + echo "::set-output name=severity::$(jq -r '.severity' <<< '${{ steps.issue.outputs.body }}')" + + - name: Determine Branch Prefix + id: prefix + run: | + TYPE=${{ steps.extract.outputs.type }} + SEVERITY=${{ steps.extract.outputs.severity }} + if [ "$TYPE" == "feat" ]; then + PREFIX="feature/" + elif [ "$TYPE" == "fix" ]; then + if [ "$SEVERITY" == "Critical" ]; then + PREFIX="hotfix/" + else + PREFIX="bugfix/" + fi + elif [ "$TYPE" == "perf" ]; then + PREFIX="perf/" + elif [ "$TYPE" == "docs" ]; then + PREFIX="docs/" + else + PREFIX="" + fi + echo "::set-output name=prefix::$PREFIX" + + - name: Sanitize Branch Name + id: branch_name + run: | + TITLE=${{ steps.extract.outputs.title }} + # Lowercase, replace spaces with hyphens, remove non-alphanumeric chars + SANITIZED=$(echo "$TITLE" | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | tr -cd 'a-z0-9-_') + echo "::set-output name=branch::$SANITIZED" + + - name: Create Branch + if: steps.prefix.outputs.prefix != '' + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git fetch origin + git checkout -b "${{ steps.prefix.outputs.prefix }}${{ steps.branch_name.outputs.branch }}" + git push origin "${{ steps.prefix.outputs.prefix }}${{ steps.branch_name.outputs.branch }}" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml new file mode 100644 index 0000000..3349d7b --- /dev/null +++ b/.github/workflows/debug.yml @@ -0,0 +1,45 @@ +name: Workflow test + +on: + push: + branches: + - 'debug/**' + +permissions: + contents: write + +jobs: + + debug: + name: Debug + # needs: laravel + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.3 + extensions: json, dom, curl, libxml, mbstring + coverage: none + + - name: Install Pint + run: composer global require laravel/pint + + - name: Run Pint + run: pint + + - name: Commit linted files + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add . + git diff --quiet && git diff --staged --quiet || git commit -m "style(laravel): lint coding styles" + git push + git checkout main + git merge --no-ff ${{ github.ref }} + git log -3 diff --git a/.github/workflows/manual-release.yml b/.github/workflows/manual-release.yml new file mode 100644 index 0000000..820362a --- /dev/null +++ b/.github/workflows/manual-release.yml @@ -0,0 +1,24 @@ +name: Manual Release +on: + workflow_dispatch: + inputs: + tag: + description: The semantic tag name + required: true + +permissions: + contents: write + +jobs: + test: + runs-on: ubuntu-latest + name: Test + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: oobook/automated-release@v1 + with: + gh_token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ github.event.inputs.tag }} + prerelease: 'true' + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..7514b2e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,92 @@ +name: Test & Main Release + +on: + push: + branches: + - 'release/**' + +permissions: + contents: write + +jobs: + release: + name: Release + # needs: laravel + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Extract tag name + run: echo "TAG_NAME=${GITHUB_REF#refs/heads/release/}" >> $GITHUB_ENV + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.3 + extensions: json, dom, curl, libxml, mbstring + coverage: none + + - name: Install Pint + run: composer global require laravel/pint + + - name: Run Pint + run: pint + + - name: Check for Vue changes + id: check-vue-changes + run: | + # git diff --quiet HEAD^ HEAD vue/src/ vue/public/ || echo "vue_changed=true" >> $GITHUB_OUTPUT + git diff --quiet HEAD^ HEAD vue/ || echo "vue_changed=true" >> $GITHUB_OUTPUT + + - name: Setup Node.js + if: steps.check-vue-changes.outputs.vue_changed == 'true' + uses: actions/setup-node@v4 + with: + node-version: '18' + + - name: Install Vue dependencies + if: steps.check-vue-changes.outputs.vue_changed == 'true' + working-directory: vue + run: npm install + + - name: Build Vue + if: steps.check-vue-changes.outputs.vue_changed == 'true' + working-directory: vue + run: npm run build + + - name: Stage changes, commit and tag it + run: | + git config user.name github-actions + git config user.email github-actions@github.com + # Check if vue/dist has changes and commit if necessary + if [ -d "vue/dist" ] && git status vue/dist --porcelain | grep .; then + git add vue/dist + git commit -m "build(vue): update build artifacts for ${{ env.TAG_NAME }}" + fi + # Continue with other changes + git add . + git diff --quiet && git diff --staged --quiet || git commit -m "style(laravel): lint coding styles for ${{ env.TAG_NAME }}" + git push + git checkout main + git merge --no-ff ${{ github.ref }} + git tag ${{ env.TAG_NAME }} + + - name: Push changes + uses: ad-m/github-push-action@master + with: + # branch: ${{ github.event.inputs.major_version }} + branch: 'main' + force: true + - uses: oobook/automated-tag@v1 + id: tag-generation + with: + gh_token: ${{ github.token }} + + - name: Create Release + uses: oobook/automated-release@v1 + id: release-generation + with: + gh_token: ${{ secrets.GITHUB_TOKEN }} + tag: "${{ steps.tag-generation.outputs.tag }}" + prerelease: true diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml new file mode 100644 index 0000000..1bb8b53 --- /dev/null +++ b/.github/workflows/static-analysis.yml @@ -0,0 +1,38 @@ +name: Static Analysis + +on: + workflow_dispatch: + # push: + # branches: + # - dev + # paths-ignore: + # - '**.md' + # - '**.yml' + # - '**.yaml' + # pull_request: + # branches: + # - main + # - dev + # paths-ignore: + # - '**.md' + # - '**.yml' + # - '**.yaml' + +jobs: + phpstan: + name: phpstan + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.1' + coverage: none + + - name: Install composer dependencies + run: composer install -n --prefer-dist + + - name: Run Static Analysis + run: ./vendor/bin/phpstan --error-format=github diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..23da86c --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,79 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: Tests + +on: + push: + branches: + - dev + paths-ignore: + - '**.md' + - '**.yml' + - '**.yaml' + pull_request: + branches: + - main + - dev + paths-ignore: + - '**.md' + - '**.yml' + - '**.yaml' +jobs: + laravel_changes: + name: Check Laravel changes + runs-on: ubuntu-latest + outputs: + is_changed: ${{ steps.changed-files.outputs.any_changed }} + steps: + - uses: actions/checkout@v4 + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v35 + with: + files: | + src/** + tests/** + routes/** + config/** + laravel: + needs: laravel_changes + runs-on: ubuntu-latest + if: ${{ needs.laravel_changes.outputs.is_changed == 'true' }} + strategy: + fail-fast: true + matrix: + # os: [ubuntu-latest] + php: [8.1, 8.2, 8.3] + laravel: [10.x] + stability: [ prefer-stable ] + dependency-version: [ prefer-stable ] + include: + - laravel: 10.* + testbench: ^8.0 + + name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo + coverage: none + + - name: Setup problem matchers + run: | + echo "::add-matcher::${{ runner.tool_cache }}/php.json" + echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + - name: Install dependencies + run: | + composer install + # composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update + composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update + composer update --${{ matrix.stability }} --prefer-dist --no-interaction + - name: Execute Laravel tests + run: composer test + diff --git a/.github/workflows/update-changelog.yml b/.github/workflows/update-changelog.yml new file mode 100644 index 0000000..775bb91 --- /dev/null +++ b/.github/workflows/update-changelog.yml @@ -0,0 +1,35 @@ +# .github/workflows/update-changelog.yaml +name: "Update Changelog" + +on: + release: + types: [released] + +jobs: + update: + runs-on: ubuntu-latest + + permissions: + # Give the default GITHUB_TOKEN write permission to commit and push the + # updated CHANGELOG back to the repository. + # https://github.blog/changelog/2023-02-02-github-actions-updating-the-default-github_token-permissions-to-read-only/ + contents: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.event.release.target_commitish }} + + - name: Update Changelog + uses: stefanzweifel/changelog-updater-action@v1 + with: + latest-version: ${{ github.event.release.tag_name }} + release-notes: ${{ github.event.release.body }} + + - name: Commit updated CHANGELOG + uses: stefanzweifel/git-auto-commit-action@v5 + with: + branch: ${{ github.event.release.target_commitish }} + commit_message: Update CHANGELOG + file_pattern: CHANGELOG.md \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..8f32fa1 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,7 @@ +# Changelog + +All notable changes to `payable` will be documented in this file + +## v0.0.0 - + +- Initial Tag