Dev #63
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: Dev | |
| on: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| docker-build: | |
| if: github.repository == 'devlikeapro/waha-plus' | |
| runs-on: ${{ matrix.runner }} | |
| name: | |
| ${{ matrix.engine }} - ${{ matrix.browser }} - ${{ matrix.platform }} - | |
| ${{ matrix.tag }} | |
| strategy: | |
| matrix: | |
| include: | |
| - runner: 'buildjet-4vcpu-ubuntu-2204' | |
| tag: 'dev' | |
| platform: 'amd64' | |
| browser: 'chromium' | |
| engine: 'WEBJS' | |
| goss: 'goss-linux-amd64' | |
| - runner: 'buildjet-4vcpu-ubuntu-2204-arm' | |
| tag: 'dev-arm' | |
| platform: 'linux/arm64' | |
| browser: 'chromium' | |
| engine: 'WEBJS' | |
| goss: 'goss-linux-arm' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check recent changes | |
| id: recent | |
| run: | | |
| count=$(git rev-list --after="24 hours ago" --count HEAD || true) | |
| if [ "$count" -gt 0 ]; then | |
| echo "has_recent=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "has_recent=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: No recent changes summary | |
| if: ${{ steps.recent.outputs.has_recent != 'true' }} | |
| run: | |
| echo "No commits in the last 24 hours; skipping build." >> | |
| "$GITHUB_STEP_SUMMARY" | |
| - name: Set up Docker Buildx | |
| if: ${{ steps.recent.outputs.has_recent == 'true' }} | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Docker meta | |
| if: ${{ steps.recent.outputs.has_recent == 'true' }} | |
| id: meta | |
| uses: docker/metadata-action@v4 | |
| with: | |
| images: ${{ vars.DOCKER_IMAGE }} | |
| flavor: latest=false | |
| tags: | | |
| type=raw,value=${{ matrix.tag }} | |
| - name: Login to image repository | |
| if: ${{ steps.recent.outputs.has_recent == 'true' }} | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKER_USER }} | |
| password: ${{ secrets.DOCKER_TOKEN }} | |
| - name: Build | |
| if: ${{ steps.recent.outputs.has_recent == 'true' }} | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: . | |
| file: Dockerfile | |
| platforms: ${{ matrix.platform }} | |
| build-args: | | |
| USE_BROWSER=${{ matrix.browser }} | |
| WHATSAPP_DEFAULT_ENGINE=${{ matrix.engine }} | |
| push: false | |
| load: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| - name: Install goss | |
| if: ${{ steps.recent.outputs.has_recent == 'true' }} | |
| env: | |
| GOSS_DOWNLOAD: 'https://github.com/goss-org/goss/releases/download' | |
| GOSS_VERSION: 'v0.4.8' | |
| run: | | |
| curl -L https://github.com/goss-org/goss/releases/download/${{ env.GOSS_VERSION }}/${{ matrix.goss }} -o /usr/local/bin/goss | |
| chmod +rx /usr/local/bin/goss | |
| - name: Run smoke tests | |
| if: ${{ steps.recent.outputs.has_recent == 'true' }} | |
| working-directory: tests/smoke | |
| timeout-minutes: 2 | |
| run: | | |
| docker run -d \ | |
| --name smoke \ | |
| --rm -p3000:3000 \ | |
| -e WAHA_API_KEY=test \ | |
| ${{ vars.DOCKER_IMAGE }}:${{ matrix.tag }} | |
| sleep 3 | |
| docker logs smoke | |
| goss validate --retry-timeout 30s --sleep 1s | |
| docker rm --force smoke | |
| - name: Push | |
| if: ${{ steps.recent.outputs.has_recent == 'true' }} | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: . | |
| file: Dockerfile | |
| platforms: ${{ matrix.platform }} | |
| build-args: | | |
| USE_BROWSER=${{ matrix.browser }} | |
| WHATSAPP_DEFAULT_ENGINE=${{ matrix.engine }} | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} |