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

Merge release workflow and unit tests improvement into main #120

Merged
merged 18 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
33 changes: 0 additions & 33 deletions .docker/Dockerfile

This file was deleted.

15 changes: 0 additions & 15 deletions .docker/docker-compose.yml

This file was deleted.

8 changes: 8 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Grant ownership of all files by default to the ECOM integrations squad
* @alma/squad-e-commerce-integrations

# Grant DevX ownership of Github workflows and actions
.github @alma/squad-devx

# Grant DevX ownership of Taskfile
Taskfile.yml @alma/squad-devx
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
### Reason for change

<!-- Describe here the reason for change, and provide a link to the corresponding ClickUp task or Sentry issue. -->
<!-- Describe here the reason for change, and provide a link to the corresponding Linear task or Sentry issue. -->

[ClickUp task](https://app.clickup.com/20427503/v/b/4-32476982-2/CLICKUP_ISSUE_ID)
[Linear task](https://linear.app/almapay/issue/ECOM-XXX)

### Code changes

Expand Down
11 changes: 11 additions & 0 deletions .github/pr-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'type: chore': ['chore/*', 'renovate/*', 'chore(deps):*']
'type: ci': ci/*
'type: perf': perf/*
'type: refator': refactor/*
'type: test': test/*
'type: docs': docs/*
'type: bugfix': ['fix/*', 'bug/*', 'hotfix-backport/*']
'type: feature': ['feature/*', 'feat/*']
'type: security': ['security/*', 'dependabot/*']
'type: hotfix': 'hotfix/*'
'type: devx': 'devx/*'
25 changes: 24 additions & 1 deletion .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,33 @@ name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'

template: |
## Changes

$CHANGES

change-template: '- $TITLE'
### Contributors

$CONTRIBUTORS

categories:
- title: '🚀 New Features'
labels:
- 'type: feature'
- title: '🐛 Bug Fixes'
labels:
- 'type: bugfix'
- 'type: hotfix'

exclude-labels:
- 'skip-changelog'
- 'type: chore'
- 'type: ci'
- 'type: refactor'
- 'type: test'
- 'type: docs'
- 'type: security'
- 'type: devx'
change-template: '- $TITLE (#$NUMBER)'
change-title-escapes: '\<*_&#@`'
version-resolver:
major:
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/backport-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This workflow is triggered when a pull request is merged and the label 'release' is present.
carine-bonnafous marked this conversation as resolved.
Show resolved Hide resolved
# It opens a pull request to backport the changes from main to develop.
name: Create backport pull request

on:
pull_request:
branches:
- main
types:
- closed

jobs:

create-backport-pull-request:
if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'release')) }}
carine-bonnafous marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-22.04

steps:

- uses: actions/checkout@v4
with:
carine-bonnafous marked this conversation as resolved.
Show resolved Hide resolved
ref: develop

# See https://github.com/peter-evans/create-pull-request/blob/main/docs/examples.md#keep-a-branch-up-to-date-with-another
- name: Fetch main branch
run: |
git fetch origin main:main
git reset --hard main

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
commit-message: 'chore: backport main to develop'
title: Backport main to develop
branch: chore/backport-main-to-develop
base: develop
labels: skip-changelog
68 changes: 68 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Continuous integration
carine-bonnafous marked this conversation as resolved.
Show resolved Hide resolved

on:
workflow_dispatch: ~
push:
branches:
- develop
- main
pull_request:
branches:
- develop
- main

jobs:
ci:
name: Linting, tests and coverage
carine-bonnafous marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-22.04

strategy:
fail-fast: false
matrix:
php:
- "5.6"
- "7.0"
- "7.1"
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2

- name: Validate composer.json and composer.lock
run: composer validate

- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Ensure source code is linted
run: composer exec phpcs -- src/

- name: Remove uncompliant statements in legacy code
if: contains(fromJson('["5.6", "7.0"]'), matrix.php)
run: |
# Replace string in files
string=': void'
grep -r -l "$string" tests/ | xargs sed -i "s/$string//g"

- name: PHPUnit
run: composer exec phpunit -- --configuration phpunit.ci.xml --coverage-xml ./.coverage
env:
XDEBUG_MODE: coverage

- name: PHPUnit threshold
run: php ./phpunit-threshold.php
41 changes: 0 additions & 41 deletions .github/workflows/code-coverage.yaml

This file was deleted.

66 changes: 66 additions & 0 deletions .github/workflows/hotfix-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Create hotfix pull request
carine-bonnafous marked this conversation as resolved.
Show resolved Hide resolved

on:
workflow_dispatch:
inputs:
changelog-message:
type: string
description: The message to add to the changelog
required: true

jobs:

create-hotfix-pull-request:
runs-on: ubuntu-22.04
carine-bonnafous marked this conversation as resolved.
Show resolved Hide resolved
carine-bonnafous marked this conversation as resolved.
Show resolved Hide resolved
carine-bonnafous marked this conversation as resolved.
Show resolved Hide resolved

steps:

- uses: actions/checkout@v4
with:
carine-bonnafous marked this conversation as resolved.
Show resolved Hide resolved
ref: main

- name: Release drafter
uses: release-drafter/release-drafter@v6
id: release-drafter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Update release draft
uses: actions/github-script@v7
with:
script: |
const { owner, repo } = context.repo;
await github.rest.repos.updateRelease({
owner,
repo,
release_id: "${{ steps.release-drafter.outputs.id }}",
draft: true,
body: "### 🐛 Bug Fixes\n ${{ inputs.changelog-message }}\n"
});

- name: Update CHANGELOG.md file
uses: stefanzweifel/changelog-updater-action@v1
with:
latest-version: ${{ steps.release-drafter.outputs.tag_name }}
release-notes: "### 🐛 Bug Fixes\n ${{ inputs.changelog-message }}\n"

- name: Update other files
run: |
./scripts/update-files-with-release-version.sh ${{ steps.release-drafter.outputs.tag_name }}

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
commit-message: 'chore: update version'
title: Release ${{ steps.release-drafter.outputs.tag_name }}
body: |
Update version to ${{ steps.release-drafter.outputs.tag_name }}

### Checklist of actions to be done before merging
- [ ] Review and update the CHANGELOG.md if needed
- [ ] Review and update the Github release draft if needed
- [ ] Review the files updated with the new version number in the commit named "chore: update version"
branch: hotfix/${{ steps.release-drafter.outputs.tag_name }}
base: main
labels: hotfix, release

36 changes: 0 additions & 36 deletions .github/workflows/php.yml

This file was deleted.

16 changes: 16 additions & 0 deletions .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: PR Labeler
carine-bonnafous marked this conversation as resolved.
Show resolved Hide resolved
on:
pull_request:
types: [opened]

jobs:
pr-labeler:
permissions:
carine-bonnafous marked this conversation as resolved.
Show resolved Hide resolved
contents: read
pull-requests: write

runs-on: ubuntu-22.04
steps:
- uses: TimonVS/pr-labeler-action@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading
Loading