2019-12-24 04:00:08 +08:00
|
|
|
name: docker-buildx
|
2019-12-21 02:12:34 +08:00
|
|
|
on:
|
|
|
|
pull_request:
|
2021-05-13 16:01:52 +08:00
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
- experimental
|
2019-12-21 02:12:34 +08:00
|
|
|
push:
|
2021-05-13 16:01:52 +08:00
|
|
|
branches:
|
2022-02-07 23:38:37 +08:00
|
|
|
- '**'
|
2019-12-30 07:43:52 +08:00
|
|
|
tags:
|
2019-12-30 07:50:47 +08:00
|
|
|
- '*.*'
|
2019-12-21 02:12:34 +08:00
|
|
|
|
|
|
|
jobs:
|
2020-01-09 05:44:47 +08:00
|
|
|
test:
|
|
|
|
runs-on: ubuntu-latest
|
2020-09-06 20:58:02 +08:00
|
|
|
|
2020-01-09 05:44:47 +08:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-11-30 04:52:26 +08:00
|
|
|
node-version: [18.x]
|
2020-09-06 20:58:02 +08:00
|
|
|
|
2020-01-29 20:15:02 +08:00
|
|
|
services:
|
|
|
|
mariadb:
|
2023-06-22 06:32:58 +08:00
|
|
|
image: mariadb:lts
|
2020-01-29 20:15:02 +08:00
|
|
|
ports:
|
2020-01-29 23:15:39 +08:00
|
|
|
- 3306
|
2020-01-29 20:15:02 +08:00
|
|
|
env:
|
|
|
|
MYSQL_USER: user
|
|
|
|
MYSQL_PASSWORD: password
|
2020-01-30 06:02:07 +08:00
|
|
|
MYSQL_DATABASE: pigallery_test
|
2020-01-29 20:15:02 +08:00
|
|
|
MYSQL_ROOT_PASSWORD: password
|
|
|
|
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
|
|
|
|
|
2020-01-09 05:44:47 +08:00
|
|
|
|
|
|
|
steps:
|
2024-04-16 03:46:03 +08:00
|
|
|
- uses: actions/checkout@v4
|
2020-01-09 05:44:47 +08:00
|
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
2024-04-16 03:46:03 +08:00
|
|
|
uses: actions/setup-node@v4
|
2020-01-09 05:44:47 +08:00
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node-version }}
|
2020-09-06 20:58:02 +08:00
|
|
|
|
2020-01-29 20:15:02 +08:00
|
|
|
- name: Verify MariaDB connection
|
|
|
|
env:
|
|
|
|
PORT: ${{ job.services.mariadb.ports[3306] }}
|
|
|
|
run: |
|
|
|
|
while ! mysqladmin ping -h"127.0.0.1" -P"$PORT" --silent; do
|
|
|
|
sleep 1
|
2020-09-06 20:58:02 +08:00
|
|
|
done
|
|
|
|
|
2021-05-16 13:46:26 +08:00
|
|
|
- name: npm install and build
|
2020-01-09 05:44:47 +08:00
|
|
|
run: |
|
|
|
|
npm ci
|
2021-05-16 13:46:26 +08:00
|
|
|
npm run build
|
|
|
|
|
2022-04-26 00:09:06 +08:00
|
|
|
- name: lint
|
2021-05-16 13:46:26 +08:00
|
|
|
run: |
|
|
|
|
npm run lint
|
|
|
|
- name: test
|
|
|
|
run: |
|
2020-01-09 05:44:47 +08:00
|
|
|
npm test
|
2023-10-12 06:09:17 +08:00
|
|
|
npm run coverage
|
2020-01-09 05:44:47 +08:00
|
|
|
env:
|
2020-01-29 20:15:02 +08:00
|
|
|
MYSQL_HOST: localhost
|
2020-01-30 06:14:46 +08:00
|
|
|
MYSQL_USERNAME: root
|
2020-01-29 20:15:02 +08:00
|
|
|
MYSQL_PASSWORD: password
|
2020-01-29 23:15:39 +08:00
|
|
|
MYSQL_PORT: ${{ job.services.mariadb.ports[3306] }}
|
2020-01-29 19:29:25 +08:00
|
|
|
PORT: 35000
|
2020-01-09 05:44:47 +08:00
|
|
|
CI: true
|
2023-10-12 06:09:17 +08:00
|
|
|
- name: Coveralls
|
|
|
|
uses: coverallsapp/github-action@v2
|
2023-09-06 19:47:06 +08:00
|
|
|
- name: E2E test - Cypress run
|
2023-09-06 18:56:52 +08:00
|
|
|
uses: cypress-io/github-action@v6
|
2023-09-21 03:40:29 +08:00
|
|
|
env:
|
|
|
|
DEBUG: '@cypress/github-action'
|
2023-09-06 18:56:52 +08:00
|
|
|
with:
|
|
|
|
start: npm run start-e2e-server
|
2023-09-21 03:30:25 +08:00
|
|
|
# after the test run completes store screenshots
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
|
|
if: failure() # Store screenshots only on failures
|
|
|
|
with:
|
|
|
|
name: cypress-screenshots
|
|
|
|
path: test/cypress/screenshots
|
|
|
|
if-no-files-found: ignore # 'warn' or 'error' are also available, defaults to `warn`
|
2020-09-06 20:58:02 +08:00
|
|
|
|
2019-12-21 02:12:34 +08:00
|
|
|
create-release:
|
|
|
|
runs-on: [ubuntu-latest]
|
2024-04-18 02:20:51 +08:00
|
|
|
# needs: [test]
|
2019-12-21 02:12:34 +08:00
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2024-04-16 03:46:03 +08:00
|
|
|
uses: actions/checkout@v4
|
2019-12-21 03:44:15 +08:00
|
|
|
-
|
2019-12-21 02:12:34 +08:00
|
|
|
name: Setup Node.js for use with actions
|
2024-04-16 03:46:03 +08:00
|
|
|
uses: actions/setup-node@v4
|
2019-12-21 02:12:34 +08:00
|
|
|
with:
|
2022-11-30 04:52:26 +08:00
|
|
|
node-version: 18
|
2019-12-21 03:44:15 +08:00
|
|
|
-
|
2019-12-21 02:12:34 +08:00
|
|
|
name: Install Deps
|
|
|
|
run: npm install --unsafe-perm
|
|
|
|
-
|
|
|
|
name: Create Release
|
2022-01-15 18:39:25 +08:00
|
|
|
run: npm run create-release -- --skip-opt-packages=ffmpeg-static,ffprobe-static --force-opt-packages
|
2024-04-16 03:46:03 +08:00
|
|
|
- uses: actions/upload-artifact@v4
|
2019-12-21 02:12:34 +08:00
|
|
|
with:
|
|
|
|
name: pigallery2-release
|
|
|
|
path: release
|
2022-03-11 20:21:29 +08:00
|
|
|
build-dockerx:
|
2022-02-08 02:58:46 +08:00
|
|
|
runs-on: [ ubuntu-latest ]
|
|
|
|
needs: [ create-release ]
|
2021-05-10 05:27:17 +08:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-04-18 02:17:58 +08:00
|
|
|
container: [alpine, debian-buster, debian-bullseye, debian-bookworm ]
|
2022-03-12 06:26:21 +08:00
|
|
|
include:
|
|
|
|
- container: alpine
|
2023-01-07 20:33:19 +08:00
|
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
2022-03-12 06:26:21 +08:00
|
|
|
- container: debian-buster
|
|
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
|
|
|
- container: debian-bullseye
|
|
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
2024-04-18 02:17:58 +08:00
|
|
|
- container: debian-bookworm
|
|
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
2021-05-13 16:01:52 +08:00
|
|
|
|
2020-01-01 21:15:15 +08:00
|
|
|
steps:
|
2022-02-08 02:58:46 +08:00
|
|
|
- name: Checkout
|
2024-04-16 03:43:19 +08:00
|
|
|
uses: actions/checkout@v4
|
|
|
|
- uses: actions/download-artifact@v4
|
2020-01-01 21:15:15 +08:00
|
|
|
with:
|
2020-12-26 19:11:31 +08:00
|
|
|
name: pigallery2-release
|
|
|
|
path: pigallery2-release
|
2022-02-08 02:58:46 +08:00
|
|
|
- name: Set up QEMU
|
2024-04-16 03:43:19 +08:00
|
|
|
uses: docker/setup-qemu-action@v3
|
2022-02-08 02:58:46 +08:00
|
|
|
- name: Set up Docker Buildx
|
2024-04-16 03:43:19 +08:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2022-02-08 02:58:46 +08:00
|
|
|
- name: Login to DockerHub
|
2024-04-16 03:43:19 +08:00
|
|
|
uses: docker/login-action@v3
|
2020-12-25 22:31:59 +08:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
2020-12-26 19:11:31 +08:00
|
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
2022-03-11 03:35:32 +08:00
|
|
|
- name: Build docker
|
2024-04-16 03:43:19 +08:00
|
|
|
uses: docker/build-push-action@v5
|
2022-02-08 02:58:46 +08:00
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
file: docker/${{ matrix.container }}/Dockerfile.build
|
2022-03-12 07:02:11 +08:00
|
|
|
platforms: ${{ matrix.platforms }}
|
2022-03-11 03:35:32 +08:00
|
|
|
- name: Push experimental
|
2022-02-08 02:58:46 +08:00
|
|
|
if: ${{ github.ref == 'refs/heads/experimental' }}
|
2024-04-16 03:43:19 +08:00
|
|
|
uses: docker/build-push-action@v5
|
2022-02-08 02:58:46 +08:00
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
file: docker/${{ matrix.container }}/Dockerfile.build
|
2022-03-12 06:26:21 +08:00
|
|
|
platforms: ${{ matrix.platforms }}
|
2022-02-08 02:58:46 +08:00
|
|
|
push: true
|
|
|
|
tags: bpatrik/pigallery2:experimental-${{ matrix.container }}
|
2023-09-02 21:07:43 +08:00
|
|
|
- name: Push edge on new master commit
|
2023-08-03 15:20:29 +08:00
|
|
|
# github.ref: branches the format is refs/heads/<branch_name> PRs and Tags are different
|
2023-09-02 21:07:43 +08:00
|
|
|
if: ${{github.ref == 'refs/heads/master' }}
|
2024-04-16 03:43:19 +08:00
|
|
|
uses: docker/build-push-action@v5
|
2022-02-08 02:58:46 +08:00
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
file: docker/${{ matrix.container }}/Dockerfile.build
|
2022-03-12 06:26:21 +08:00
|
|
|
platforms: ${{ matrix.platforms }}
|
2022-02-08 02:58:46 +08:00
|
|
|
push: true
|
2023-09-02 21:20:28 +08:00
|
|
|
tags: bpatrik/pigallery2:edge-${{ matrix.container }}
|
2022-03-11 03:35:32 +08:00
|
|
|
- name: Push release on new Tag
|
2024-04-18 02:17:58 +08:00
|
|
|
if: ${{ startsWith(github.ref_type , 'tag') && !github.event.issue.pull_request && matrix.container != 'debian-bookworm'}}
|
2024-04-16 03:43:19 +08:00
|
|
|
uses: docker/build-push-action@v5
|
2022-02-08 02:58:46 +08:00
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
file: docker/${{ matrix.container }}/Dockerfile.build
|
2022-03-12 06:26:21 +08:00
|
|
|
platforms: ${{ matrix.platforms }}
|
2022-02-08 02:58:46 +08:00
|
|
|
push: true
|
|
|
|
tags: |
|
2023-09-02 21:07:43 +08:00
|
|
|
bpatrik/pigallery2:edge-${{ matrix.container }}
|
2023-08-03 15:20:29 +08:00
|
|
|
bpatrik/pigallery2:${{ github.ref_name }}-${{ matrix.container }}
|
2022-03-11 20:30:04 +08:00
|
|
|
bpatrik/pigallery2:latest-${{ matrix.container }}
|
|
|
|
- name: Push latest on new Tag
|
2024-04-18 02:17:58 +08:00
|
|
|
if: ${{ startsWith(github.ref_type, 'tag') && !github.event.issue.pull_request && matrix.container == 'debian-bookworm'}}
|
2024-04-16 03:43:19 +08:00
|
|
|
uses: docker/build-push-action@v5
|
2020-12-25 22:31:59 +08:00
|
|
|
with:
|
|
|
|
context: .
|
2021-05-10 05:27:17 +08:00
|
|
|
file: docker/${{ matrix.container }}/Dockerfile.build
|
2022-03-12 06:26:21 +08:00
|
|
|
platforms: ${{ matrix.platforms }}
|
2020-12-26 19:11:31 +08:00
|
|
|
push: true
|
|
|
|
tags: |
|
2023-09-02 21:07:43 +08:00
|
|
|
bpatrik/pigallery2:edge-${{ matrix.container }}
|
2023-08-03 15:20:29 +08:00
|
|
|
bpatrik/pigallery2:${{ github.ref_name }}-${{ matrix.container }}
|
2022-03-13 04:39:22 +08:00
|
|
|
bpatrik/pigallery2:latest-${{ matrix.container }}
|
2023-08-03 15:20:29 +08:00
|
|
|
bpatrik/pigallery2:${{ github.ref_name }}
|
2022-02-08 02:58:46 +08:00
|
|
|
bpatrik/pigallery2:latest
|