CI and release #169
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
name: CI and release | |
on: | |
push: | |
branches: | |
- master | |
- development | |
tags: | |
- 'v*.*.*' | |
pull_request: | |
schedule: | |
- cron: "7 7 * * *" | |
jobs: | |
static-analysis: | |
runs-on: ubuntu-latest | |
steps: | |
- name: GIT--checkout | |
uses: actions/checkout@v4 | |
- name: Install tools for static analysis | |
run: make install-static-analysis | |
- name: Composer validate | |
run: make composer-validate | |
- name: Composer validate | |
run: make composer-install | |
- name: Run PHPStan | |
run: make phpstan | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php: | |
- "7.2" | |
- "7.3" | |
- "7.4" | |
- "8.0" | |
- "8.1" | |
- "8.2" | |
- "8.3" | |
steps: | |
- name: GIT--checkout | |
uses: actions/checkout@v4 | |
- name: Install environment | |
run: make composer-install | |
- name: Run all tests | |
run: make -s "test-php-${{matrix.php}}" | |
env: | |
COMPOSE_INTERACTIVE_NO_CLI: 1 | |
release: | |
needs: | |
- static-analysis | |
- tests | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' | |
steps: | |
- name: GIT--Checkout | |
uses: actions/checkout@v4 | |
- name: Extract version | |
if: success() | |
run: | | |
# Strip git ref prefix from version | |
RELEASE_VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
# Strip "v" prefix from tag name | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && RELEASE_VERSION=$(echo $RELEASE_VERSION | sed -e 's/^v//') | |
echo $RELEASE_VERSION | |
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV | |
- name: Create release | |
if: ${{ success() && startsWith(github.ref, 'refs/tags/') }} | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: Version ${{ env.RELEASE_VERSION }} | |
body_path: CHANGELOG.md | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |