From 161d84e98983d6ffc84009e00380ab4aa597ef04 Mon Sep 17 00:00:00 2001 From: Devin Baca Date: Mon, 13 Jul 2026 22:23:03 -0700 Subject: [PATCH] Migrate CI from CircleCI to GitHub Actions Public repo can't use the private smartrent/github-actions reusable workflows, so this uses erlef/setup-beam and actions/cache directly, mirroring the existing CircleCI Elixir/OTP matrix. --- .circleci/config.yml | 56 --------------------------- .github/workflows/ci.yaml | 80 +++++++++++++++++++++++++++++++++++++++ README.md | 2 +- 3 files changed, 81 insertions(+), 57 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/ci.yaml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index d4895f0..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,56 +0,0 @@ -version: 2.1 - -latest: &latest - pattern: "^1.16.*-erlang-26.*$" - -jobs: - build-test: - parameters: - tag: - type: string - docker: - - image: hexpm/elixir:<< parameters.tag >> - working_directory: ~/repo - environment: - LC_ALL: C.UTF-8 - steps: - - checkout - - run: - name: Install hex and rebar - command: | - mix local.hex --force - mix local.rebar --force - - restore_cache: - keys: - - v1-mix-cache-<< parameters.tag >>-{{ checksum "mix.lock" }} - - run: mix deps.get - - run: mix test - - when: - condition: - matches: { <<: *latest, value: << parameters.tag >> } - steps: - - run: mix format --check-formatted - - run: mix deps.unlock --check-unused - - run: mix compile --warnings-as-errors - - run: mix docs - - run: mix hex.build - - run: mix credo -a --strict - - run: mix dialyzer - - save_cache: - key: v1-mix-cache-<< parameters.tag >>-{{ checksum "mix.lock" }} - paths: - - _build - - deps - -workflows: - checks: - jobs: - - build-test: - name: << matrix.tag >> - matrix: - parameters: - tag: [ - 1.16.2-erlang-26.2.4-alpine-3.19.1, - 1.15.7-erlang-26.1.2-alpine-3.18.4, - 1.14.5-erlang-25.3.2-alpine-3.17.3 - ] diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..409b6d2 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,80 @@ +name: Elixir CI + +on: + push: + branches: + - main + - hotfix/[0-9]+.[0-9]+.[0-9]+ + - release/[0-9]+.[0-9]+.[0-9]+ + tags: + - "*" + pull_request: + types: [synchronize, opened, reopened] + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + name: test (${{ matrix.elixir }}-erlang-${{ matrix.erlang }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - elixir: "1.16.2" + erlang: "26.2.4" + latest: true + - elixir: "1.15.7" + erlang: "26.1.2" + latest: false + - elixir: "1.14.5" + erlang: "25.3.2" + latest: false + + steps: + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + + - uses: erlef/setup-beam@fc68ffb90438ef2936bbb3251622353b3dcb2f93 # v1.24.0 + with: + elixir-version: ${{ matrix.elixir }} + otp-version: ${{ matrix.erlang }} + + - name: Restore deps/build cache + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + with: + path: | + deps + _build + key: ${{ runner.os }}-mix-${{ matrix.elixir }}-${{ matrix.erlang }}-${{ hashFiles('mix.lock') }} + restore-keys: | + ${{ runner.os }}-mix-${{ matrix.elixir }}-${{ matrix.erlang }}- + + - run: mix deps.get + + - run: mix test + + - name: Quality checks (latest only) + if: matrix.latest + run: | + mix format --check-formatted + mix deps.unlock --check-unused + mix compile --warnings-as-errors + mix credo -a --strict + mix dialyzer + env: + MIX_ENV: test + + - name: Docs + hex build (latest only) + if: matrix.latest + run: | + mix deps.get + mix docs + mix hex.build + env: + MIX_ENV: docs diff --git a/README.md b/README.md index 6bb6c47..a06d35e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # CredoBinaryPatterns -[![CircleCI](https://circleci.com/gh/smartrent/credo_binary_patterns.svg?style=svg)](https://circleci.com/gh/smartrent/credo_binary_patterns) +[![Elixir CI](https://github.com/smartrent/credo_binary_patterns/actions/workflows/ci.yaml/badge.svg)](https://github.com/smartrent/credo_binary_patterns/actions/workflows/ci.yaml) [![Hex version](https://img.shields.io/hexpm/v/credo_binary_patterns.svg "Hex version")](https://hex.pm/packages/credo_binary_patterns) The `:credo_binary_patterns` library contains Credo checks for