ci: use a prebuilt image with every pipeline dependency
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.
This commit is contained in:
1 parent
d812e7644f
commit
4c6f1c8fe8
6 files changed
+103
-38
No files matched your search
+34
-33
@@ -10,29 +10,29 @@ on:
|
||||
|
||||
env:
|
||||
REGISTRY: gitea.tap-tap.win
|
||||
IMAGE_NAME: tap-tap/audiomanager
|
||||
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
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: "21"
|
||||
- name: Install ffmpeg and sqlite
|
||||
run: sudo apt-get update && sudo apt-get install -y ffmpeg sqlite3
|
||||
- name: Test
|
||||
run: ./gradlew test --console=plain
|
||||
run: gradle test --console=plain
|
||||
- name: Smoke test
|
||||
run: ./scripts/smoke.sh
|
||||
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
|
||||
- uses: azure/setup-helm@v4
|
||||
- name: Lint and render the chart
|
||||
run: |
|
||||
helm lint charts/musicmanager
|
||||
@@ -47,34 +47,35 @@ jobs:
|
||||
# The runner executes jobs in containers; expose its Docker daemon so the
|
||||
# image build works without a separate DinD service.
|
||||
container:
|
||||
image: catthehacker/ubuntu:act-latest
|
||||
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
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
- name: Log in to the registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ secrets.REGISTRY_USERNAME || gitea.actor }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD || secrets.GITEA_TOKEN }}
|
||||
- name: Image metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=tag
|
||||
type=sha
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
run: |
|
||||
echo "${{ secrets.REGISTRY_PASSWORD || secrets.GITEA_TOKEN }}" \
|
||||
| docker login "$REGISTRY" \
|
||||
--username "${{ secrets.REGISTRY_USERNAME || gitea.actor }}" \
|
||||
--password-stdin
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
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
|
||||
Reference in new issue
Block a user