1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2024-12-23 01:27:14 +02:00
pigallery2/.github/workflows/build.yml

187 lines
5.8 KiB
YAML
Raw Normal View History

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