Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add actionlint and update docs #502

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 36 additions & 15 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Before you begin, you will need to set up your local development environment. He

- [Pre-commit](https://pre-commit.com) — Automates the running of git pre-commit hooks.
- Installation: `brew install pre-commit` and `make hooks`
- [Cz-git](https://cz-git.qbb.sh) —Commitizen adapter, that assists in formatting git commits.
- [Cz-git](https://cz-git.qbb.sh) — Commitizen adapter, that assists in formatting git commits.
- Installation: `brew install czg`

<br>
Expand Down Expand Up @@ -58,6 +58,10 @@ Refer to the output of `make help` for a comprehensive list of available command
- **Fork the Repository**: Start by forking the repository to your GitHub account.
- **Create a Branch**: In your fork, create a new branch for your work. Name it appropriately based on the feature, fix, or update you're working on.
- **Make Your Changes**: Implement your changes, commit them, and push the branch to your fork.
- **Run Tests**: Ensure all tests pass and the code adheres to the coding standards.
- **Update Documentation**: If you've made changes that affect the project's documentation, ensure it is updated.
- **Run Linters**: Ensure your code passes all linting checks using `make lint`.
- **Commit Your Changes**: Use the [Conventional Commits](#-commit-message-guidelines) standard for your commit messages. You can use `make commit` to assist in creating commit messages.
- **Open a Pull Request**: Submit a pull request to the `master` branch of the original repository. Ensure your PR is focused, addressing a single feature, fix, or improvement.

<br>
Expand Down Expand Up @@ -120,21 +124,21 @@ $ git commit -am 'fix: something has been fixed'

**Allowed Prefixes:**

| Prefix | Purpose |
| ---------- | ------------------------------------------------------------ |
| `feat` | Introduces a new feature |
| `fix` | Fixes a bug |
| `perf` | Improves performance |
| `docs` | Documentation only changes |
| `style` | Code style changes (formatting, missing semi-colons, etc.) |
| `deps` | Updates dependencies |
| `refactor` | Code changes that neither fixes a bug nor adds a feature |
| `ci` | Changes to our CI configuration files and scripts |
| `test` | Adding missing tests or correcting existing tests |
| `revert` | Reverts a previous commit |
| Prefix | Purpose |
|------------|---------------------------------------------------------------|
| `feat` | Introduces a new feature |
| `fix` | Fixes a bug |
| `perf` | Improves performance |
| `docs` | Documentation only changes |
| `style` | Code style changes (formatting, missing semi-colons, etc.) |
| `deps` | Updates dependencies |
| `refactor` | Code changes that neither fixes a bug nor adds a feature |
| `ci` | Changes to our CI configuration files and scripts |
| `test` | Adding missing tests or correcting existing tests |
| `revert` | Reverts a previous commit |
| `build` | Changes that affect the build system or external dependencies |
| `chore` | Other changes that don't modify src or test files |
| `security` | A code change that fixes a security issue |
| `chore` | Other changes that don't modify src or test files |
| `security` | A code change that fixes a security issue |

<br>

Expand Down Expand Up @@ -164,6 +168,23 @@ $ make lint-yaml

by default, [`cytopia/yamllint`](https://github.com/cytopia/docker-yamllint) Docker image will be used to run linter.

<br>

### → Action Lint

We use [`actionlint`](https://github.com/rhysd/actionlint) to enforce coding standards in GitHub Actions workflows.


To lint GitHub Actions run:

```bash
$ make lint-actions
```

by default, [`rhysd/actionlint`](https://hub.docker.com/r/rhysd/actionlint/tags) Docker image will be used to run linter.

<br>

### → PHP CS Fixer

We use [`friendsofphp/php-cs-fixer`](https://github.com/FriendsOfPHP/PHP-CS-Fixer) together with [`wayofdev/php-cs-fixer-config`](https://github.com/wayofdev/php-cs-fixer-config) to enforce coding standards in PHP files.
Expand Down
13 changes: 0 additions & 13 deletions .github/ISSUE_TEMPLATE.md

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/integrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:

coding-standards:
timeout-minutes: 4
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
concurrency:
cancel-in-progress: true
group: coding-standards-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand Down Expand Up @@ -209,7 +209,7 @@ jobs:
trust-gpg-keys: '0x033E5F8D801A2F8D'

- name: 🔬 Run maglnet/composer-require-checker
run: .phive/composer-require-checker check --ansi --config-file=$(pwd)/composer-require-checker.json --verbose
run: .phive/composer-require-checker check --ansi --config-file="$(pwd)"/composer-require-checker.json --verbose

mutation-testing:
timeout-minutes: 16
Expand Down
23 changes: 18 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@
# https://docs.docker.com/compose/environment-variables/envvars/
export DOCKER_BUILDKIT ?= 1

# Docker binary to use, when executing docker tasks
DOCKER ?= docker

# Binary to use, when executing docker-compose tasks
DOCKER_COMPOSE ?= docker compose
DOCKER_COMPOSE ?= $(DOCKER) compose

# Support image with all needed binaries, like envsubst, mkcert, wait4x
SUPPORT_IMAGE ?= wayofdev/build-deps:alpine-latest

APP_RUNNER ?= $(DOCKER_COMPOSE) run --rm --no-deps app
APP_COMPOSER ?= $(APP_RUNNER) composer

BUILDER_PARAMS ?= docker run --rm -i \
BUILDER_PARAMS ?= $(DOCKER) run --rm -i \
--env-file ./.env \
--env COMPOSE_PROJECT_NAME=$(COMPOSE_PROJECT_NAME) \
--env COMPOSER_AUTH="$(COMPOSER_AUTH)"
Expand All @@ -26,11 +29,17 @@ BUILDER_WIRED ?= $(BUILDER_PARAMS) --network project.$(COMPOSE_PROJECT_NAME) $(S
ENVSUBST ?= $(BUILDER) envsubst

# Yamllint docker image
YAML_LINT_RUNNER ?= docker run --rm $$(tty -s && echo "-it" || echo) \
YAML_LINT_RUNNER ?= $(DOCKER) run --rm $$(tty -s && echo "-it" || echo) \
-v $(PWD):/data \
cytopia/yamllint:latest \
-f colored .

ACTION_LINT_RUNNER ?= $(DOCKER) run --rm $$(tty -s && echo "-it" || echo) \
-v $(shell pwd):/repo \
--workdir /repo \
rhysd/actionlint:latest \
-color

PHIVE_RUNNER ?= $(DOCKER_COMPOSE) run --rm --no-deps app

NPM_RUNNER ?= pnpm
Expand Down Expand Up @@ -68,7 +77,7 @@ MAKE_CMD_COLOR := $(BLUE)

default: all

help:
help: ## Show this menu
@echo 'Management commands for package:'
@echo 'Usage:'
@echo ' ${MAKE_CMD_COLOR}make${RST} Setups dependencies for fresh-project, like composer install, git hooks and others...'
Expand Down Expand Up @@ -168,13 +177,17 @@ hooks: ## Install git hooks from pre-commit-config
pre-commit autoupdate
.PHONY: hooks

lint: lint-yaml lint-php lint-stan lint-composer lint-audit ## Runs all linting commands
lint: lint-yaml lint-actions lint-php lint-stan lint-composer lint-audit ## Runs all linting commands
.PHONY: lint

lint-yaml: ## Lints yaml files inside project
@$(YAML_LINT_RUNNER)
.PHONY: lint-yaml

lint-actions: ## Lint all github actions
@$(ACTION_LINT_RUNNER)
.PHONY: lint-actions

lint-php: prepare ## Fixes code to follow coding standards using php-cs-fixer
$(APP_COMPOSER) cs:fix
.PHONY: lint-php
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,9 @@ You are more than welcome. Before contributing, kindly check our [contribution g
Created in **2022** by [lotyp](https://github.com/wayofdev) @ [wayofdev](https://github.com/wayofdev)

<br>

## 🫡 Contributors

<img align="left" src="https://img.shields.io/github/contributors-anon/wayofdev/laravel-package-tpl?style=for-the-badge" alt="Contributors Badge"/>

<br>
Loading