name: Build and Release on: push: branches: [ master ] tags: - 'v*' pull_request: branches: [ master ] permissions: contents: write jobs: build: runs-on: ubuntu-latest strategy: matrix: node-version: ['lts/*'] steps: - uses: actions/checkout@v5 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v6 with: node-version: ${{ matrix.node-version }} - run: npm i -g grunt-cli - run: npm install - run: grunt e2e: runs-on: ubuntu-latest strategy: matrix: node-version: ['lts/*'] services: redis: image: redis:latest ports: - 6379:6379 options: >- --health-cmd "redis-cli ping" --health-interval 5s --health-timeout 3s --health-retries 5 steps: - uses: actions/checkout@v5 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v6 with: node-version: ${{ matrix.node-version }} - name: Install dependencies run: yarn install - name: Install Playwright run: | yarn add @playwright/test playwright npx playwright install --with-deps chromium - name: Seed test data run: | sudo apt-get install -y redis-tools redis-cli SET test:string "hello world" redis-cli HSET test:hash name Alice age 30 redis-cli RPUSH test:list item1 item2 item3 redis-cli SADD test:set red green blue redis-cli ZADD test:zset 1 alpha 2 beta 3 gamma - name: Start server and run E2E tests env: P3XR_URL: http://localhost:7843 run: | mkdir -p /tmp/p3xr-test cat > /tmp/p3xr-test/p3xrs.json <<'CONF' { "p3xrs": { "http": { "port": 7843, "bind": "0.0.0.0" }, "connections": { "home-dir": "/tmp/p3xr-test" }, "aiEnabled": true } } CONF cat > /tmp/p3xr-test/.p3xrs-conns.json <<'CONNS' { "list": [ { "name": "localhost", "host": "127.0.0.1", "port": 6379, "id": "test-connection-1" } ] } CONNS node bin/p3x-redis.mjs -c /tmp/p3xr-test/p3xrs.json & sleep 3 curl -sf http://localhost:7843/health npx playwright test - name: Upload test results if: always() uses: actions/upload-artifact@v5 with: name: playwright-report path: test-results/ retention-days: 7 deploy-image: if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - name: get-npm-version id: package-version uses: martinbeentjes/npm-get-version-action@v1.3.1 - name: Set up QEMU uses: docker/setup-qemu-action@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v4 - name: Login to Docker Hub uses: docker/login-action@v4 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push Docker image run: | echo "Using Dockerfile:" sed -n '1,20p' Dockerfile docker buildx build \ --file ./Dockerfile \ --pull \ --platform linux/amd64,linux/arm64 \ -t patrikx3/p3x-redis-ui:latest \ -t patrikx3/p3x-redis-ui:${{ steps.package-version.outputs.current-version }} \ . \ --push package-and-release-macos: if: startsWith(github.ref, 'refs/tags/v') runs-on: macos-latest steps: - uses: actions/checkout@v5 - name: Set up Node.js uses: actions/setup-node@v6 with: node-version: 'lts/*' - name: Install dependencies run: | yarn install rm -rf node_modules/cpu-features/ - name: Build and package macOS app run: npm run publish-macos - name: Upload macOS build to GitHub Release uses: softprops/action-gh-release@v2.5.0 with: tag_name: ${{ github.ref_name }} token: ${{ github.token }} fail_on_unmatched_files: true overwrite_files: true files: | dist/*.dmg dist/*.zip dist/*.blockmap dist/latest-mac.yml snap-arm64: if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-24.04-arm steps: - uses: actions/checkout@v5 - name: Set up Node.js uses: actions/setup-node@v6 with: node-version: 'lts/*' - name: Install dependencies run: | yarn install rm -rf node_modules/cpu-features/ || true - name: Update apt and install snapcraft run: | sudo apt-get update sudo snap install snapcraft --classic - name: Generate snap description run: node scripts/fix-packages-publish.js snap-description - name: Build arm64 snap env: SNAPCRAFT_BUILD_ENVIRONMENT: host run: npm run publish-electron-snap-arm64 - name: Upload arm64 snap to Snap Store env: SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} run: | cd dist snapcraft upload --release=stable p3x-redis-ui_*_arm64.snap package-and-release-windows: if: startsWith(github.ref, 'refs/tags/v') runs-on: windows-latest steps: - uses: actions/checkout@v5 - name: Set up Node.js uses: actions/setup-node@v6 with: node-version: 'lts/*' - name: Install dependencies run: | yarn install if (Test-Path "node_modules/cpu-features") { Remove-Item -Recurse -Force node_modules/cpu-features } shell: pwsh - name: Build and package Windows app run: npm run publish-windows env: GH_TOKEN: ${{ github.token }} GITHUB_TOKEN: ${{ github.token }} - name: Upload Windows build to GitHub Release uses: softprops/action-gh-release@v2.5.0 with: token: ${{ github.token }} fail_on_unmatched_files: true overwrite_files: true files: | dist/*.exe dist/*.blockmap dist/latest.yml