-
Notifications
You must be signed in to change notification settings - Fork 64
Add GHA CI #158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Add GHA CI #158
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c69c456
Add GHA CI
TylerWitt f1f38cb
Update ci.yml
TylerWitt aab4231
Fix doc redefinition
TylerWitt 9a1cf1f
Fix formatting
TylerWitt 96ce2dc
Update CHANGELOG.md
TylerWitt 863531d
Update producer.ex
TylerWitt 5bae98e
Fix missing backtick
TylerWitt 2dce27c
Update mix.exs
TylerWitt d1f90ab
Cache CI using matrix args
TylerWitt 18f72a4
fixup
TylerWitt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| name: Linting & Tests | ||
|
|
||
| # Define workflow that runs when changes are pushed to the | ||
| # `master` branch or pushed to a PR branch that targets the `master` | ||
| # branch. | ||
| on: | ||
| push: | ||
| branches: [ "master" ] | ||
| pull_request: | ||
| branches: [ "master" ] | ||
|
|
||
| # Sets the ENV `MIX_ENV` to `test` for running tests | ||
| env: | ||
| MIX_ENV: test | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-22.04 | ||
| name: Test on OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}} | ||
| strategy: | ||
| # Specify the OTP and Elixir versions to use when building | ||
| # and running the workflow steps. | ||
| matrix: | ||
| otp: ['25.0.4', '27.2'] # Define the OTP version [required] | ||
| elixir: ['1.14.1', '1.18.4'] # Define the elixir version [required] | ||
| exclude: | ||
| - otp: '27.2' | ||
| elixir: '1.14.1' | ||
| steps: | ||
| # Step: Setup Elixir + Erlang image as the base. | ||
| - name: Set up Elixir | ||
| uses: erlef/setup-beam@v1 | ||
| with: | ||
| otp-version: ${{matrix.otp}} | ||
| elixir-version: ${{matrix.elixir}} | ||
|
|
||
| # Step: Check out the code. | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| # Step: Define how to cache deps. Restores existing cache if present. | ||
| - name: Cache deps | ||
| id: cache-deps | ||
| uses: actions/cache@v4 | ||
| env: | ||
| cache-name: cache-elixir-deps | ||
| with: | ||
| path: deps | ||
| key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ env.cache-name }} | ||
|
|
||
| # Step: Define how to cache the `_build` directory. After the first run, | ||
| # this speeds up test runs. This includes not re-compiling our deps every run. | ||
| - name: Cache compiled build | ||
| id: cache-build | ||
| uses: actions/cache@v4 | ||
| env: | ||
| cache-name: cache-compiled-build | ||
| with: | ||
| path: _build | ||
| key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ env.cache-name }}- | ||
| ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix- | ||
|
|
||
| # Step: Conditionally bust the cache when job is re-run. | ||
| # Sometimes, we may have issues with incremental builds that are fixed by | ||
| # doing a full recompile. In order to not waste dev time on such trivial | ||
| # issues (while also reaping the time savings of incremental builds for | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment is helpful as heck! |
||
| # *most* day-to-day development), force a full recompile only on builds | ||
| # that are retried. | ||
| - name: Clean to rule out incremental build as a source of flakiness | ||
| if: github.run_attempt != '1' | ||
| run: | | ||
| mix deps.clean --all | ||
| mix clean | ||
| shell: sh | ||
|
|
||
| # Step: Download project dependencies. If unchanged, uses | ||
| # the cached version. | ||
| - name: Install dependencies | ||
| run: mix deps.get | ||
|
|
||
| # Step: Compile the project treating any warnings as errors. | ||
| # Customize this step if a different behavior is desired. | ||
| - name: Compiles without warnings | ||
| run: mix compile --warnings-as-errors | ||
|
|
||
| # Step: Check that the checked in code has already been formatted. | ||
| # This step fails if something was found unformatted. | ||
| # Customize this step as desired. | ||
| - name: Check Formatting | ||
| run: mix format --check-formatted | ||
|
|
||
| # Step: Execute the tests. | ||
| - name: Run tests | ||
| run: mix test | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.