Skip to content

Commit

Permalink
ci: Conventional Commits (#8)
Browse files Browse the repository at this point in the history
* ci: add commitlint

* docs: update README.md
  • Loading branch information
kpetremann authored May 5, 2023
1 parent 03d0173 commit 816d54c
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 29 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CI

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Run tox
run: tox

commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install required dependencies
run: |
sudo apt install -y git curl
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo DEBIAN_FRONTEND=noninteractive apt install -y nodejs
- name: Install commitlint
run: |
npm install @commitlint/config-conventional
- name: Validate current commit (last commit) with commitlint
if: github.event_name == 'push'
run: npx commitlint --from HEAD~1 --to HEAD --verbose

- name: Validate PR commits with commitlint
if: github.event_name == 'pull_request'
run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
29 changes: 0 additions & 29 deletions .github/workflows/main.yml

This file was deleted.

2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

**unit and functionals tests** are mandatory.

Please use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/#summary).

Please ensure you have run the following before pushing a commit:
* `black` and `isort` (or `invoke reformat`)
* `tox` to run all linters
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# SONiC Saltstack modules

> This repository is part of [AFK](https://criteo.github.io/AFK).
The full documentation can be found here: [AFK documentation](https://criteo.github.io/AFK/SONiC-support/SONiC-modules/)

## Current supported versions

* 201911
Expand Down Expand Up @@ -33,3 +37,7 @@ sonic_commit_id: some-commit-id
```
This is automatically set by our [SONiC Salt Deployer](https://github.com/criteo/sonic-salt-deployer).
## How to contribute
see [CONTRIBUTING.md](CONTRIBUTING.md)
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {extends: ['@commitlint/config-conventional']}

0 comments on commit 816d54c

Please sign in to comment.