Skip to content

Commit

Permalink
update php version in workflows (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
wachterjohannes authored Jul 24, 2024
1 parent fb698cc commit 0a709cb
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 87 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/phar-development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ jobs:
fail-fast: false
matrix:
include:
- php-version: '7.4'
- php-version: '8.0'
- php-version: '8.1'
- php-version: '8.2'

steps:
- name: "Checkout"
Expand Down
202 changes: 118 additions & 84 deletions .github/workflows/phar.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions

name: "Compile PHAR"

on:
Expand All @@ -14,90 +12,126 @@ jobs:
compile:
name: "Compile PHAR"
runs-on: "ubuntu-latest"

strategy:
fail-fast: false
fail-fast: true
matrix:
include:
- php-version: '8.0'
- php-version: '8.0'
- php-version: '8.1'
- php-version: '8.2'

steps:
- name: "Checkout"
uses: "actions/checkout@v2"
with:
fetch-depth: 0

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: ${{ matrix.php-version }}
tools: composer:v1
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: "Cache dependencies"
uses: "actions/cache@v2"
with:
path: "~/.composer/cache"
key: "php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-"

- name: "Install dependencies"
run: "composer install --no-interaction --no-progress --no-suggest --no-dev"

- name: "Download box"
run: wget -O box.phar https://github.com/box-project/box/releases/download/${BOX_VERSION}/box.phar
env:
BOX_VERSION: 3.11.0

- name: "Prepare pem File"
env:
PHAR_PRIVATE: ${{ secrets.PHAR_PRIVATE }}
run: echo "$PHAR_PRIVATE" > .github/phar-private.pem

- name: "Compile PHAR"
run: php box.phar compile

- name: "Run phar to see if it works"
run: php nanbando.phar

- name: "Checkout gh-pages"
uses: "actions/checkout@v2"
with:
ref: gh-pages
path: gh-pages
token: ${{ secrets.PAT }}

- name: "cp PHAR"
run: |
cp nanbando.phar gh-pages/nanbando.phar
- name: "Create sha1sum"
working-directory: gh-pages
run: |
sha1sum nanbando.phar > nanbando.phar.version
- name: "Configure Git"
working-directory: gh-pages
run: |
git config user.email "[email protected]" && \
git config user.name "Johannes Wachter"
- name: "Commit PHAR - master"
working-directory: gh-pages
if: "!startsWith(github.ref, 'refs/tags/')"
run: |
git add nanbando.phar nanbando.phar.version && \
git commit -m "Updated nanbando to commit ${{ github.event.after }}" && \
git push
- name: "Create Release - tag"
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
with:
files: |
nanbando.phar
nanbando.phar.pubkey
- name: "Checkout"
uses: "actions/checkout@v2"
with:
fetch-depth: 0

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: ${{ matrix.php-version }}
tools: composer:v1
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: "Cache dependencies"
uses: "actions/cache@v2"
with:
path: "~/.composer/cache"
key: "php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-"

- name: "Install dependencies"
run: "composer install --no-interaction --no-progress --no-suggest --no-dev"

- name: "Download box"
run: wget -O box.phar https://github.com/box-project/box/releases/download/${BOX_VERSION}/box.phar
env:
BOX_VERSION: 3.11.0

- name: "Prepare pem File"
env:
PHAR_PRIVATE: ${{ secrets.PHAR_PRIVATE }}
run: echo "$PHAR_PRIVATE" > .github/phar-private.pem

- name: "Compile PHAR"
run: php box.phar compile

- name: "Run phar to see if it works"
run: php nanbando.phar

- name: "Rename PHAR with version suffix"
run: |
mv nanbando.phar nanbando-php${{ matrix.php-version }}.phar
cp nanbando-php${{ matrix.php-version }}.phar nanbando-php${{ matrix.php-version }}.phar.pubkey
- name: "Upload PHAR as artifact"
uses: actions/upload-artifact@v2
with:
name: nanbando-php${{ matrix.php-version }}
path: |
nanbando-php${{ matrix.php-version }}.phar
nanbando-php${{ matrix.php-version }}.phar.pubkey
deploy:
name: "Deploy PHARs"
needs: compile
runs-on: "ubuntu-latest"
steps:
- name: "Checkout gh-pages"
uses: "actions/checkout@v2"
with:
ref: gh-pages
path: gh-pages
token: ${{ secrets.PAT }}

- name: "Download all artifacts"
uses: actions/download-artifact@v2
with:
path: artifacts

- name: "Copy PHARs to gh-pages"
run: |
cp artifacts/nanbando-php8.0/nanbando-php8.0.phar* gh-pages/
cp artifacts/nanbando-php8.1/nanbando-php8.1.phar* gh-pages/
cp artifacts/nanbando-php8.2/nanbando-php8.2.phar* gh-pages/
cp artifacts/nanbando-php8.2/nanbando-php8.2.phar gh-pages/nanbando.phar
cp artifacts/nanbando-php8.2/nanbando-php8.2.phar.pubkey gh-pages/nanbando.phar.pubkey
- name: "Create sha1sum"
working-directory: gh-pages
run: |
sha1sum nanbando-php8.0.phar > nanbando-php8.0.phar.version
sha1sum nanbando-php8.1.phar > nanbando-php8.1.phar.version
sha1sum nanbando-php8.2.phar > nanbando-php8.2.phar.version
sha1sum nanbando.phar > nanbando.phar.version
- name: "Configure Git"
working-directory: gh-pages
run: |
git config user.email "[email protected]"
git config user.name "Johannes Wachter"
- name: "Commit PHARs"
working-directory: gh-pages
run: |
git add nanbando-php8.0.phar* nanbando-php8.1.phar* nanbando-php8.2.phar* nanbando.phar*
git commit -m "Updated nanbando PHARs for commit ${{ github.sha }}"
git push
- name: "Create Release"
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
with:
files: |
gh-pages/nanbando-php8.0.phar
gh-pages/nanbando-php8.1.phar
gh-pages/nanbando-php8.2.phar
gh-pages/nanbando.phar
gh-pages/nanbando-php8.0.phar.pubkey
gh-pages/nanbando-php8.1.phar.pubkey
gh-pages/nanbando-php8.2.phar.pubkey
gh-pages/nanbando.phar.pubkey
3 changes: 2 additions & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ jobs:
fail-fast: false
matrix:
include:
- php-version: '7.4'
- php-version: '8.0'
- php-version: '8.1'
- php-version: '8.2'

steps:
- name: Checkout project
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
},
"require-dev": {
"phpunit/phpunit": "^7.0 || ^8.5",
"league/flysystem-memory": "^1.0"
"league/flysystem-memory": "^1.0",
"phpspec/prophecy": "^1.19"
},
"autoload": {
"psr-4": {
Expand Down

0 comments on commit 0a709cb

Please sign in to comment.