mirror of
https://code.forgejo.org/actions/checkout.git
synced 2025-08-14 17:30:50 +00:00
Merge 4abe0c8600
into 08c6903cd8
This commit is contained in:
commit
7503a97f15
8 changed files with 878 additions and 83 deletions
104
.github/dependabot.yml
vendored
104
.github/dependabot.yml
vendored
|
@ -1,20 +1,88 @@
|
|||
---
|
||||
version: 2
|
||||
|
||||
updates:
|
||||
- package-ecosystem: "npm"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
groups:
|
||||
minor-npm-dependencies:
|
||||
# NPM: Only group minor and patch updates (we want to carefully review major updates)
|
||||
update-types: [minor, patch]
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
groups:
|
||||
minor-actions-dependencies:
|
||||
# GitHub Actions: Only group minor and patch updates (we want to carefully review major updates)
|
||||
update-types: [minor, patch]
|
||||
# Node.js (npm, yarn, pnpm)
|
||||
- package-ecosystem: "npm"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
open-pull-requests-limit: 10
|
||||
commit-message:
|
||||
prefix: "deps"
|
||||
include: "scope"
|
||||
labels: ["dependencies", "automerge"]
|
||||
reviewers: ["your-github-username"]
|
||||
assignees: ["your-github-username"]
|
||||
|
||||
# Python (pip)
|
||||
- package-ecosystem: "pip"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
labels: ["dependencies", "python"]
|
||||
|
||||
# Rust (cargo)
|
||||
- package-ecosystem: "cargo"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
labels: ["dependencies", "rust"]
|
||||
|
||||
# Go modules
|
||||
- package-ecosystem: "gomod"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
labels: ["dependencies", "go"]
|
||||
|
||||
# Docker
|
||||
- package-ecosystem: "docker"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
labels: ["dependencies", "docker"]
|
||||
|
||||
# GitHub Actions
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
labels: ["ci", "dependencies"]
|
||||
|
||||
# PHP (Composer)
|
||||
- package-ecosystem: "composer"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
labels: ["dependencies", "php"]
|
||||
|
||||
# Ruby (Bundler)
|
||||
- package-ecosystem: "bundler"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
labels: ["dependencies", "ruby"]
|
||||
|
||||
# Java (Maven)
|
||||
- package-ecosystem: "maven"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
labels: ["dependencies", "java"]
|
||||
|
||||
# .NET (NuGet)
|
||||
- package-ecosystem: "nuget"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
labels: ["dependencies", "dotnet"]
|
||||
|
||||
# Security-focused updates
|
||||
- package-ecosystem: "npm"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
allow:
|
||||
- dependency-type: "direct"
|
||||
labels: ["security", "automerge"]
|
||||
commit-message:
|
||||
prefix: "security"
|
||||
|
|
46
.github/workflows/dependabot-automerge.yml
vendored
Normal file
46
.github/workflows/dependabot-automerge.yml
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
name: Dependabot Auto-merge
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
test-and-merge:
|
||||
if: github.actor == 'dependabot[bot]'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# نصب Node.js برای اجرای تست (اگر پروژه Node.js باشد)
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20.x
|
||||
cache: 'npm'
|
||||
|
||||
# نصب وابستگیها (در صورت وجود)
|
||||
- run: |
|
||||
if [ -f package.json ]; then
|
||||
npm ci || true
|
||||
npm run build --if-present || true
|
||||
npm test || true
|
||||
fi
|
||||
|
||||
# اجرای تست برای زبانهای دیگر (به شکل ساده)
|
||||
- run: |
|
||||
if [ -f requirements.txt ]; then pip install -r requirements.txt && pytest || true; fi
|
||||
if [ -f Cargo.toml ]; then cargo test || true; fi
|
||||
if [ -f go.mod ]; then go test ./... || true; fi
|
||||
|
||||
# در صورت موفقیت تستها، Merge خودکار
|
||||
- name: Merge PR
|
||||
uses: fastify/github-action-merge-dependabot@v3
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
merge-method: squash
|
23
.github/workflows/docker-image.yml
vendored
Normal file
23
.github/workflows/docker-image.yml
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
https://github.com/Dev-Re2906/checkout/compare/v4.2.1...v4.2.2
|
||||
|
||||
git add .
|
||||
git commit -m "Ready for publish"
|
||||
git push origin main
|
||||
name: Docker Image CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Build the Docker image
|
||||
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)
|
138
.github/workflows/min.yml
vendored
Normal file
138
.github/workflows/min.yml
vendored
Normal file
|
@ -0,0 +1,138 @@
|
|||
name: Self-Hosted Universal CI/CD
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, master]
|
||||
tags: ['v*.*.*']
|
||||
pull_request:
|
||||
branches: [main, master]
|
||||
types: [opened, synchronize, reopened, closed]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
detect-project:
|
||||
name: Detect Project Language
|
||||
runs-on: self-hosted
|
||||
outputs:
|
||||
lang: ${{ steps.detect.outputs.lang }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- id: detect
|
||||
run: |
|
||||
if [ -f package.json ]; then
|
||||
echo "lang=node" >> $GITHUB_OUTPUT
|
||||
elif [ -f requirements.txt ]; then
|
||||
echo "lang=python" >> $GITHUB_OUTPUT
|
||||
elif [ -f Cargo.toml ]; then
|
||||
echo "lang=rust" >> $GITHUB_OUTPUT
|
||||
elif [ -f go.mod ]; then
|
||||
echo "lang=go" >> $GITHUB_OUTPUT
|
||||
elif ls *.csproj 1> /dev/null 2>&1; then
|
||||
echo "lang=dotnet" >> $GITHUB_OUTPUT
|
||||
elif [ -f pom.xml ]; then
|
||||
echo "lang=java" >> $GITHUB_OUTPUT
|
||||
elif [ -f composer.json ]; then
|
||||
echo "lang=php" >> $GITHUB_OUTPUT
|
||||
elif [ -f Gemfile ]; then
|
||||
echo "lang=ruby" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "lang=unknown" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
build-test:
|
||||
name: Build & Test (${{ needs.detect-project.outputs.lang }})
|
||||
needs: detect-project
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# Node.js
|
||||
- name: Setup Node.js
|
||||
if: ${{ needs.detect-project.outputs.lang == 'node' }}
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20.x
|
||||
cache: 'npm'
|
||||
|
||||
# Python
|
||||
- name: Setup Python
|
||||
if: ${{ needs.detect-project.outputs.lang == 'python' }}
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.x
|
||||
|
||||
# Rust
|
||||
- name: Setup Rust
|
||||
if: ${{ needs.detect-project.outputs.lang == 'rust' }}
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
|
||||
# Go
|
||||
- name: Setup Go
|
||||
if: ${{ needs.detect-project.outputs.lang == 'go' }}
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.21
|
||||
|
||||
# .NET
|
||||
- name: Setup .NET
|
||||
if: ${{ needs.detect-project.outputs.lang == 'dotnet' }}
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: 7.0.x
|
||||
|
||||
# Java
|
||||
- name: Setup Java
|
||||
if: ${{ needs.detect-project.outputs.lang == 'java' }}
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 17
|
||||
|
||||
# PHP
|
||||
- name: Setup PHP
|
||||
if: ${{ needs.detect-project.outputs.lang == 'php' }}
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.1'
|
||||
extensions: mbstring, xml, curl
|
||||
tools: composer
|
||||
|
||||
# Ruby
|
||||
- name: Setup Ruby
|
||||
if: ${{ needs.detect-project.outputs.lang == 'ruby' }}
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 3.1
|
||||
bundler-cache: true
|
||||
|
||||
# Build
|
||||
- name: Install & Build
|
||||
run: |
|
||||
case "${{ needs.detect-project.outputs.lang }}" in
|
||||
node) npm ci && npm run build --if-present ;;
|
||||
python) pip install -r requirements.txt ;;
|
||||
rust) cargo build --release ;;
|
||||
go) go build ./... ;;
|
||||
dotnet) dotnet restore && dotnet build --configuration Release ;;
|
||||
java) mvn install -DskipTests ;;
|
||||
php) composer install --no-interaction ;;
|
||||
ruby) bundle install ;;
|
||||
*) echo "Unknown language - skipping build" ;;
|
||||
esac
|
||||
|
||||
# Test
|
||||
- name: Run Tests
|
||||
run: |
|
||||
case "${{ needs.detect-project.outputs.lang }}" in
|
||||
node) npm test || true ;;
|
||||
python) pytest || true ;;
|
||||
rust) cargo test || true ;;
|
||||
go) go test ./... || true ;;
|
||||
dotnet) dotnet test --no-build --verbosity normal || true ;;
|
||||
java) mvn test || true ;;
|
||||
php) vendor/bin/phpunit || true ;;
|
||||
ruby) bundle exec rspec || true ;;
|
||||
*) echo "No tests configured" ;;
|
||||
esac
|
Loading…
Add table
Add a link
Reference in a new issue