diff --git a/.credo.exs b/.credo.exs index 7cbf246..c8cec3f 100644 --- a/.credo.exs +++ b/.credo.exs @@ -23,7 +23,7 @@ # You can give explicit globs or simply directories. # In the latter case `**/*.{ex,exs}` will be used. # - included: ["lib/", "priv/", "test/"], + included: ["config/", "lib/", "priv/", "test/"], excluded: [~r"/_build/", ~r"/deps/", ~r"/node_modules/"] }, # @@ -119,7 +119,8 @@ [ order: ~w(moduledoc behaviour use import require alias module_attribute defstruct callback macrocallback optional_callback)a, - ignore: [:type] + ignore: [:type], + ignore_module_attributes: [:contract, :decorate, :operation, :trace] ]}, {Credo.Check.Readability.StringSigils, []}, {Credo.Check.Readability.TrailingBlankLine, []}, @@ -177,7 +178,17 @@ {Credo.Check.Warning.UnusedPathOperation, []}, {Credo.Check.Warning.UnusedRegexOperation, []}, {Credo.Check.Warning.UnusedStringOperation, []}, - {Credo.Check.Warning.UnusedTupleOperation, []} + {Credo.Check.Warning.UnusedTupleOperation, []}, + + # + ## Custom + # + {Credo.Check.Warning.ForbiddenModule, + [ + modules: [ + {Oban.Worker, "use Oban.Pro.Worker instead"} + ] + ]} ] } ] diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..7f00997 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,19 @@ +## Checklist + + + +- [ ] Code conforms to the [Elixir Styleguide](https://github.com/christopheradams/elixir_style_guide) + +## Problem + + + +## Details + + diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1031094..4b6885f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,120 +1,167 @@ +# This file is synced with stordco/common-config-elixir. Any changes will be overwritten. + name: CI on: + merge_group: pull_request: types: - opened - reopened - synchronize - merge_group: + push: + branches: + - main + - code-freeze/** workflow_call: secrets: + CI_SERVICE_KEY: + required: true GH_PERSONAL_ACCESS_TOKEN: required: true HEX_API_KEY: required: true workflow_dispatch: +concurrency: + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: true + jobs: Credo: + if: ${{ !startsWith(github.head_ref, 'release-please--branches') }} runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Elixir uses: stordco/actions-elixir/setup@v1 with: github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} hex-token: ${{ secrets.HEX_API_KEY }} + oban-fingerprint: ${{ secrets.OBAN_KEY_FINGERPRINT }} + oban-token: ${{ secrets.OBAN_LICENSE_KEY }} - name: Credo - run: mix credo + run: mix credo --strict - Deps: + Dependencies: + if: ${{ !startsWith(github.head_ref, 'release-please--branches') }} runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Elixir uses: stordco/actions-elixir/setup@v1 with: github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} hex-token: ${{ secrets.HEX_API_KEY }} + oban-fingerprint: ${{ secrets.OBAN_KEY_FINGERPRINT }} + oban-token: ${{ secrets.OBAN_LICENSE_KEY }} - name: Unused run: mix deps.unlock --check-unused Dialyzer: + if: ${{ !startsWith(github.head_ref, 'release-please--branches') }} runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Elixir uses: stordco/actions-elixir/setup@v1 with: github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} hex-token: ${{ secrets.HEX_API_KEY }} + oban-fingerprint: ${{ secrets.OBAN_KEY_FINGERPRINT }} + oban-token: ${{ secrets.OBAN_LICENSE_KEY }} - name: Dialyzer run: mix dialyzer --format github - Docs: + Documentation: + if: ${{ !startsWith(github.head_ref, 'release-please--branches') }} runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Elixir uses: stordco/actions-elixir/setup@v1 with: github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} hex-token: ${{ secrets.HEX_API_KEY }} + oban-fingerprint: ${{ secrets.OBAN_KEY_FINGERPRINT }} + oban-token: ${{ secrets.OBAN_LICENSE_KEY }} - name: Docs run: mix docs Format: + if: ${{ !startsWith(github.head_ref, 'release-please--branches') }} runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Elixir uses: stordco/actions-elixir/setup@v1 with: github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} hex-token: ${{ secrets.HEX_API_KEY }} + oban-fingerprint: ${{ secrets.OBAN_KEY_FINGERPRINT }} + oban-token: ${{ secrets.OBAN_LICENSE_KEY }} - name: Format run: mix format --check-formatted Test: + name: Test (Elixir ${{ matrix.versions.elixir }} OTP ${{ matrix.versions.otp }}) + runs-on: ubuntu-latest env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} MIX_ENV: test + steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Elixir uses: stordco/actions-elixir/setup@v1 with: + elixir-version: ${{ matrix.versions.elixir }} github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} hex-token: ${{ secrets.HEX_API_KEY }} + oban-fingerprint: ${{ secrets.OBAN_KEY_FINGERPRINT }} + oban-token: ${{ secrets.OBAN_LICENSE_KEY }} + otp-version: ${{ matrix.versions.otp }} - name: Compile run: mix compile --warnings-as-errors - name: Test - run: mix test + run: mix coveralls.github + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + strategy: + fail-fast: false + matrix: + versions: + - elixir: 1.13 + otp: 25 + - elixir: 1.14 + otp: 25 + - elixir: 1.15 + otp: 26 + diff --git a/.github/workflows/common-config-elixir.yaml b/.github/workflows/common-config-elixir.yaml index da7353c..68350fa 100644 --- a/.github/workflows/common-config-elixir.yaml +++ b/.github/workflows/common-config-elixir.yaml @@ -21,7 +21,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} persist-credentials: true @@ -29,14 +29,16 @@ jobs: - name: Setup Node uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 - name: Setup Elixir uses: stordco/actions-elixir/setup@v1 with: + elixir-version: "1.15" github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} hex-token: ${{ secrets.HEX_API_KEY }} - elixir-version: "1.15" + oban-fingerprint: ${{ secrets.OBAN_KEY_FINGERPRINT }} + oban-token: ${{ secrets.OBAN_LICENSE_KEY }} otp-version: "26.0" - name: Sync @@ -50,3 +52,4 @@ jobs: sync-auth: stord-engineering-account:${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} sync-branch: latest sync-repository: github.com/stordco/common-config-elixir.git + diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 0a92319..993200f 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -12,24 +12,22 @@ on: - synchronize jobs: - title: - if: github.event_name == 'pull_request' - name: Check Title + Title: + if: ${{ github.event_name == 'pull_request' }} + runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Check uses: stordco/actions-pr-title@v1.0.0 with: regex: '^(feat!|fix!|fix|feat|chore|(fix|feat|chore)\(\w.*\)):\s(\[\w{1,8}-\d{1,8}\]|.*).*' hint: | - You can pass the following formats: + Your PR title does not match the Stord common convention. Please rename your PR to match one of the following formats: - fix: [OR-123] some title of the PR - feat: [OR-1234] some title of the PR - chore: update some action + chore: a small insignificant change + fix: [JIRA-1234] fix an existing feature + feat: [JIRA-1234] a new feature to release + feat!: a breaking change - Note: Adding ! (i.e. `feat!:`) represents a breaking change and will result in a SemVer major. + Note: Adding ! (i.e. `feat!:`) represents a breaking change and will result in a SemVer major release. diff --git a/.github/workflows/publish.yaml b/.github/workflows/production.yaml similarity index 57% rename from .github/workflows/publish.yaml rename to .github/workflows/production.yaml index cc1df59..7397623 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/production.yaml @@ -1,10 +1,16 @@ ---- -name: Publish +# This file is synced with stordco/common-config-elixir. Any changes will be overwritten. + +name: Production on: release: types: - - published + - released + - prereleased + workflow_dispatch: + +concurrency: + group: Production jobs: Hex: @@ -12,13 +18,15 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Elixir uses: stordco/actions-elixir/setup@v1 with: github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} hex-token: ${{ secrets.HEX_API_KEY }} + oban-fingerprint: ${{ secrets.OBAN_KEY_FINGERPRINT }} + oban-token: ${{ secrets.OBAN_LICENSE_KEY }} - name: Compile run: mix compile --docs @@ -27,3 +35,4 @@ jobs: run: mix hex.publish --yes env: HEX_API_KEY: ${{ secrets.HEX_API_KEY }} + diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 0644819..27ebe73 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -7,6 +7,10 @@ on: branches: - main +concurrency: + group: release + cancel-in-progress: false + jobs: Please: runs-on: ubuntu-latest @@ -18,6 +22,8 @@ jobs: with: command: manifest config-file: .release-please-config.json + default-branch: main manifest-file: .release-please-manifest.json release-type: elixir token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} + diff --git a/.github/workflows/staging.yaml b/.github/workflows/staging.yaml new file mode 100644 index 0000000..dbe5a7a --- /dev/null +++ b/.github/workflows/staging.yaml @@ -0,0 +1,53 @@ +# This file is synced with stordco/common-config-elixir. Any changes will be overwritten. + +name: Staging + +on: + push: + branches: + - main + - code-freeze/** + workflow_dispatch: + +concurrency: + group: Staging + +jobs: + Documentation: + environment: + name: Documentation + url: https://logger-json.stord.engineering + + permissions: + contents: read + id-token: write + pages: write + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Elixir + uses: stordco/actions-elixir/setup@v1 + with: + github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} + hex-token: ${{ secrets.HEX_API_KEY }} + oban-fingerprint: ${{ secrets.OBAN_KEY_FINGERPRINT }} + oban-token: ${{ secrets.OBAN_LICENSE_KEY }} + + - name: Build + run: mix docs + + - name: Set CNAME + run: echo "logger-json.stord.engineering" > ./doc/CNAME + + - name: Upload Artifacts + uses: actions/upload-pages-artifact@v2 + with: + path: ./doc + + - name: Deploy + uses: actions/deploy-pages@v2 +