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

Sync #14

Merged
merged 45 commits into from
Sep 30, 2024
Merged

Sync #14

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
1348cec
docs: linkdrop
Ryuno-Ki Sep 25, 2024
b5c2ed7
fix: get release version right
Ryuno-Ki Sep 25, 2024
6bc71ee
Testing Environment
stevenobird Sep 25, 2024
6a06abd
Testing workflow adjustments
stevenobird Sep 25, 2024
6646880
Testing workflow adjustments
stevenobird Sep 26, 2024
5aadcee
Added DB_DATABASE to global testing workflow environment
stevenobird Sep 26, 2024
c043c94
Node.js test workflow adjustments
stevenobird Sep 26, 2024
7f6c51e
refactor: use secrets
Ryuno-Ki Sep 26, 2024
77ab8e9
fix: set environment
Ryuno-Ki Sep 26, 2024
0a8b432
feat: add Build Workflow
Ryuno-Ki Sep 27, 2024
fa65fe5
refactor: use build artifact
Ryuno-Ki Sep 27, 2024
4503788
fix: download artifact from other workflow
Ryuno-Ki Sep 27, 2024
5ec0b79
fix: wait on build with testing
Ryuno-Ki Sep 27, 2024
642eb8a
fix: quote workflow
Ryuno-Ki Sep 27, 2024
05f2341
fix: add more event triggers
Ryuno-Ki Sep 27, 2024
b0f86b1
chore: log variables
Ryuno-Ki Sep 27, 2024
82b8b24
refactor: define build as dependent job
Ryuno-Ki Sep 27, 2024
b94efe2
fix: dots are important
Ryuno-Ki Sep 27, 2024
18a4ba0
fix: mark up as reusable workflow
Ryuno-Ki Sep 27, 2024
f69d494
refactor: don't trigger build workflow directly
Ryuno-Ki Sep 27, 2024
5e3bca4
Build & Testing Artifact Workflow adjustments
stevenobird Sep 27, 2024
74d251c
Build & Testing Artifact Workflow adjustments
stevenobird Sep 27, 2024
fd41eec
Fixed artifact name
stevenobird Sep 27, 2024
d8d031c
fix: ls on not existing directories
stevenobird Sep 27, 2024
33cba24
fix: Extracting artifact to wrong path
stevenobird Sep 27, 2024
141a96a
chore: Checking where the artifact is extracted
stevenobird Sep 27, 2024
3563030
chore: Checking where the artifact is extracted
stevenobird Sep 27, 2024
bc15b10
chore: Checking where the artifact is extracted
stevenobird Sep 27, 2024
75cb3dc
chore: Checking where the artifact is extracted
stevenobird Sep 27, 2024
5c90b2e
chore: Checking where the artifact is extracted
stevenobird Sep 27, 2024
83c991b
chore: Checking where the artifact is extracted
stevenobird Sep 27, 2024
7c8bdfa
chore: Checking where the artifact is extracted
stevenobird Sep 27, 2024
9fcc4ee
fix: Download artifacts into correct directories
stevenobird Sep 27, 2024
ca3b0a0
feat: Test vendor cache between workflows
stevenobird Sep 27, 2024
d6d35a7
feat: Workflow adjustments
stevenobird Sep 27, 2024
83847c4
feat: Create testing database in tests workflow
stevenobird Sep 27, 2024
3ca4605
feat: Split build workflow between PHP and Node jobs
stevenobird Sep 27, 2024
a8b2b2b
feat: Change job names and matrixes
stevenobird Sep 27, 2024
d77d898
chore: Change PHP build job name to match default convention
stevenobird Sep 27, 2024
92d042a
refactor: Changed workflow names to be shorter in general
stevenobird Sep 27, 2024
1d1dfc6
feat: Added composer validation
stevenobird Sep 27, 2024
75d2dc6
Create dependabot.yml
Ryuno-Ki Sep 30, 2024
407e5b7
Merge branch 'main' into develop
Ryuno-Ki Sep 30, 2024
461d58b
fix: define package ecosystem
Ryuno-Ki Sep 30, 2024
01fa506
fix: thou shall keep 'em apart
Ryuno-Ki Sep 30, 2024
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
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "composer"
directory: "/" # Location of package manifests
schedule:
interval: "daily"

- package-ecosystem: "npm"
directory: "/" # Location of package manifests
schedule:
interval: "daily"
87 changes: 87 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Build
on:
workflow_call:

jobs:
build-php:
# See https://docs.github.com/en/actions/writing-workflows/choosing-where-your-workflow-runs/choosing-the-runner-for-a-job#standard-github-hosted-runners-for-public-repositories
runs-on: ubuntu-24.04
environment: testing

strategy:
matrix:
operating-system: [ ubuntu-24.04 ]
# Limited by https://github.com/shivammathur/setup-php#github-hosted-runners
php-version: [ '8.3' ]
dependency-stability: [ prefer-stable ]

name: build-laravel - PHP ${{ matrix.php-version }} (${{ matrix.operating-system }})

steps:
- uses: actions/checkout@v4.1.7 # Even better: using @<commit-SHA>

- name: Install PHP
uses: shivammathur/setup-php@2.31.1
with:
php-version: ${{ matrix.php-version }}

- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- uses: actions/cache@v4.0.2
id: actions-cache
with:
path: ${{ steps.composer-cache.outputs.dir }}
# could be extended in case multiple PHP versions are in use
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-

- name: Restore vendor from cache
uses: actions/cache@v4.0.2
id: vendor-cache
with:
path: vendor
key: ${{ runner.os }}-build-${{ hashFiles('**/composer.lock') }}

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

- name: Install PHP Dependencies
if: steps.vendor-cache.outputs.cache-hit != 'true'
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache

build-node:
runs-on: ubuntu-24.04
environment: testing

strategy:
matrix:
operating-system: [ ubuntu-24.04 ]

steps:
- uses: actions/checkout@v4.1.7 # Even better: using @<commit-SHA>

- name: Setup Node
uses: actions/setup-node@v4.0.4
with:
node-version: 20
cache: 'npm'

- name: Install Node Dependencies
# TODO: Test, whether --ignore-scripts work here, as this is helping in hardening (preventing postinstall scripts)
run: npm ci

- name: Build Frontend Assets
run: npm run build

- name: Upload Build Artifacts
uses: actions/upload-artifact@v4.4.0
with:
name: eventguru-build-${{ github.run_id }}
path: public/build
68 changes: 27 additions & 41 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test Laravel Github action
name: Tests
on:
pull_request:
branches:
Expand All @@ -14,67 +14,56 @@ env:
DB_DATABASE: testing

jobs:
laravel-tests:
build:
uses: './.github/workflows/build.yaml'

php-tests:
needs: [ build ]
# See https://docs.github.com/en/actions/writing-workflows/choosing-where-your-workflow-runs/choosing-the-runner-for-a-job#standard-github-hosted-runners-for-public-repositories
runs-on: ubuntu-24.04
environment: testing

strategy:
matrix:
operating-system: [ubuntu-24.04]
operating-system: [ ubuntu-24.04 ]
# Limited by https://github.com/shivammathur/setup-php#github-hosted-runners
php-versions: [ '8.3' ]
php-version: [ '8.3' ]
dependency-stability: [ prefer-stable ]

name: P${{ matrix.php-versions }} - L${{ matrix.laravel }} - ${{ matrix.dependency-stability }} - ${{ matrix.operating-system}}
name: php-tests - PHP ${{ matrix.php-version }} (${{ matrix.operating-system }})

steps:
- uses: actions/checkout@v4.1.7 # Even better: using @<commit-SHA>
- uses: actions/checkout@v4.1.7

- name: Start MySQL service
run: sudo systemctl start mysql.service
- name: Start MySQL service & create testing database
run: |
sudo systemctl start mysql.service
mysql -e "CREATE DATABASE IF NOT EXISTS $DB_DATABASE;" -u"$DB_USER" -p"$DB_PASSWORD"

- name: Install PHP versions
- name: Install PHP
uses: shivammathur/setup-php@2.31.1
with:
php-version: ${{ matrix.php-versions }}
php-version: ${{ matrix.php-version }}

- name: Setup Node
uses: actions/setup-node@v4
- name: Download build artifact
id: download-build-artifact
uses: actions/download-artifact@v4.1.8
with:
node-version: 20
cache: 'npm'

- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
# Pick up the folder from build.yaml Upload (name must match)
name: eventguru-build-${{ github.run_id }}
path: public/build

- uses: actions/cache@v4.0.2
id: actions-cache
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-

- name: Cache PHP dependencies
- name: Restore vendor from Cache
uses: actions/cache@v4.0.2
id: vendor-cache
with:
path: vendor
key: ${{ runner.OS }}-build-${{ hashFiles('**/composer.lock') }}

- name: Install PHP Dependencies
if: steps.vendor-cache.outputs.cache-hit != 'true'
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

- name: Install Node Dependencies
# TODO: Test, whether --ignore-scripts work here, as this is helping in hardening (preventing postinstall scripts)
run: npm ci

- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache
- name: Prepare Laravel Application
run: |
php -r "file_exists('.env') || copy('.env.example', '.env');"
php artisan key:generate

- name: Prepare Laravel Application
run: |
Expand All @@ -84,8 +73,5 @@ jobs:
- name: Run Migrations
run: php artisan migrate

- name: Build Frontend Assets
run: npm run build

- name: Execute tests (Unit and Feature tests) via PestPHP
run: php artisan test