From 720cd04af4fbe91b084e2361aa50abdc1aaa333c Mon Sep 17 00:00:00 2001 From: Pavlo Golub Date: Wed, 22 May 2024 13:31:30 +0200 Subject: [PATCH] [+] add GitHub integration --- .github/ISSUE_TEMPLATE/bug_report.md | 38 ++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 +++++++ .github/dependabot.yml | 16 +++++ .github/workflows/build.yml | 41 +++++++++++++ .github/workflows/codeql-analysis.yml | 72 +++++++++++++++++++++++ .github/workflows/stale.yml | 26 ++++++++ README.md | 4 ++ 7 files changed, 217 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/codeql-analysis.yml create mode 100644 .github/workflows/stale.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..dd84ea7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,38 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Smartphone (please complete the following information):** + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..bbcbbe7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..07775ff --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,16 @@ +version: 2 +updates: + + # Maintain dependencies for Go modules + - package-ecosystem: gomod + directory: "/" + schedule: + interval: daily + time: "04:00" + open-pull-requests-limit: 10 + + # Maintain dependencies for GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..dafc737 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,41 @@ +name: Build & Test +on: + push: + branches: + - master + pull_request: + workflow_dispatch: + +jobs: + + build-and-test: + if: true # false to skip job during debug + name: Test and Build on Ubuntu + runs-on: ubuntu-latest + steps: + + - name: Check out code + uses: actions/checkout@v4 + + - name: Set up Golang + uses: actions/setup-go@v5 + with: + go-version: '1.22' + + - name: Get dependencies + run: | + go mod download + go version + + - name: GolangCI-Lint + uses: golangci/golangci-lint-action@v6 + with: + version: latest + + - name: Test + run: go test -v -coverprofile=profile.cov + + - name: Coveralls + uses: shogo82148/actions-goveralls@v1 + with: + path-to-profile: profile.cov diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..3d89d7d --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,72 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ "master" ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "master" ] + schedule: + - cron: '30 20 * * 2' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'go' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v3 + + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000..2959886 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,26 @@ +name: Close Stale Issues and PRs + +on: + schedule: + - cron: '0 0 * * *' + + workflow_dispatch: + + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v9 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-label: 'stale' + stale-pr-label: 'stale' + stale-issue-message: | + 📅 This issue has been automatically marked as stale because lack of recent activity. It will be closed if no further activity occurs. + â™ģī¸ If you think there is new information allowing us to address the issue, please reopen it and provide us with updated details. + 🤝 Thank you for your contributions. + stale-pr-message: | + 📅 This PR has been automatically marked as stale because lack of recent activity. It will be closed if no further activity occurs. + â™ģī¸ If you think there is new information allowing us to address this PR, please reopen it and provide us with updated details. + 🤝 Thank you for your contributions. diff --git a/README.md b/README.md index 92837a1..b5c1fce 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +[![Go Reference](https://pkg.go.dev/badge/github.com/cybertec-postgresql/pgx-migrator.svg)](https://pkg.go.dev/github.com/cybertec-postgresql/pgx-migrator) +[![Go Report Card](https://goreportcard.com/badge/github.com/cybertec-postgresql/pgx-migrator)](https://goreportcard.com/report/github.com/cybertec-postgresql/pgx-migrator) +[![Coverage Status](https://coveralls.io/repos/github/cybertec-postgresql/pgx-migrator/badge.svg?branch=main)](https://coveralls.io/github/cybertec-postgresql/pgx-migrator?branch=main) + # pgx-migrator Simple [pgx](https://github.com/jackc/pgx) oriented [PostgreSQL](https://www.postgresql.org/) schema migration library for Go based on [lopezator/migrator](https://github.com/lopezator/migrator).