Skip to content

Commit

Permalink
feat: add compilation warnings job
Browse files Browse the repository at this point in the history
  • Loading branch information
yordis committed May 7, 2022
1 parent e5c9b03 commit 2e69547
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/elixir-quality-assurance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,25 @@ on:
type: boolean
required: false
default: true
compilation-warning-enabled:
description: Enables the compilation warning checks job
type: boolean
required: false
default: true

jobs:
compilation-warning:
name: Compilation Warnings
if: ${{ inputs.compilation-warning-enabled }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: straw-hat-team/github-actions-workflows/elixir/[email protected]
with:
elixir-version: ${{ inputs.elixir-version }}
otp-version: ${{ inputs.otp-version }}

test:
name: Test
if: ${{ inputs.testing-enabled }}
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ A set of GitHub Actions Workflow Templates.

#### Elixir-Lang

- [elixir/compilation-warnings](./elixir/compilation-warnings/README.md): compiles the code treating warnings as errors.
- [elixir/credo](./elixir/credo/README.md): runs Credo linter.
- [elixir/dialyzer](./elixir/dialyzer/README.md): runs Dialyzer typespec check.
- [elixir/format](./elixir/format/README.md): runs formatter.
Expand Down
27 changes: 27 additions & 0 deletions elixir/compilation-warnings/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Elixir Compilation Warnings

Compiles the code treating warnings as errors.

- [How-to Guides](#how-to-guides)

## How-to Guides

### Get Started

1. Make sure `actions/checkout` action is used before this action.
2. Add this action to your job in your workflow, here is an example:

```yaml
#...
jobs:
tests:
name: Compilation Warnings
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2 # checkout the repository first
- uses: straw-hat-team/github-actions-workflows/elixir/compilation-warnings@master
with:
elixir-version: '1.11' # optional, fallback to use .tool-versions
otp-version: '22.3' # optional, fallback to use .tool-versions
```
24 changes: 24 additions & 0 deletions elixir/compilation-warnings/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Elixir Compilation Warnings
description: Checks for compilation warnings
author: Straw Hat Team

inputs:
elixir-version:
description: The Elixir version. It fallback to .tool-versions if not specified
required: false
otp-version:
description: The Erlang version. It fallback to .tool-versions if not specified
required: false

runs:
using: composite
steps:
- name: Setup Elixir
uses: straw-hat-team/github-actions-workflows/elixir/[email protected]
with:
elixir-version: ${{ inputs.elixir-version }}
otp-version: ${{ inputs.otp-version }}

- name: Run compilation
shell: sh
run: mix compile --warnings-as-errors --force

0 comments on commit 2e69547

Please sign in to comment.