96 lines
3.0 KiB
YAML
96 lines
3.0 KiB
YAML
name: Continuous Integration
|
|
'on':
|
|
push:
|
|
tags:
|
|
- '*'
|
|
branches:
|
|
- master
|
|
jobs:
|
|
mocha:
|
|
runs-on: apex-debian13
|
|
strategy:
|
|
matrix:
|
|
node-version:
|
|
- 22.x
|
|
pnpm-version:
|
|
- 9
|
|
steps:
|
|
- name: Check out the repo
|
|
uses: actions/checkout@v4
|
|
- run: |
|
|
case "$PNPM_VERSION" in 8|9|9.12.3) ;; *) exit 1;; esac
|
|
test -x "/opt/ci/pnpm/$PNPM_VERSION/bin/pnpm"
|
|
echo "/opt/ci/pnpm/$PNPM_VERSION/bin" >> "$GITHUB_PATH"
|
|
env:
|
|
PNPM_VERSION: ${{ matrix.pnpm-version }}
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
run: |
|
|
case "$NODE_VERSION" in
|
|
18*) major=18;; 20*) major=20;; 22*) major=22;; *) exit 1;;
|
|
esac
|
|
test -x "/opt/ci/node/$major/bin/node"
|
|
echo "/opt/ci/node/$major/bin" >> "$GITHUB_PATH"
|
|
env:
|
|
NODE_VERSION: ${{ matrix.node-version }}
|
|
- name: Install dependencies
|
|
run: pnpm install
|
|
- name: ESLint & Prettier
|
|
run: pnpm run lint
|
|
- name: Build
|
|
run: pnpm run build
|
|
- name: Test
|
|
run: pnpm run --if-present test
|
|
env:
|
|
npm_config_build_from_source: 'true'
|
|
docker:
|
|
runs-on: apex-debian13
|
|
needs: mocha
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
steps:
|
|
- name: Check out the repo
|
|
uses: actions/checkout@v4
|
|
- name: Stage verified yt-dlp asset
|
|
run: |
|
|
mkdir -p .ci/vendor
|
|
cp /opt/ci/assets/yt-dlp .ci/vendor/yt-dlp
|
|
- name: Set up QEMU
|
|
run: test -r /proc/sys/fs/binfmt_misc/qemu-aarch64
|
|
- name: Set up Docker Buildx
|
|
run: |
|
|
docker buildx version
|
|
docker buildx create --name apex-ci --driver docker-container --use
|
|
docker buildx inspect --bootstrap
|
|
- name: Log in to Gitea Container Registry
|
|
run: python3 .gitea/scripts/docker.py login
|
|
env:
|
|
REGISTRY: git.ermnvldmr.com
|
|
REGISTRY_USER: ${{ github.repository_owner }}
|
|
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
|
- name: Docker Generate Meta
|
|
id: meta
|
|
run: python3 .gitea/scripts/docker.py metadata
|
|
env:
|
|
IMAGES: git.ermnvldmr.com/deytenit/quetza
|
|
TAG_RULES: |
|
|
type=raw,value=latest,enable=${{ github.ref_type == 'tag' && !contains(github.ref_name, '-') }}
|
|
type=raw,value=latest-dev,enable=${{ github.ref_type == 'branch' && github.ref_name == 'master' }}
|
|
type=raw,value=${{ github.ref_name }}
|
|
type=raw,value=${{ github.sha }},enable=${{ github.ref_type == 'branch' }}
|
|
SOURCE_SHA: ${{ github.sha }}
|
|
- name: Build and Push Docker Image
|
|
run: python3 .gitea/scripts/docker.py build
|
|
env:
|
|
TAGS: ${{ steps.meta.outputs.tags }}
|
|
LABELS: ${{ steps.meta.outputs.labels }}
|
|
BUILD_ARGS: ''
|
|
DOCKERFILE: ''
|
|
PLATFORMS: linux/amd64,linux/arm64
|
|
PUSH: 'true'
|
|
CONTEXT: .
|
|
SOURCE_SHA: ${{ github.sha }}
|
|
RUN_ID: ${{ github.run_id }}
|
|
env:
|
|
npm_config_build_from_source: 'true'
|