-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from TrueLayer/feature/2024-10-31-changelog
V2.4.0
- Loading branch information
Showing
39 changed files
with
1,205 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Check config.xml version | ||
on: | ||
pull_request: | ||
types: [opened, reopened, synchronize] | ||
branches: [main] | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
fetch-depth: 0 | ||
|
||
- name: Set OLD_VERSION from etc/config.xml if merge would modify it | ||
run: | | ||
echo "OLD_VERSION=$(git log origin/main..HEAD --cherry -p -- etc/config.xml | grep '\-.\s*.<version>' | tail -1 | tr -d '\-[:blank:]\n' | sed -e 's/<version>\(.*\)<\/version>/\1/')" >> $GITHUB_ENV | ||
- name: Set NEW_VERSION from etc/config.xml if merge would modify it | ||
run: | | ||
echo "NEW_VERSION=$(git log origin/main..HEAD --cherry -p -- etc/config.xml | grep '\+.\s*.<version>' | head -1 | tr -d '+[:blank:]\n' | sed -e 's/<version>\(.*\)<\/version>/\1/')" >> $GITHUB_ENV | ||
- name: Test that versions are not empty | ||
run: | | ||
[[ ! -z $OLD_VERSION ]] && [[ ! -z $NEW_VERSION ]] | ||
- name: Test that versions are different | ||
run: | | ||
[[ $OLD_VERSION != $NEW_VERSION ]] | ||
- name: Test that version string mathches pattern | ||
run: | | ||
[[ $NEW_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]$ ]] | ||
- name: Sort versions | ||
run: | | ||
if [[ $OLD_VERSION =~ ^[0-9]+(\.[0-9]+)+\.[0-9]$ ]]; then | ||
echo "GREATER_VERSION=$(echo -e ${OLD_VERSION}\\n${NEW_VERSION} | sort --version-sort | tail -n1)" >> $GITHUB_ENV | ||
else | ||
echo "GREATER_VERSION=$NEW_VERSION" >> $GITHUB_ENV | ||
fi | ||
- name: Make sure new version is greater | ||
run: | | ||
[[ $GREATER_VERSION == $NEW_VERSION ]] | ||
- name: Ensure changelog is not empty for the new version | ||
run: | | ||
CHANGELOG=$(sed -n "/^## \[v$NEW_VERSION\]/,/^## \[v/p" CHANGELOG.md | sed -e "s/^## \[v.*\$//" | sed -e :a -e '/./,$!d;/^\n*$/{$d;N;};/\n$/ba') | ||
[[ -n $CHANGELOG ]] | ||
[[ $CHANGELOG == *"### Added"* || $CHANGELOG == *"### Changed"* || $CHANGELOG == *"### Fixed"* ]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: Create Tag | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags-ignore: | ||
- '**' | ||
|
||
jobs: | ||
tag: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: '0' | ||
|
||
- name: Generate Git Tag | ||
id: generate_tag | ||
run: | | ||
NEW_TAG=v$(cat etc/config.xml | grep '<version>' | tr -d '\-[:blank:]\n' | sed -e 's/<version>\(.*\)<\/version>/\1/') | ||
echo "NEW_TAG=${NEW_TAG}" >> $GITHUB_ENV | ||
echo "NEW_TAG=${NEW_TAG}" >> $GITHUB_OUTPUT | ||
- name: Test that version string mathches pattern | ||
run: | | ||
[[ $NEW_TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]$ ]] | ||
- name: Test for tag collision | ||
run: | | ||
TAG_EXISTS=0 | ||
for EXISTING_TAG in `git tag -l`; do | ||
if [[ $EXISTING_TAG == $NEW_TAG || v$EXISTING_TAG == $NEW_TAG ]]; then | ||
TAG_EXISTS=1 | ||
break | ||
fi | ||
done | ||
[[ $TAG_EXISTS == 0 ]] | ||
- name: Ensure changelog is not empty for the new tag | ||
run: | | ||
CHANGELOG=$(sed -n "/^## \[$NEW_TAG\]/,/^## \[v/p" CHANGELOG.md | sed -e "s/^## \[v.*\$//" | sed -e :a -e '/./,$!d;/^\n*$/{$d;N;};/\n$/ba') | ||
[[ -n $CHANGELOG ]] | ||
[[ $CHANGELOG == *"### Added"* || $CHANGELOG == *"### Changed"* || $CHANGELOG == *"### Fixed"* ]] | ||
- name: Push Git Tag | ||
run: | | ||
git config user.name "GitHub Actions" | ||
git config user.email "[email protected]" | ||
git tag $NEW_TAG | ||
git push origin $NEW_TAG | ||
- name: Create changelog diff | ||
run: | | ||
sed -n "/^## \[$NEW_TAG\]/,/^## \[v/p" CHANGELOG.md | sed -e "s/^## \[v.*\$//" | sed -e :a -e '/./,$!d;/^\n*$/{$d;N;};/\n$/ba' > release_notes.md | ||
- name: Create release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.generate_tag.outputs.NEW_TAG }} | ||
release_name: ${{ steps.generate_tag.outputs.NEW_TAG }} | ||
body_path: ./release_notes.md | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Delete release_notes file | ||
run: rm release_notes.md |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,6 @@ name: Lint PHP files | |
on: [push, pull_request] | ||
|
||
jobs: | ||
php-74: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: prestashop/github-action-php-lint/[email protected] | ||
|
||
php-81: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
retries=10 | ||
count=0 | ||
|
||
while [ $count -lt $retries ]; do | ||
mysql -uroot -e "SELECT 1" > /dev/null 2>&1 | ||
if [ $? -eq 0 ]; then | ||
echo "MySQL is available." | ||
break | ||
fi | ||
count=$((count+1)) | ||
echo "MySQL is not available. Retrying..." | ||
sleep 1 | ||
done | ||
|
||
if [ $count -eq $retries ]; then | ||
echo "Could not connect to MySQL after $retries retries." | ||
exit 1; | ||
fi | ||
|
||
echo "Now connecting to Elasticsearch" | ||
retries=20 | ||
count=0 | ||
|
||
while [ $count -lt $retries ]; do | ||
if curl -s -f -o /dev/null "http://localhost:9200"; then | ||
echo "Elasticsearch is available." | ||
break | ||
else | ||
count=$((count+1)) | ||
echo "Attempt $count of $retries: Elasticsearch is not available. Retrying..." | ||
sleep 1 | ||
fi | ||
done | ||
|
||
if [ $count -eq $retries ]; then | ||
cat /var/log/elasticsearch/elasticsearch.log | ||
echo "Could not connect to Elasticsearch after $retries retries." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
use PhpCsFixer\Config; | ||
use PhpCsFixer\Finder; | ||
|
||
$finder = Finder::create() | ||
->in(__DIR__) | ||
->exclude(['.github', '.vscode', 'docker', 'vendor']) | ||
->ignoreDotFiles(false); | ||
|
||
$rules = [ | ||
'@PSR1' => true, | ||
'@PSR2' => true, | ||
'@PSR12' => true, | ||
'ordered_imports' => [ | ||
'sort_algorithm' => 'alpha', | ||
'imports_order' => [ | ||
'class', | ||
'function', | ||
'const' | ||
] | ||
], | ||
'single_line_empty_body' => true, | ||
'array_indentation' => true, | ||
'array_syntax' => ['syntax' => 'short'], | ||
'no_whitespace_in_blank_line' => true, | ||
'whitespace_after_comma_in_array' => [ | ||
'ensure_single_space' => true | ||
], | ||
'no_multiline_whitespace_around_double_arrow' => true, | ||
'no_trailing_comma_in_singleline_array' => true, | ||
'normalize_index_brace' => true, | ||
'trim_array_spaces' => true, | ||
'single_class_element_per_statement' => [ | ||
'elements' => [ | ||
'const', | ||
'property' | ||
] | ||
], | ||
'visibility_required' => [ | ||
'elements' => [ | ||
'property', | ||
'method', | ||
'const' | ||
] | ||
], | ||
'align_multiline_comment' => true | ||
]; | ||
|
||
$config = new Config(); | ||
$config->setFinder($finder); | ||
$config->setRules($rules); | ||
$config->setIndent(' '); | ||
$config->setLineEnding("\n"); | ||
|
||
return $config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.