Skip to content

Build

Build #274

Workflow file for this run

name: Build
on:
workflow_dispatch: # Allow for manual trigger!
push:
branches:
- $default-branch,
- '**pipeline'
pull_request:
branches:
- '**'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 18.x, 20.x ]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Copy original Frontend
run: cp -r js js_bac
- name: Build Frontend Production
run: |
make npm-init
make build-js-production
- name: Make sure production is commited
run: |
diff -rq js js_bac
if [ $? -eq 1 ];then
echo "Build files differ! Rebuild frontend with make build-js-production and submit changes!"
exit 1
fi
deploy:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [ 8.0, 8.1, 8.2, 8.3 ]
nextcloud-version-branch: [ stable25, stable26, stable27, stable28 ] # see https://github.com/nextcloud/server/branches
exclude:
- php-version: 8.2
nextcloud-version-branch: stable25
- php-version: 8.3
nextcloud-version-branch: stable25
- php-version: 8.3
nextcloud-version-branch: stable26
- php-version: 8.0
nextcloud-version-branch: stable27
- php-version: 8.3
nextcloud-version-branch: stable27
- php-version: 8.0
nextcloud-version-branch: stable28
name: Deploy b2sharebridge-app in a NC environment
needs: build
env:
DB_DATABASE: oc_autotest
DB_ROOT: root
steps:
- name: Setup MySQL
run: |
sudo /etc/init.d/mysql start
mysql -u${{ env.DB_ROOT }} -p${{ env.DB_ROOT }} -e 'CREATE DATABASE ${{ env.DB_DATABASE }};'
mysql -u${{ env.DB_ROOT }} -p${{ env.DB_ROOT }} -e "CREATE USER 'oc_autotest'@'localhost' IDENTIFIED BY '';"
mysql -u${{ env.DB_ROOT }} -p${{ env.DB_ROOT }} -e "grant all on oc_autotest.* to 'oc_autotest'@'localhost';"
- uses: actions/checkout@v3
name: Checkout Nextcloud ${{matrix.nextcloud-version-branch}}
with:
repository: nextcloud/server
ref: ${{matrix.nextcloud-version-branch}}
fetch-depth: 1
submodules: true # 'Composer autoloader' is required in order to run the code check
- uses: actions/checkout@v3
name: Add b2sharebridge to nextcloud
with:
path: apps/b2sharebridge
- name: Install PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
- name: Configure NC
run: |
mkdir data
./occ maintenance:install --database-name $DB_DATABASE --database-user oc_autotest --admin-user admin --admin-pass admin --database mysql --database-pass=''
./occ app:enable b2sharebridge
- name: Install dev dependencies with Composer
run: |
cd apps/b2sharebridge
make composer
- name: Unit Tests
run: |
cd apps/b2sharebridge
make test-unit
- name: Integration Tests
run: |
cd apps/b2sharebridge
make test-integration
- name: Test Background Job
if: ${{ matrix.nextcloud-version-branch != 'stable22' }} # https://github.com/actions/runner/issues/1173 # 'background-job'-cmd is only available since nc23
run: |
mysql -u${{ env.DB_ROOT }} -p${{ env.DB_ROOT }} -e "INSERT INTO oc_b2sharebridge_server (name, publish_url) VALUES ('B2SHARE Test Server', 'https://trng-b2share.eudat.eu')" ${{ env.DB_DATABASE }}
job_id=`mysql -u${{ env.DB_ROOT }} -p${{ env.DB_ROOT }} -s -N -e "SELECT id FROM oc_jobs WHERE class LIKE '%B2shareCommunityFetcher'" ${{ env.DB_DATABASE }}`
./occ background-job:execute $job_id
num_communities=`mysql -u${{ env.DB_ROOT }} -p${{ env.DB_ROOT }} -s -N -e "SELECT COUNT(1) FROM oc_b2sharebridge_communities" ${{ env.DB_DATABASE }}`
echo "$num_communities communities fetched!"
exit $(($num_communities == 0))
- name: Style checking
run: |
cd apps/b2sharebridge
make npm-init
make stylelint
- name: Fix Style Lint
run: |
cd apps/b2sharebridge
make stylelint-fix
- name: Js Lint checking
continue-on-error: true
run: |
cd apps/b2sharebridge
make lint
- name: Fix Js Lint
continue-on-error: true
run: |
cd apps/b2sharebridge
make lint-fix
- name: Php Lint checking
continue-on-error: true
run: |
cd apps/b2sharebridge
make phplint
- name: Fix Php Lint
run: |
cd apps/b2sharebridge
make phplint-fix