-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (64 loc) · 2.35 KB
/
sync-and-analyze.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Sync and Analyze
on:
push:
branches:
- main
workflow_dispatch:
jobs:
sync-and-scan:
permissions:
contents: read
security-events: write
actions: read
runs-on: ubuntu-latest
steps:
- name: Checkout source repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PERSONAL_TOKEN }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.2"
extensions: xdebug
coverage: xdebug
- name: Install Dependencies
run: composer install --no-interaction --no-progress
- name: Run test suite with coverage
run: vendor/bin/phpunit --coverage-clover coverage.xml
- name: Fix code coverage paths
run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace@g' coverage.xml
- name: Sync repositories
run: |
git config --global user.name 'JosueUPT'
git config --global user.email '${{ secrets.GIT_EMAIL }}'
git add composer.lock
git commit -m "Update composer.lock" || echo "No changes to commit"
git push || echo "No changes to push"
git clone https://${{ secrets.PERSONAL_TOKEN }}@github.com/JosueUPT/CalidadU2.git ../CalidadU2
rsync -av --exclude='.git' --exclude='.github/workflows/sync-and-analyze.yml' --exclude='temp_repo' ./ ../CalidadU2/
cd ../CalidadU2
git add .
git commit -m "Sync: Update from source repository" || echo "No changes to commit"
git push origin main || echo "No changes to push"
cd ..
- name: Run Semgrep Security Scan
uses: semgrep/semgrep-action@v1
env:
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
SEMGREP_DEPLOYMENT_ID: "pyfange"
SEMGREP_REPO_NAME: ${{ github.repository }}
SEMGREP_BRANCH: ${{ github.ref_name }}
with:
publishToken: ${{ secrets.SEMGREP_APP_TOKEN }}
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Install Snyk CLI
run: |
curl https://static.snyk.io/cli/latest/snyk-linux -o snyk
chmod +x snyk
sudo mv snyk /usr/local/bin/