chore: remove CI/CD workflow
This commit is contained in:
@@ -1,86 +0,0 @@
|
|||||||
name: Docker test deployment
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
deploy_port:
|
|
||||||
description: Public host port for the test API
|
|
||||||
required: false
|
|
||||||
default: '18080'
|
|
||||||
public_base_url:
|
|
||||||
description: Public HTTP URL, such as http://SERVER_IP:18080
|
|
||||||
required: false
|
|
||||||
default: ''
|
|
||||||
concurrency:
|
|
||||||
group: adcloud-server-test
|
|
||||||
cancel-in-progress: false
|
|
||||||
jobs:
|
|
||||||
test-build-deploy:
|
|
||||||
if: gitea.ref == 'refs/heads/main'
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container:
|
|
||||||
image: docker:27-cli
|
|
||||||
timeout-minutes: 30
|
|
||||||
env:
|
|
||||||
SOURCE_SERVER: ${{ gitea.server_url }}
|
|
||||||
SOURCE_REPOSITORY: ${{ gitea.repository }}
|
|
||||||
SOURCE_REVISION: ${{ gitea.sha }}
|
|
||||||
DEPLOY_PORT: ${{ inputs.deploy_port || vars.ADCLOUD_DEPLOY_PORT || '18080' }}
|
|
||||||
PUBLIC_BASE_URL: ${{ inputs.public_base_url || vars.ADCLOUD_PUBLIC_BASE_URL || 'http://47.76.92.159:18080' }}
|
|
||||||
steps:
|
|
||||||
- name: Check Docker daemon and tools
|
|
||||||
run: |
|
|
||||||
set -eu
|
|
||||||
apk add --no-cache python3 bash curl
|
|
||||||
if ! docker info --format 'Docker daemon: {{.Name}}; OS: {{.OperatingSystem}}; version: {{.ServerVersion}}'; then
|
|
||||||
echo 'Runner job cannot reach Docker. Set runner container.docker_host to the host socket and restart runner.'
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
docker version --format 'Client={{.Client.Version}} Server={{.Server.Version}}'
|
|
||||||
- name: Fetch the exact repository revision
|
|
||||||
env:
|
|
||||||
SOURCE_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
||||||
run: |
|
|
||||||
python3 - <<'PY'
|
|
||||||
import io, os, shutil, tarfile, tempfile, urllib.request
|
|
||||||
from pathlib import Path
|
|
||||||
server = os.environ['SOURCE_SERVER'].rstrip('/')
|
|
||||||
repo = os.environ['SOURCE_REPOSITORY']
|
|
||||||
revision = os.environ['SOURCE_REVISION']
|
|
||||||
request = urllib.request.Request(server + '/api/v1/repos/' + repo + '/archive/' + revision + '.tar.gz', headers={'Authorization': 'token ' + os.environ['SOURCE_TOKEN']})
|
|
||||||
with urllib.request.urlopen(request, timeout=60) as response:
|
|
||||||
data = response.read()
|
|
||||||
with tempfile.TemporaryDirectory() as directory:
|
|
||||||
with tarfile.open(fileobj=io.BytesIO(data), mode='r:gz') as archive:
|
|
||||||
archive.extractall(directory, filter='data')
|
|
||||||
roots = list(Path(directory).iterdir())
|
|
||||||
if len(roots) != 1 or not roots[0].is_dir():
|
|
||||||
raise RuntimeError('Unexpected repository archive structure')
|
|
||||||
shutil.copytree(roots[0], Path.cwd(), dirs_exist_ok=True)
|
|
||||||
print('Checked out exact commit:', revision)
|
|
||||||
PY
|
|
||||||
- name: Build and run the test image
|
|
||||||
run: |
|
|
||||||
set -eu
|
|
||||||
docker build --target test --tag "adcloud-server-ci:$SOURCE_REVISION-test" .
|
|
||||||
docker run --rm "adcloud-server-ci:$SOURCE_REVISION-test"
|
|
||||||
- name: Build the runtime image
|
|
||||||
run: |
|
|
||||||
docker build --target runtime --tag "adcloud-server-ci:$SOURCE_REVISION" --label "org.opencontainers.image.revision=$SOURCE_REVISION" .
|
|
||||||
- name: Test PostgreSQL and Cassandra integration
|
|
||||||
run: |
|
|
||||||
export DEPLOY_IMAGE="adcloud-server-ci:$SOURCE_REVISION"
|
|
||||||
export TEST_IMAGE="adcloud-server-ci:$SOURCE_REVISION-test"
|
|
||||||
export CI_STACK_NAME="adcloud-ci-$(printf '%s' "$SOURCE_REVISION" | cut -c1-12)-${{ gitea.run_id }}"
|
|
||||||
bash scripts/compose_stack.sh ci
|
|
||||||
- name: Stop the retired persistent test stack
|
|
||||||
if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/main'
|
|
||||||
run: |
|
|
||||||
set -eu
|
|
||||||
stack_ids="$(docker ps -aq --filter label=com.docker.compose.project=adcloud-test)"
|
|
||||||
if [ -n "$stack_ids" ]; then
|
|
||||||
docker rm -f $stack_ids
|
|
||||||
fi
|
|
||||||
docker rm -f adcloud-server-test 2>/dev/null || true
|
|
||||||
echo 'Retired Adcloud containers stopped; named data volumes were preserved.'
|
|
||||||
Reference in New Issue
Block a user