macOS + Safari + NodeJS + DB #49
This file contains hidden or 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: Compatibility testing | |
| run-name: macOS + Safari + NodeJS + DB | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| test-safari: | |
| runs-on: macos-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| node: [14, 18, 20] | |
| database: [postgresql, mysql, mongodb] | |
| browser: [safari] | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v4 | |
| with: | |
| path: mainrepo | |
| - name: Checkout Wiki.js source | |
| working-directory: mainrepo | |
| run: | | |
| wget https://github.com/Requarks/wiki/releases/latest/download/wiki-js.tar.gz | |
| mkdir wikijs | |
| tar xzf wiki-js.tar.gz -C ./wikijs | |
| cd wikijs | |
| mv config.sample.yml config.yml | |
| - name: Setup Node.js ${{ matrix.node }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| # --- Setup Database --- | |
| - name: Setup Database | |
| run: | | |
| if [ "${{ matrix.database }}" = "mysql" ]; then | |
| brew install mysql | |
| brew services start mysql | |
| sleep 15 | |
| mysql -uroot -e "DROP DATABASE IF EXISTS wiki;" | |
| mysql -uroot -e "CREATE DATABASE wiki;" | |
| mysql -uroot -e "DROP USER IF EXISTS 'wikijs'@'localhost';" | |
| mysql -uroot -e "CREATE USER 'wikijs'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'wikijsrocks';" | |
| mysql -uroot -e "GRANT ALL PRIVILEGES ON wiki.* TO 'wikijs'@'localhost';" | |
| mysql -uroot -e "FLUSH PRIVILEGES;" | |
| echo "DB_TYPE=mysql" >> $GITHUB_ENV | |
| echo "DB_HOST=127.0.0.1" >> $GITHUB_ENV | |
| echo "DB_PORT=3306" >> $GITHUB_ENV | |
| echo "DB_USER=wikijs" >> $GITHUB_ENV | |
| echo "DB_PASS=wikijsrocks" >> $GITHUB_ENV | |
| echo "DB_NAME=wiki" >> $GITHUB_ENV | |
| elif [ "${{ matrix.database }}" = "postgresql" ]; then | |
| brew install postgresql | |
| brew services start postgresql | |
| sleep 15 | |
| createdb wiki | |
| psql -d postgres -c "DROP ROLE IF EXISTS wikijs;" | |
| psql -d postgres -c "CREATE ROLE wikijs WITH LOGIN PASSWORD 'wikijsrocks';" | |
| psql -d postgres -c "GRANT ALL PRIVILEGES ON DATABASE wiki TO wikijs;" | |
| echo "DB_TYPE=postgres" >> $GITHUB_ENV | |
| echo "DB_HOST=127.0.0.1" >> $GITHUB_ENV | |
| echo "DB_PORT=5432" >> $GITHUB_ENV | |
| echo "DB_USER=wikijs" >> $GITHUB_ENV | |
| echo "DB_PASS=wikijsrocks" >> $GITHUB_ENV | |
| echo "DB_NAME=wiki" >> $GITHUB_ENV | |
| elif [ "${{ matrix.database }}" = "mongodb" ]; then | |
| brew tap mongodb/brew | |
| brew install mongodb-community@6.0 | |
| brew services start mongodb-community@6.0 | |
| sleep 15 | |
| echo "DB_TYPE=mongodb" >> $GITHUB_ENV | |
| echo "DB_HOST=127.0.0.1" >> $GITHUB_ENV | |
| echo "DB_PORT=27017" >> $GITHUB_ENV | |
| echo "DB_NAME=wiki" >> $GITHUB_ENV | |
| fi | |
| - name: Install dependencies | |
| working-directory: mainrepo/wikijs | |
| run: | | |
| npm install --no-audit --no-fund --legacy-peer-deps | |
| - name: Build Wiki.js | |
| working-directory: mainrepo/wikijs | |
| run: | | |
| echo "Building Wiki.js on Node ${{ matrix.node }} with DB ${{ matrix.database }} and Safari" | |
| npm rebuild sqlite3 | |
| - name: Start Wiki.js server | |
| working-directory: mainrepo/wikijs | |
| env: | |
| DB_TYPE: ${{ env.DB_TYPE }} | |
| DB_HOST: ${{ env.DB_HOST }} | |
| DB_PORT: ${{ env.DB_PORT }} | |
| DB_USER: ${{ env.DB_USER }} | |
| DB_PASS: ${{ env.DB_PASS }} | |
| DB_NAME: ${{ env.DB_NAME }} | |
| run: | | |
| nohup node server > server.log 2>&1 & | |
| npx wait-on tcp:127.0.0.1:3000 --timeout 60000 | |
| cat server.log | |
| - name: Install Playwright | |
| working-directory: mainrepo | |
| run: | | |
| npm install -D @playwright/test | |
| npx playwright install --with-deps | |
| - name: Run Playwright Tests (Safari/WebKit) | |
| working-directory: mainrepo | |
| run: | | |
| ls -l | |
| npx playwright test --config=playwright.config.ts --project=webkit |