-
-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Objective:
Create CI (Continuous Integration) files for GitHub and GitLab that include the basic steps for running code quality and security checks in an Elixir project.
Basic Steps to Run:
mix format --dry-run --check-formatted: Check if the code is formatted according to the defined rules.mix deps.unlock --check-unused: Check for unused dependencies.mix deps.audit: Audit dependencies for known vulnerabilities.mix hex.audit: Audit Hex packages for vulnerabilities.mix sobelow: Run security checks on the code.mix credo: Run static analysis and check code for style compliance.mix doctor: Evaluate code documentation.mix test --cover: Run unit tests and generate a code coverage report.
Functional Requirements:
- Generate CI file for GitHub.
- Generate CI file for GitLab.
See Other Approaches:
- Generate CI file for BitBucket.
- Other CI file patterns.
Useful Resources and References
GitHub Actions:
- Official GitHub Actions Documentation: GitHub Actions Documentation
- Tutorial on GitHub Actions for Elixir: Elixir CI with GitHub Actions
GitLab CI/CD:
- Official GitLab CI/CD Documentation: GitLab CI/CD Documentation
- Setting Up GitLab CI/CD for Elixir Projects: Setting Up GitLab CI/CD for Elixir Projects
BitBucket Pipelines:
- Official BitBucket Pipelines Documentation: BitBucket Pipelines Documentation
- Example CI for Elixir on BitBucket: Example CI for Elixir on BitBucket
Other CI File Patterns:
- CircleCI for Elixir Projects: CircleCI Configuration for Elixir Projects
- Travis CI for Elixir Projects: Travis CI Configuration for Elixir Projects
CI File Examples
GitHub Actions (.github/workflows/ci.yml):
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Elixir
uses: actions/setup-elixir@v1
with:
otp-version: '23.0'
elixir-version: '1.11.2'
- name: Install dependencies
run: mix deps.get
- name: Run format check
run: mix format --dry-run --check-formatted
- name: Check unused dependencies
run: mix deps.unlock --check-unused
- name: Audit dependencies
run: mix deps.audit
- name: Audit Hex packages
run: mix hex.audit
- name: Run Sobelow security checks
run: mix sobelow
- name: Run Credo code analysis
run: mix credo
- name: Evaluate documentation
run: mix doctor
- name: Run tests with coverage
run: mix test --coverGitLab CI (.gitlab-ci.yml):
stages:
- check
- test
check:
stage: check
image: elixir:1.11.2
script:
- mix local.hex --force
- mix deps.get
- mix format --dry-run --check-formatted
- mix deps.unlock --check-unused
- mix deps.audit
- mix hex.audit
- mix sobelow
- mix credo
- mix doctor
test:
stage: test
image: elixir:1.11.2
script:
- mix local.hex --force
- mix deps.get
- mix test --coverThese examples provide a solid foundation for setting up continuous integration using GitHub Actions and GitLab CI/CD for Elixir projects. To adapt these files for BitBucket or other CI tools, consult the specific documentation and adjust accordingly.
Exadra37
Metadata
Metadata
Assignees
Labels
No labels