Add ci/Dockerfile (JDK 21, Gradle 8.14.3, ffmpeg, sqlite3, node, docker CLI and Helm) and build it as taptap/audiomanager-ci. Workflows now start from that image instead of downloading a JDK and installing packages on every run. The registry namespace is the lowercased package owner `taptap`, not `tap-tap`; update the chart, workflow and documentation accordingly. The image build uses plain docker build/push, since the job container starts with no buildx plugin.
82 lines
2.2 KiB
YAML
82 lines
2.2 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- "v*"
|
|
pull_request:
|
|
|
|
env:
|
|
REGISTRY: gitea.tap-tap.win
|
|
IMAGE_NAME: taptap/audiomanager
|
|
# Built by scripts/build-ci-image.sh from ci/Dockerfile. Bump the tag when
|
|
# ci/Dockerfile changes.
|
|
CI_IMAGE: gitea.tap-tap.win/taptap/audiomanager-ci:1
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: gitea.tap-tap.win/taptap/audiomanager-ci:1
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Test
|
|
run: gradle test --console=plain
|
|
- name: Smoke test
|
|
run: GRADLE=gradle ./scripts/smoke.sh
|
|
|
|
chart:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: gitea.tap-tap.win/taptap/audiomanager-ci:1
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Lint and render the chart
|
|
run: |
|
|
helm lint charts/musicmanager
|
|
helm template musicmanager charts/musicmanager --set users.existingSecret=test > /dev/null
|
|
|
|
image:
|
|
needs:
|
|
- test
|
|
- chart
|
|
if: github.event_name == 'push'
|
|
runs-on: ubuntu-latest
|
|
# The runner executes jobs in containers; expose its Docker daemon so the
|
|
# image build works without a separate DinD service.
|
|
container:
|
|
image: gitea.tap-tap.win/taptap/audiomanager-ci:1
|
|
options: --volume /var/run/docker.sock:/var/run/docker.sock
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Log in to the registry
|
|
run: |
|
|
echo "${{ secrets.REGISTRY_PASSWORD || secrets.GITEA_TOKEN }}" \
|
|
| docker login "$REGISTRY" \
|
|
--username "${{ secrets.REGISTRY_USERNAME || gitea.actor }}" \
|
|
--password-stdin
|
|
- name: Build and push
|
|
run: |
|
|
set -euo pipefail
|
|
tags=("$REGISTRY/$IMAGE_NAME:sha-${GITHUB_SHA::7}")
|
|
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
|
|
tags+=("$REGISTRY/$IMAGE_NAME:${GITHUB_REF_NAME}")
|
|
else
|
|
tags+=("$REGISTRY/$IMAGE_NAME:latest")
|
|
fi
|
|
|
|
build_args=()
|
|
for tag in "${tags[@]}"; do
|
|
build_args+=(-t "$tag")
|
|
done
|
|
|
|
docker build "${build_args[@]}" .
|
|
for tag in "${tags[@]}"; do
|
|
docker push "$tag"
|
|
done
|