Skip to content

Commit

Permalink
🧑‍💻 Rebuild CI pipeline and switch to pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
derteaser committed Dec 2, 2024
1 parent 3287cd1 commit eee52ad
Show file tree
Hide file tree
Showing 10 changed files with 2,169 additions and 2,935 deletions.
28 changes: 28 additions & 0 deletions .github/actions/setup-php-composer/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: 'Setup PHP + Cache and install Composer dependencies + Copy .env file'
description: 'Setup PHP + Cache and install Composer dependencies + Copy .env file'
runs:
using: 'composite'
steps:
- uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2
with:
php-version: '8.3'

- name: 🔍 Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
shell: bash

- name: 🗄️ Cache composer dependencies
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: 📦 Install dependencies
run: composer install --no-interaction --prefer-dist
shell: bash

- name: 📋 Copy .env file
run: cp .env.ci .env
shell: bash
54 changes: 15 additions & 39 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,30 @@ on:
- main

jobs:
prepare:

build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4

- name: Set up PHP
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: pnpm/action-setup@v4
with:
php-version: '8.2'

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache composer dependencies
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies
run: composer install --no-dev --no-interaction
run_install: false
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
with:
node-version: 20.x
- name: Enable Corepack
run: corepack enable
- name: Install Yarn dependencies
uses: borales/actions-yarn@3766bb1335b98fb13c60eaf358fe20811b730a88 # v5
with:
cmd: install
- name: Build production bundle
uses: borales/actions-yarn@3766bb1335b98fb13c60eaf358fe20811b730a88 # v5
with:
cmd: build

- name: Commit and push local changes
node-version: 22
cache: 'pnpm'
- name: 📦 Install dependencies
run: pnpm install
- name: 📦 Build production bundle
run: pnpm build
- name: 📥 Commit and push local changes
uses: stefanzweifel/git-auto-commit-action@8621497c8c39c72f3e2a999a26b4ca1b5058a842 # v5.0.1
with:
commit_message: 🍱 Apply theme changes
commit_message: 💄Apply theme changes
deploy:
needs: prepare
needs: build
runs-on: ubuntu-latest
steps:
- name: executing remote ssh commands using password
- name: 🕹️ Executing remote SSH commands using password
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
Expand All @@ -63,4 +39,4 @@ jobs:
script: |
cd einstein
git pull
php82 /usr/bin/composer install --no-dev -d ${PWD}
php83 /usr/bin/composer install --no-dev -d ${PWD}
30 changes: 6 additions & 24 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,14 @@ jobs:
test:
runs-on: ubuntu-latest
name: Run Pest tests

steps:
- name: Checkout code
- name: 📦 Checkout project repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4

- name: Set up PHP
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2
with:
php-version: '8.3'

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache composer dependencies
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer install --no-interaction --no-suggest --prefer-dist
fetch-depth: 0

- name: Copy .env file
run: cp .env.ci .env
- name: 📦 Setup PHP + install deps
uses: ./.github/actions/setup-php-composer

- name: Run tests
run: vendor/bin/pest
- name: 🏃‍♂️ Run tests
run: vendor/bin/pest --ci
8 changes: 0 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,3 @@ Icon
/.idea/*
.env
/site/config/config.*.php

.yarn/*
!.yarn/cache
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
1 change: 0 additions & 1 deletion .yarnrc.yml

This file was deleted.

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"keywords": ["kirby", "cms"],
"homepage": "https://www.foerderverein-familienzentrum-einsteinstrasse-neuss.de",
"require": {
"php": "^8.2",
"php": "~8.2|~8.3",
"getkirby/cms": "3.10.1.1",
"wearejust/kirby-meta-tags": "3.0.1",
"bnomei/kirby3-robots-txt": "1.8.0",
Expand Down
Loading

0 comments on commit eee52ad

Please sign in to comment.