From 5565bfbeaf825e33c152261cb04f5e1d0a191ca1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 23 Jan 2024 17:13:33 +0000 Subject: [PATCH 1/2] chore: sync files with stordco/common-config-elixir --- .credo.exs | 20 ++- .formatter.exs | 8 +- .github/workflows/ci.yaml | 153 ++++++++++++++++++++ .github/workflows/ci.yml | 127 ---------------- .github/workflows/common-config-elixir.yaml | 5 +- .github/workflows/pr.yaml | 34 +++++ .github/workflows/pr.yml | 26 ---- .github/workflows/production.yaml | 15 ++ .github/workflows/release.yaml | 29 ++++ .github/workflows/release.yml | 19 --- .github/workflows/staging.yaml | 53 +++++++ .release-please-config.json | 6 + 12 files changed, 318 insertions(+), 177 deletions(-) create mode 100644 .github/workflows/ci.yaml delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/pr.yaml delete mode 100644 .github/workflows/pr.yml create mode 100644 .github/workflows/production.yaml create mode 100644 .github/workflows/release.yaml delete mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/staging.yaml diff --git a/.credo.exs b/.credo.exs index 3402260..c8cec3f 100644 --- a/.credo.exs +++ b/.credo.exs @@ -24,7 +24,7 @@ # In the latter case `**/*.{ex,exs}` will be used. # included: ["config/", "lib/", "priv/", "test/"], - excluded: [~r"/_build/", ~r"/deps/"] + excluded: [~r"/_build/", ~r"/deps/", ~r"/node_modules/"] }, # # Load and configure plugins here: @@ -58,6 +58,11 @@ # {Credo.Check.Design.DuplicatedCode, false} # checks: [ + # + ## Database Migration Checks + # + {ExcellentMigrations.CredoCheck.MigrationsSafety, []}, + # ## Consistency Checks # @@ -114,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, []}, @@ -173,6 +179,16 @@ {Credo.Check.Warning.UnusedRegexOperation, []}, {Credo.Check.Warning.UnusedStringOperation, []}, {Credo.Check.Warning.UnusedTupleOperation, []}, + + # + ## Custom + # + {Credo.Check.Warning.ForbiddenModule, + [ + modules: [ + {Oban.Worker, "use Oban.Pro.Worker instead"} + ] + ]} ] } ] diff --git a/.formatter.exs b/.formatter.exs index bb09258..859b362 100644 --- a/.formatter.exs +++ b/.formatter.exs @@ -1,4 +1,8 @@ +# This file is synced with stordco/common-config-elixir. Any changes will be overwritten. + [ - inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"], - line_length: 120 + import_deps: [], + inputs: ["*.{heex,ex,exs}", "{config,lib,priv,test}/**/*.{heex,ex,exs}"], + line_length: 120, + plugins: [] ] diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..ee5dd9d --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,153 @@ +# 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 + 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@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 --strict + + Dependencies: + if: ${{ !startsWith(github.head_ref, 'release-please--branches') }} + 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: 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@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 + + Documentation: + if: ${{ !startsWith(github.head_ref, 'release-please--branches') }} + 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: Docs + run: mix docs + + Format: + if: ${{ !startsWith(github.head_ref, 'release-please--branches') }} + 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: Format + run: mix format --check-formatted + + Test: + if: ${{ !startsWith(github.head_ref, 'release-please--branches') }} + runs-on: ubuntu-latest + + env: + MIX_ENV: test + + + 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: Compile + run: mix compile --warnings-as-errors + + - name: Test + run: mix coveralls.github + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 53641b5..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,127 +0,0 @@ ---- -name: CI - -on: - pull_request: - types: - - opened - - reopened - - synchronize - push: - branches: - - main - merge_group: - -env: - CACHE_VERSION: v1 - MIX_ENV: test - -concurrency: - group: ${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - Credo: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - id: beam - uses: erlef/setup-beam@v1 - with: - version-file: .tool-versions - version-type: strict - - id: cache - uses: actions/cache@v3 - with: - key: | - ${{ env.CACHE_VERSION }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-credo-${{ hashFiles('mix.lock') }}-${{ github.ref }} - restore-keys: | - ${{ env.CACHE_VERSION }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-credo-${{ hashFiles('mix.lock') }}-${{ format('refs/heads/{0}', github.event.repository.default_branch) }} - ${{ env.CACHE_VERSION }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-credo- - ${{ env.CACHE_VERSION }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}- - path: | - _build - deps - - if: steps.cache.outputs.cache-hit != 'true' - run: mix deps.get - - run: mix credo - - Dialyzer: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - id: beam - uses: erlef/setup-beam@v1 - with: - version-file: .tool-versions - version-type: strict - - id: cache - uses: actions/cache@v3 - with: - key: | - ${{ env.CACHE_VERSION }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-dialyzer-${{ hashFiles('mix.lock') }}-${{ github.ref }} - restore-keys: | - ${{ env.CACHE_VERSION }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-dialyzer-${{ hashFiles('mix.lock') }}-${{ format('refs/heads/{0}', github.event.repository.default_branch) }} - ${{ env.CACHE_VERSION }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-dialyzer- - ${{ env.CACHE_VERSION }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}- - path: | - _build - deps - - if: steps.cache.outputs.cache-hit != 'true' - run: mix deps.get - - run: mix dialyzer - - Format: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - id: beam - uses: erlef/setup-beam@v1 - with: - version-file: .tool-versions - version-type: strict - - id: cache - uses: actions/cache@v3 - with: - key: | - ${{ env.CACHE_VERSION }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-format-${{ hashFiles('mix.lock') }}-${{ github.ref }} - restore-keys: | - ${{ env.CACHE_VERSION }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-format-${{ hashFiles('mix.lock') }}-${{ format('refs/heads/{0}', github.event.repository.default_branch) }} - ${{ env.CACHE_VERSION }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-format- - ${{ env.CACHE_VERSION }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}- - path: | - _build - deps - - if: steps.cache.outputs.cache-hit != 'true' - run: mix deps.get - - run: mix format --check-formatted - - Test: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - id: beam - uses: erlef/setup-beam@v1 - with: - version-file: .tool-versions - version-type: strict - - id: cache - uses: actions/cache@v3 - with: - key: | - ${{ env.CACHE_VERSION }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-test-${{ hashFiles('mix.lock') }}-${{ github.ref }} - restore-keys: | - ${{ env.CACHE_VERSION }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-test-${{ hashFiles('mix.lock') }}-${{ format('refs/heads/{0}', github.event.repository.default_branch) }} - ${{ env.CACHE_VERSION }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-test- - ${{ env.CACHE_VERSION }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}- - path: | - _build - deps - - if: steps.cache.outputs.cache-hit != 'true' - run: mix deps.get - - run: mix compile --warnings-as-errors - - run: mix test diff --git a/.github/workflows/common-config-elixir.yaml b/.github/workflows/common-config-elixir.yaml index c38376c..68350fa 100644 --- a/.github/workflows/common-config-elixir.yaml +++ b/.github/workflows/common-config-elixir.yaml @@ -34,9 +34,11 @@ jobs: - 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 new file mode 100644 index 0000000..e7d0a85 --- /dev/null +++ b/.github/workflows/pr.yaml @@ -0,0 +1,34 @@ +# This file is synced with stordco/common-config-elixir. Any changes will be overwritten. + +name: PR + +on: + merge_group: + pull_request: + types: + - edited + - opened + - reopened + - synchronize + +jobs: + Title: + if: ${{ github.event_name == 'pull_request' }} + + runs-on: ubuntu-latest + + steps: + - 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: | + Your PR title does not match the Stord common convention. Please rename your PR to match one of the following formats: + + 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 release. + diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml deleted file mode 100644 index b8f6c39..0000000 --- a/.github/workflows/pr.yml +++ /dev/null @@ -1,26 +0,0 @@ ---- -name: PR - -on: - pull_request_target: - types: - - edited - - opened - - reopened - - synchronize - -jobs: - title: - name: Check Title - runs-on: ubuntu-latest - - steps: - - name: Check - uses: amannn/action-semantic-pull-request@v5 - env: - GITHUB_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} - with: - types: | - fix - feat - chore diff --git a/.github/workflows/production.yaml b/.github/workflows/production.yaml new file mode 100644 index 0000000..fd0741b --- /dev/null +++ b/.github/workflows/production.yaml @@ -0,0 +1,15 @@ +# This file is synced with stordco/common-config-elixir. Any changes will be overwritten. + +name: Production + +on: + release: + types: + - released + - prereleased + workflow_dispatch: + +concurrency: + group: Production + +jobs: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..27ebe73 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,29 @@ +# This file is synced with stordco/common-config-elixir. Any changes will be overwritten. + +name: Release + +on: + push: + branches: + - main + +concurrency: + group: release + cancel-in-progress: false + +jobs: + Please: + runs-on: ubuntu-latest + + steps: + - id: release + name: Release + uses: google-github-actions/release-please-action@v3 + 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/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 9c25357..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -name: Release - -on: - push: - branches: - - main - -jobs: - Please: - runs-on: ubuntu-latest - - steps: - - name: Release Please - uses: google-github-actions/release-please-action@v3 - with: - release-type: elixir - token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} - extra-files: README.md diff --git a/.github/workflows/staging.yaml b/.github/workflows/staging.yaml new file mode 100644 index 0000000..10f8447 --- /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://lunar.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 "lunar.stord.engineering" > ./doc/CNAME + + - name: Upload Artifacts + uses: actions/upload-pages-artifact@v2 + with: + path: ./doc + + - name: Deploy + uses: actions/deploy-pages@v2 + diff --git a/.release-please-config.json b/.release-please-config.json index 6240550..c90be46 100644 --- a/.release-please-config.json +++ b/.release-please-config.json @@ -1,4 +1,6 @@ { + "$comment": "This file is synced with stordco/common-config-elixir. Any changes will be overwritten.", + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", "changelog-sections": [ { "type": "feat", @@ -16,6 +18,8 @@ "hidden": false } ], + "draft": false, + "draft-pull-request": false, "packages": { ".": { "extra-files": [ @@ -30,4 +34,6 @@ } ], "prerelease": false, + "pull-request-header": "An automated release has been created for you.", + "separate-pull-requests": true } From 0c118f8ddf631c1c17874d4b61039eeb34f6fa7b Mon Sep 17 00:00:00 2001 From: Sean Callan Date: Tue, 23 Jan 2024 12:19:39 -0500 Subject: [PATCH 2/2] chore: Add excoveralls --- mix.exs | 3 ++- mix.lock | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/mix.exs b/mix.exs index 0a624d1..a337bea 100644 --- a/mix.exs +++ b/mix.exs @@ -31,7 +31,8 @@ defmodule Lunar.MixProject do # Dev & Test dependencies {:credo, "~> 1.6", only: [:dev, :test], runtime: false}, {:dialyxir, "~> 1.1", only: [:dev, :test], runtime: false}, - {:ex_doc, "~> 0.28", only: [:dev, :test], runtime: false} + {:ex_doc, "~> 0.28", only: [:dev, :test], runtime: false}, + {:excoveralls, "~> 0.17.1", only: :test} ] end end diff --git a/mix.lock b/mix.lock index af167ae..809cf91 100644 --- a/mix.lock +++ b/mix.lock @@ -5,6 +5,7 @@ "earmark_parser": {:hex, :earmark_parser, "1.4.39", "424642f8335b05bb9eb611aa1564c148a8ee35c9c8a8bba6e129d51a3e3c6769", [:mix], [], "hexpm", "06553a88d1f1846da9ef066b87b57c6f605552cfbe40d20bd8d59cc6bde41944"}, "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, "ex_doc": {:hex, :ex_doc, "0.31.0", "06eb1dfd787445d9cab9a45088405593dd3bb7fe99e097eaa71f37ba80c7a676", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.1", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "5350cafa6b7f77bdd107aa2199fe277acf29d739aba5aee7e865fc680c62a110"}, + "excoveralls": {:hex, :excoveralls, "0.17.1", "83fa7906ef23aa7fc8ad7ee469c357a63b1b3d55dd701ff5b9ce1f72442b2874", [:mix], [{:castore, "~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "95bc6fda953e84c60f14da4a198880336205464e75383ec0f570180567985ae0"}, "file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"}, "jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"}, "luerl": {:hex, :luerl, "1.1.1", "083518e437586f6631150d39c4bff242ed2ec80cb14a3299a0c2628f07a2ff7f", [:rebar3], [], "hexpm", "e17ef246a7ff876ec90e68792a39708979416004d4eacfe8a7643206b9470773"},