Merge remote-tracking branch 'origin/main' into v2.2 #1428
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Froxlor-CI-MariaDB | |
on: [ 'push', 'pull_request', 'create' ] | |
jobs: | |
froxlor: | |
name: Froxlor (PHP ${{ matrix.php-versions }}, MariaDB ${{ matrix.mariadb-version }}) | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
php-versions: [ '7.4', '8.2' ] | |
mariadb-version: [ 10.11, 10.5 ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup PHP, with composer and extensions | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
tools: composer:v2 | |
extensions: mbstring, xml, ctype, pdo_mysql, mysql, curl, json, zip, session, filter, posix, openssl, fileinfo, bcmath, gmp, gnupg | |
- name: Install tools | |
run: sudo apt-get install -y ant | |
- name: Adjust firewall | |
run: | | |
sudo ufw allow out 3306/tcp | |
sudo ufw allow in 3306/tcp | |
- name: Setup MariaDB | |
uses: getong/[email protected] | |
with: | |
mariadb version: ${{ matrix.mariadb-version }} | |
mysql database: 'froxlor010' | |
mysql root password: 'fr0xl0r.TravisCI' | |
- name: Wait for database | |
run: sleep 15 | |
- name: Setup databases | |
run: | | |
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI -e "CREATE USER 'froxlor010'@'%' IDENTIFIED BY 'fr0xl0r.TravisCI';" | |
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI -e "GRANT ALL ON froxlor010.* TO 'froxlor010'@'%';" | |
php -r "echo include('install/froxlor.sql.php');" > /tmp/froxlor.sql | |
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI froxlor010 < /tmp/froxlor.sql | |
- name: Run testing | |
run: ant quick-build | |
nightly: | |
name: Create nightly/testing tarball | |
runs-on: ubuntu-latest | |
needs: froxlor | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup PHP with PECL extension | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '7.4' | |
tools: composer:v2 | |
extensions: mbstring, xml, ctype, pdo_mysql, mysql, curl, json, zip, session, filter, posix, openssl, fileinfo, bcmath, gmp, gnupg | |
- name: Install composer dependencies | |
run: composer install --no-dev | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- name: Install npm dependencies | |
run: npm install | |
- name: Build assets | |
run: npm run build | |
working-directory: . | |
- name: Setting file/directory permissions | |
run: | | |
find -exec chmod ugo+r,u+w,go-w {} \; | |
find -type f -exec chmod ugo-x {} \; | |
find -type d -exec chmod ugo+x {} \; | |
chmod 0755 bin/froxlor-cli | |
- name: Remove vcs and unneeded files | |
run: | | |
rm .gitignore | |
rm .editorconfig | |
rm -rf node_modules | |
rm composer.json | |
rm composer.lock | |
rm package.json | |
rm package-lock.json | |
rm *.xml | |
rm vite.config.js | |
- name: Create empty index.html in built assets directory | |
run: | | |
touch templates/Froxlor/build/index.html | |
touch templates/Froxlor/build/assets/index.html | |
- name: Set outputs | |
id: vars | |
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Set nightly branding | |
run: | | |
sed -i "s/const BRANDING = '';/const BRANDING = '+nightly.${{steps.vars.outputs.sha_short}}';/" lib/Froxlor/Froxlor.php | |
zip -r froxlor-nightly.${{steps.vars.outputs.sha_short}}.zip . -x "*.git*" | |
sha256sum froxlor-nightly.${{steps.vars.outputs.sha_short}}.zip > froxlor-nightly.${{steps.vars.outputs.sha_short}}.zip.sha256 | |
mkdir dist | |
mv froxlor-nightly.${{steps.vars.outputs.sha_short}}.zip dist/ | |
mv froxlor-nightly.${{steps.vars.outputs.sha_short}}.zip.sha256 dist/ | |
- name: Deploy nightly to server | |
uses: easingthemes/ssh-deploy@main | |
env: | |
ARGS: "-rltDzvO --chown=${{ secrets.WEB_USER }}:${{ secrets.WEB_USER }}" | |
SOURCE: "dist/" | |
SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_KEY }} | |
REMOTE_HOST: ${{ secrets.REMOTE_HOST }} | |
REMOTE_USER: ${{ secrets.REMOTE_USER }} | |
TARGET: "${{ secrets.REMOTE_TARGET }}" |