Release / WEBJS - chrome - amd64 - chrome (push) Waiting to run
Release / WEBJS - chromium - amd64 - latest (push) Waiting to run
Release / WEBJS - chromium - linux/arm64 - arm (push) Waiting to run
Release / GOWS - none - amd64 - gows (push) Waiting to run
Release / GOWS - none - linux/arm64 - gows-arm (push) Waiting to run
Release / NOWEB - none - amd64 - noweb (push) Waiting to run
Release / NOWEB - none - linux/arm64 - noweb-arm (push) Waiting to run
219 lines
6.4 KiB
YAML
219 lines
6.4 KiB
YAML
name: Dev
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 0 * * *'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
# unit-tests:
|
|
# if: github.repository == 'devlikeapro/waha-plus'
|
|
# runs-on: ubuntu-22.04
|
|
# name: Unit tests
|
|
# steps:
|
|
# - name: Checkout
|
|
# uses: actions/checkout@v4
|
|
# with:
|
|
# fetch-depth: 0
|
|
#
|
|
# - name: Set up Node
|
|
# uses: actions/setup-node@v4
|
|
# with:
|
|
# node-version: 22
|
|
#
|
|
# - name: Enable Corepack
|
|
# run: |
|
|
# corepack enable
|
|
# corepack prepare yarn@4.9.2 --activate
|
|
#
|
|
# - name: Install dependencies
|
|
# run: |
|
|
# unset GIT_CONFIG_PARAMETERS
|
|
# yarn install --immutable
|
|
#
|
|
# - name: Run unit tests
|
|
# run: yarn test:unit
|
|
|
|
docker-build:
|
|
if: github.repository == 'devlikeapro/waha-plus'
|
|
# needs: unit-tests
|
|
runs-on: ${{ matrix.runner }}
|
|
name:
|
|
${{ matrix.engine }} - ${{ matrix.browser }} - ${{ matrix.platform }} -
|
|
${{ matrix.tag }}
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
# Chromium - x86
|
|
- runner: 'ubuntu-latest'
|
|
tag: 'dev'
|
|
platform: 'amd64'
|
|
browser: 'chromium'
|
|
engine: 'WEBJS'
|
|
goss: 'goss-linux-amd64'
|
|
|
|
# Chrome - x86
|
|
- runner: 'ubuntu-latest'
|
|
tag: 'dev-chrome'
|
|
platform: 'amd64'
|
|
browser: 'chrome'
|
|
engine: 'WEBJS'
|
|
goss: 'goss-linux-amd64'
|
|
|
|
# Chromium - ARM
|
|
- runner: 'ubuntu-24.04-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 (attempt 1)
|
|
id: build1
|
|
if: ${{ steps.recent.outputs.has_recent == 'true' }}
|
|
continue-on-error: 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: Wait to retry build
|
|
if:
|
|
${{ steps.recent.outputs.has_recent == 'true' && steps.build1.outcome
|
|
== 'failure' }}
|
|
run: |
|
|
sleep 10
|
|
|
|
- name: Build (attempt 2)
|
|
id: build2
|
|
if:
|
|
${{ steps.recent.outputs.has_recent == 'true' && steps.build1.outcome
|
|
== 'failure' }}
|
|
continue-on-error: 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: Wait to retry build
|
|
if:
|
|
${{ steps.recent.outputs.has_recent == 'true' && steps.build2.outcome
|
|
== 'failure' }}
|
|
run: |
|
|
sleep 10
|
|
|
|
- name: Build (attempt 3)
|
|
if:
|
|
${{ steps.recent.outputs.has_recent == 'true' && steps.build2.outcome
|
|
== 'failure' }}
|
|
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 }}
|