feat: initial commit
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
13
.github/dependabot.yml
vendored
Normal file
13
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
version: 2
|
||||
updates:
|
||||
# GitHub Actions
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
labels:
|
||||
- "dependencies"
|
||||
- "github-actions"
|
||||
commit-message:
|
||||
prefix: "chore"
|
||||
include: "scope"
|
||||
59
.github/workflows/release.yml
vendored
Normal file
59
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
name: Release
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Create Release
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get version from tag
|
||||
id: version
|
||||
run: |
|
||||
VERSION=${GITHUB_REF#refs/tags/v}
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Extract changelog
|
||||
id: changelog
|
||||
run: |
|
||||
VERSION=${{ steps.version.outputs.version }}
|
||||
# Extract the changelog section for this version
|
||||
CHANGELOG=$(sed -n "/## \[$VERSION\]/,/## \[/p" CHANGELOG.md | sed '$d')
|
||||
# Use a delimiter to handle multiline
|
||||
echo "changelog<<EOF" >> $GITHUB_OUTPUT
|
||||
echo "$CHANGELOG" >> $GITHUB_OUTPUT
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Create GitHub Release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ steps.version.outputs.tag }}
|
||||
release_name: Release ${{ steps.version.outputs.tag }}
|
||||
body: ${{ steps.changelog.outputs.changelog }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
|
||||
- name: Update major version tag
|
||||
run: |
|
||||
VERSION=${{ steps.version.outputs.version }}
|
||||
MAJOR_VERSION=$(echo $VERSION | cut -d. -f1)
|
||||
|
||||
git config user.name github-actions
|
||||
git config user.email github-actions@github.com
|
||||
|
||||
# Force update the major version tag
|
||||
git tag -fa "v$MAJOR_VERSION" -m "Update v$MAJOR_VERSION to $VERSION"
|
||||
git push origin "v$MAJOR_VERSION" --force
|
||||
240
.github/workflows/test.yml
vendored
Normal file
240
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,240 @@
|
||||
name: Test Action
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
test-node-npm:
|
||||
name: Test Node.js with npm
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Test action with Node.js (npm)
|
||||
uses: ./
|
||||
with:
|
||||
install-node: 'true'
|
||||
node-version: '20'
|
||||
package-manager: 'npm'
|
||||
server-path: './test-server'
|
||||
|
||||
- name: Verify installation
|
||||
run: |
|
||||
test -d ./test-server || exit 1
|
||||
test -d ./test-server/node_modules || exit 1
|
||||
chmod +x ./scripts/health-check.sh
|
||||
./scripts/health-check.sh ./test-server true false false
|
||||
echo "✓ Node.js (npm) installation successful"
|
||||
|
||||
- name: Run server tests
|
||||
run: |
|
||||
cd ./test-server
|
||||
npm test
|
||||
|
||||
test-node-yarn:
|
||||
name: Test Node.js with yarn
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
|
||||
- name: Test action with Node.js (yarn)
|
||||
uses: ./
|
||||
with:
|
||||
install-node: 'true'
|
||||
node-version: '20'
|
||||
package-manager: 'yarn'
|
||||
server-path: './test-server'
|
||||
|
||||
- name: Verify installation
|
||||
run: |
|
||||
test -d ./test-server || exit 1
|
||||
test -d ./test-server/node_modules || exit 1
|
||||
chmod +x ./scripts/health-check.sh
|
||||
./scripts/health-check.sh ./test-server true false false
|
||||
echo "✓ Node.js (yarn) installation successful"
|
||||
|
||||
- name: Run server tests
|
||||
run: |
|
||||
cd ./test-server
|
||||
yarn test
|
||||
|
||||
test-node-pnpm:
|
||||
name: Test Node.js with pnpm
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Test action with Node.js (pnpm)
|
||||
uses: ./
|
||||
with:
|
||||
install-node: 'true'
|
||||
node-version: '20'
|
||||
package-manager: 'pnpm'
|
||||
server-path: './test-server'
|
||||
|
||||
- name: Verify installation
|
||||
run: |
|
||||
test -d ./test-server || exit 1
|
||||
test -d ./test-server/node_modules || exit 1
|
||||
chmod +x ./scripts/health-check.sh
|
||||
./scripts/health-check.sh ./test-server true false false
|
||||
echo "✓ Node.js (pnpm) installation successful"
|
||||
|
||||
- name: Run server tests
|
||||
run: |
|
||||
cd ./test-server
|
||||
pnpm test
|
||||
|
||||
test-php:
|
||||
name: Test PHP
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Test action with PHP
|
||||
uses: ./
|
||||
with:
|
||||
install-php: 'true'
|
||||
php-version: '8.2'
|
||||
server-path: './test-server'
|
||||
|
||||
- name: Verify installation
|
||||
run: |
|
||||
test -d ./test-server || exit 1
|
||||
php --version
|
||||
composer --version
|
||||
chmod +x ./scripts/health-check.sh
|
||||
./scripts/health-check.sh ./test-server false true false
|
||||
echo "✓ PHP installation successful"
|
||||
|
||||
- name: Run server tests
|
||||
run: |
|
||||
cd ./test-server
|
||||
./vendor/bin/phpunit
|
||||
|
||||
test-nginx:
|
||||
name: Test nginx
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Test action with nginx
|
||||
uses: ./
|
||||
with:
|
||||
install-nginx: 'true'
|
||||
server-path: './test-server'
|
||||
|
||||
- name: Verify installation
|
||||
run: |
|
||||
test -d ./test-server || exit 1
|
||||
nginx -v
|
||||
sudo systemctl status nginx --no-pager
|
||||
chmod +x ./scripts/health-check.sh
|
||||
./scripts/health-check.sh ./test-server false false true
|
||||
echo "✓ nginx installation successful"
|
||||
|
||||
test-all-components:
|
||||
name: Test All Components
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Test action with all components
|
||||
uses: ./
|
||||
with:
|
||||
install-node: 'true'
|
||||
install-php: 'true'
|
||||
install-nginx: 'true'
|
||||
node-version: '20'
|
||||
php-version: '8.2'
|
||||
package-manager: 'npm'
|
||||
server-path: './test-server'
|
||||
|
||||
- name: Verify installation
|
||||
run: |
|
||||
test -d ./test-server || exit 1
|
||||
test -d ./test-server/node_modules || exit 1
|
||||
node --version
|
||||
npm --version
|
||||
php --version
|
||||
composer --version
|
||||
nginx -v
|
||||
chmod +x ./scripts/health-check.sh
|
||||
./scripts/health-check.sh ./test-server true true true
|
||||
echo "✓ All components installation successful"
|
||||
|
||||
- name: Run integration tests
|
||||
run: |
|
||||
cd ./test-server
|
||||
npm run test:integration
|
||||
|
||||
test-custom-paths:
|
||||
name: Test Custom Server Path
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Test action with custom path
|
||||
uses: ./
|
||||
with:
|
||||
install-node: 'true'
|
||||
server-path: './my-custom-server'
|
||||
|
||||
- name: Verify installation
|
||||
run: |
|
||||
test -d ./my-custom-server || exit 1
|
||||
test -d ./my-custom-server/node_modules || exit 1
|
||||
echo "✓ Custom path installation successful"
|
||||
|
||||
- name: Run server tests
|
||||
run: |
|
||||
cd ./my-custom-server
|
||||
npm test
|
||||
|
||||
test-without-dependencies:
|
||||
name: Test Without Dependencies
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Test action without installing dependencies
|
||||
uses: ./
|
||||
with:
|
||||
install-node: 'true'
|
||||
install-dependencies: 'false'
|
||||
server-path: './test-server'
|
||||
|
||||
- name: Verify installation
|
||||
run: |
|
||||
test -d ./test-server || exit 1
|
||||
node --version
|
||||
# node_modules should not exist since we skipped dependency installation
|
||||
if [ -d ./test-server/node_modules ]; then
|
||||
echo "✗ Dependencies were installed when they shouldn't have been"
|
||||
exit 1
|
||||
fi
|
||||
echo "✓ Installation without dependencies successful"
|
||||
|
||||
test-build-command:
|
||||
name: Test Build Command
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Test action with build command
|
||||
uses: ./
|
||||
with:
|
||||
install-node: 'true'
|
||||
server-path: './test-server'
|
||||
build-command: 'echo "Build complete" > build.log'
|
||||
|
||||
- name: Verify build
|
||||
run: |
|
||||
test -f ./test-server/build.log || exit 1
|
||||
grep -q "Build complete" ./test-server/build.log || exit 1
|
||||
echo "✓ Build command executed successfully"
|
||||
Reference in New Issue
Block a user