|
| 1 | +name: Phyre Panel - Unit Test & Build |
| 2 | +on: [push] |
| 3 | +concurrency: |
| 4 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 5 | + cancel-in-progress: true |
| 6 | + |
| 7 | +jobs: |
| 8 | + phyre-panel-unit-test: |
| 9 | + strategy: |
| 10 | + matrix: |
| 11 | + os: [ubuntu-22.04, ubuntu-20.04] |
| 12 | + |
| 13 | + runs-on: ${{ matrix.os }} |
| 14 | + |
| 15 | + steps: |
| 16 | + - name: Checkout Repository |
| 17 | + uses: actions/checkout@v2 |
| 18 | + with: |
| 19 | + repository: ${{ github.repository }} |
| 20 | + ref: ${{ github.sha }} |
| 21 | + |
| 22 | + - name: Install Base |
| 23 | + run: | |
| 24 | + ls -la |
| 25 | + sudo mkdir /phyre-panel |
| 26 | + |
| 27 | + sudo cp installers/${{ matrix.os }}/install-partial/install_base.sh /phyre-panel/install_base.sh |
| 28 | + sudo chmod +x /phyre-panel/install_base.sh |
| 29 | + sudo /phyre-panel/install_base.sh |
| 30 | + |
| 31 | + sudo cp installers/${{ matrix.os }}/install-partial/install_web.sh /phyre-panel/install_web.sh |
| 32 | + sudo chmod +x /phyre-panel/install_web.sh |
| 33 | +
|
| 34 | + - name: Run Unit Test |
| 35 | + run: | |
| 36 | + |
| 37 | + sudo cp -r web /usr/local/phyre/web/ |
| 38 | + cd /usr/local/phyre/web/ |
| 39 | + ls -la |
| 40 | + |
| 41 | + sudo wget https://getcomposer.org/download/latest-stable/composer.phar |
| 42 | + sudo COMPOSER_ALLOW_SUPERUSER=1 phyre-php composer.phar install |
| 43 | + |
| 44 | + sudo /phyre-panel/install_web.sh |
| 45 | + sudo phyre-php artisan test |
| 46 | +
|
| 47 | + compile-phyre-web-panel: |
| 48 | + runs-on: ubuntu-22.04 |
| 49 | + needs: phyre-panel-unit-test |
| 50 | + steps: |
| 51 | + - uses: actions/checkout@v2 |
| 52 | + with: |
| 53 | + repository: ${{ github.repository }} |
| 54 | + - name: Npm install |
| 55 | + uses: actions/setup-node@v3 |
| 56 | + with: |
| 57 | + node-version: 16 |
| 58 | + |
| 59 | + - name: Setup PHP |
| 60 | + uses: shivammathur/setup-php@v2 |
| 61 | + with: |
| 62 | + php-version: 8.2 |
| 63 | + |
| 64 | + - name: Install Composer Dependencies |
| 65 | + working-directory: ./web |
| 66 | + run: | |
| 67 | + composer install |
| 68 | + composer dump-autoload |
| 69 | +
|
| 70 | + - name: Install NODE Dependencies |
| 71 | + working-directory: ./web |
| 72 | + run: | |
| 73 | + npm install |
| 74 | + npm run build |
| 75 | +
|
| 76 | + - name: Inject slug/short variables |
| 77 | + uses: rlespinasse/[email protected] |
| 78 | + |
| 79 | + - name: Zip the files |
| 80 | + working-directory: ./web |
| 81 | + run: | |
| 82 | + rm -rf .git |
| 83 | + rm -rf .github |
| 84 | + rm -rf .nmp |
| 85 | + rm -rf node_modules |
| 86 | + rm -rf .phpunit.cache |
| 87 | + rm -rf vendor/composer/tmp-*.zip |
| 88 | + find . \( -name ".git" -o -name ".gitignore" -o -name ".gitmodules" -o -name ".gitattributes" \) -exec rm -rf -- {} + |
| 89 | + zip -r phyre-web-panel-build.zip `ls -A` |
| 90 | + mkdir -p ../dist |
| 91 | + mv ./phyre-web-panel-build.zip ../dist/phyre-web-panel.zip |
| 92 | +
|
| 93 | + - name: Pushes to Phyre Panel Dist Repo |
| 94 | + uses: cpina/github-action-push-to-another-repository@main |
| 95 | + env: |
| 96 | + SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} |
| 97 | + API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} |
| 98 | + with: |
| 99 | + source-directory: './dist' |
| 100 | + destination-github-username: 'CloudVisionApps' |
| 101 | + destination-repository-name: 'PhyrePanelWebDist' |
| 102 | + |
| 103 | + target-branch: main |
0 commit comments