From c034b008ddc68921dcf335f05adc8aa970c13d1d Mon Sep 17 00:00:00 2001 From: MikaAK Date: Wed, 31 Jan 2024 18:32:26 -0800 Subject: [PATCH] chore: add github actions --- .github/workflows/ci.yaml | 88 ---------------------------------- .github/workflows/coverage.yml | 40 ++++++++++++++++ .github/workflows/credo.yml | 37 ++++++++++++++ .github/workflows/dialyzer.yml | 40 ++++++++++++++++ 4 files changed, 117 insertions(+), 88 deletions(-) delete mode 100644 .github/workflows/ci.yaml create mode 100644 .github/workflows/coverage.yml create mode 100644 .github/workflows/credo.yml create mode 100644 .github/workflows/dialyzer.yml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml deleted file mode 100644 index 59468ff..0000000 --- a/.github/workflows/ci.yaml +++ /dev/null @@ -1,88 +0,0 @@ -name: CI - -on: - push: - branches: - - main - pull_request: - -env: - MIX_ENV: test - -jobs: - test: - name: Static analysis and tests - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - uses: erlef/setup-beam@v1 - id: beam - with: - otp-version: '25.1.1' - elixir-version: '1.14.1' - - - name: Retrieve Cached Dependencies - uses: actions/cache@v3 - id: mix-deps-cache - env: - cache-name: cache-elixir-deps - with: - path: | - deps - _build - key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }} - restore-keys: | - ${{ runner.os }}-mix-${{ env.cache-name }}- - - - name: Retrieve Cached Build - id: mix-build-cache - uses: actions/cache@v3 - env: - cache-name: cache-compiled-build - with: - path: _build - key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }} - restore-keys: | - ${{ runner.os }}-mix-${{ env.cache-name }}- - ${{ runner.os }}-mix- - - - name: Install Dependencies - run: | - mix local.rebar --force - mix local.hex --force - mix deps.get - mix deps.compile - - - name: Catch compilation warnings - run: mix compile --warnings-as-errors - - - name: Check Formatting - run: mix format --check-formatted - - - name: Run Credo - run: mix credo --min-priority high - - - name: Restore PLT cache - uses: actions/cache@v3 - id: plt-cache - with: - key: | - ${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-plt - restore-keys: | - ${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-plt - path: | - priv/plts - - - name: Create PLTs - if: steps.plt-cache.outputs.cache-hit != 'true' - run: | - mkdir -p priv/plts - mix dialyzer --plt - - - name: Run dialyzer - run: mix dialyzer --format github - - - name: Run tests - run: mix test --warnings-as-errors \ No newline at end of file diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..b9ffe43 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,40 @@ +name: Coverage + +on: push + +jobs: + Coverage: + runs-on: ubuntu-latest + + env: + MIX_ENV: test + + steps: + - uses: actions/checkout@v2 + + - name: Set up Elixir + uses: erlef/setup-beam@v1 + with: + elixir-version: '1.16.1' # Define the elixir version [required] + otp-version: '26.2.1' # Define the OTP version [required] + + - name: Restore dependencies cache + uses: actions/cache@v3 + with: + path: | + _build + deps + key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}-${{ hashFiles('./.tool-versions') }} + restore-keys: ${{ runner.os }}-mix- + + - name: Install Dependencies + run: mix deps.get + + - name: Compile Project + run: mix compile + + - name: Run Coveralls + run: mix coveralls.json + + - name: Upload to codecov.io + uses: codecov/codecov-action@v1 diff --git a/.github/workflows/credo.yml b/.github/workflows/credo.yml new file mode 100644 index 0000000..68e3e65 --- /dev/null +++ b/.github/workflows/credo.yml @@ -0,0 +1,37 @@ +name: Credo + +on: push + +jobs: + Credo: + runs-on: ubuntu-latest + + env: + MIX_ENV: test + + steps: + - uses: actions/checkout@v2 + + - name: Set up Elixir + uses: erlef/setup-beam@v1 + with: + elixir-version: '1.16.1' # Define the elixir version [required] + otp-version: '26.2.1' # Define the OTP version [required] + + - name: Restore dependencies cache + uses: actions/cache@v3 + with: + path: | + _build + deps + key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}-${{ hashFiles('./.tool-versions') }} + restore-keys: ${{ runner.os }}-mix- + + - name: Install Dependencies + run: mix deps.get + + - name: Compile Project + run: mix compile + + - name: Run Credo + run: mix credo diff --git a/.github/workflows/dialyzer.yml b/.github/workflows/dialyzer.yml new file mode 100644 index 0000000..4a8b9fe --- /dev/null +++ b/.github/workflows/dialyzer.yml @@ -0,0 +1,40 @@ +name: Dialyzer + +on: push + +jobs: + Dialyzer: + runs-on: ubuntu-latest + + env: + MIX_ENV: test + + steps: + - uses: actions/checkout@v2 + + - name: Set up Elixir + uses: erlef/setup-beam@v1 + with: + elixir-version: '1.16.1' # Define the elixir version [required] + otp-version: '26.2.1' # Define the OTP version [required] + + - name: Restore dependencies cache + uses: actions/cache@v3 + with: + path: | + _build + deps + dialyzer + key: ${{ runner.os }}-dialyzer-${{ hashFiles('**/mix.lock') }}-${{ hashFiles('./.tool-versions') }} + restore-keys: ${{ runner.os }}-dialyzer- + + - name: Install Dependencies + run: mix deps.get + + - name: Compile Project + run: mix compile + + - name: Run Dialyzer + run: mkdir -p dialyzer && mix dialyzer + +