Skip to content

Commit

Permalink
Edit workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
mbashia committed Dec 1, 2024
1 parent e357457 commit 2930162
Show file tree
Hide file tree
Showing 2 changed files with 207 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/github_workflows.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ defmodule GithubWorkflows do

def get do
%{
"main.yml" => main_workflow(),
"master.yml" => master_workflow(),
"pr.yml" => pr_workflow()
}
end

defp main_workflow do
defp master_workflow do
[
[
name: "Main",
name: "master",
on: [
push: [
branches: ["main"]
branches: ["master"]
]
],
jobs: elixir_ci_jobs()
Expand Down
203 changes: 203 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
name: master

on:
push:
branches:
- master

jobs:
compile:
name: Install deps and compile
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- id: setup-beam
name: Set up Elixir
uses: erlef/setup-beam@v1
with:
version-file: .tool-versions
version-type: strict
- uses: actions/cache@v3
with:
path: |
_build
deps
key: ${{ runner.os }}-${{ steps.setup-beam.outputs.elixir-version }}-${{ steps.setup-beam.outputs.otp-version }}-mix-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ steps.setup-beam.outputs.elixir-version }}-${{ steps.setup-beam.outputs.otp-version }}-mix-
- name: Install Elixir dependencies
env:
MIX_ENV: test
run: mix deps.get
- name: Compile
env:
MIX_ENV: test
run: mix compile --warnings-as-errors
credo:
needs: compile
name: Credo
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- id: setup-beam
name: Set up Elixir
uses: erlef/setup-beam@v1
with:
version-file: .tool-versions
version-type: strict
- uses: actions/cache@v3
with:
path: |
_build
deps
key: ${{ runner.os }}-${{ steps.setup-beam.outputs.elixir-version }}-${{ steps.setup-beam.outputs.otp-version }}-mix-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ steps.setup-beam.outputs.elixir-version }}-${{ steps.setup-beam.outputs.otp-version }}-mix-
- name: Check code style
env:
MIX_ENV: test
run: mix credo --strict
deps_audit:
needs: compile
name: Deps audit
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- id: setup-beam
name: Set up Elixir
uses: erlef/setup-beam@v1
with:
version-file: .tool-versions
version-type: strict
- uses: actions/cache@v3
with:
path: |
_build
deps
key: ${{ runner.os }}-${{ steps.setup-beam.outputs.elixir-version }}-${{ steps.setup-beam.outputs.otp-version }}-mix-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ steps.setup-beam.outputs.elixir-version }}-${{ steps.setup-beam.outputs.otp-version }}-mix-
- name: Check for vulnerable Mix dependencies
env:
MIX_ENV: test
run: mix deps.audit
format:
needs: compile
name: Format
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- id: setup-beam
name: Set up Elixir
uses: erlef/setup-beam@v1
with:
version-file: .tool-versions
version-type: strict
- uses: actions/cache@v3
with:
path: |
_build
deps
key: ${{ runner.os }}-${{ steps.setup-beam.outputs.elixir-version }}-${{ steps.setup-beam.outputs.otp-version }}-mix-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ steps.setup-beam.outputs.elixir-version }}-${{ steps.setup-beam.outputs.otp-version }}-mix-
- name: Check Elixir formatting
env:
MIX_ENV: test
run: mix format --check-formatted
hex_audit:
needs: compile
name: Hex audit
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- id: setup-beam
name: Set up Elixir
uses: erlef/setup-beam@v1
with:
version-file: .tool-versions
version-type: strict
- uses: actions/cache@v3
with:
path: |
_build
deps
key: ${{ runner.os }}-${{ steps.setup-beam.outputs.elixir-version }}-${{ steps.setup-beam.outputs.otp-version }}-mix-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ steps.setup-beam.outputs.elixir-version }}-${{ steps.setup-beam.outputs.otp-version }}-mix-
- name: Check for retired Hex packages
env:
MIX_ENV: test
run: mix hex.audit
prettier:
name: Check formatting using Prettier
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Restore npm cache
uses: actions/cache@v3
id: npm-cache
with:
path: node_modules
key: ${{ runner.os }}-prettier
- name: Install Prettier
if: steps.npm-cache.outputs.cache-hit != 'true'
run: npm i -D prettier prettier-plugin-toml
- name: Run Prettier
run: npx prettier -c .
sobelow:
needs: compile
name: Security check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- id: setup-beam
name: Set up Elixir
uses: erlef/setup-beam@v1
with:
version-file: .tool-versions
version-type: strict
- uses: actions/cache@v3
with:
path: |
_build
deps
key: ${{ runner.os }}-${{ steps.setup-beam.outputs.elixir-version }}-${{ steps.setup-beam.outputs.otp-version }}-mix-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ steps.setup-beam.outputs.elixir-version }}-${{ steps.setup-beam.outputs.otp-version }}-mix-
- name: Check for security issues using sobelow
env:
MIX_ENV: test
run: mix sobelow --config .sobelow-conf
unused_deps:
needs: compile
name: Check unused deps
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- id: setup-beam
name: Set up Elixir
uses: erlef/setup-beam@v1
with:
version-file: .tool-versions
version-type: strict
- uses: actions/cache@v3
with:
path: |
_build
deps
key: ${{ runner.os }}-${{ steps.setup-beam.outputs.elixir-version }}-${{ steps.setup-beam.outputs.otp-version }}-mix-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ steps.setup-beam.outputs.elixir-version }}-${{ steps.setup-beam.outputs.otp-version }}-mix-
- name: Check for unused Mix dependencies
env:
MIX_ENV: test
run: mix deps.unlock --check-unused

0 comments on commit 2930162

Please sign in to comment.