Skip to content

[DRAFT] add CI tool for docker health check and initial ci workflow #133

[DRAFT] add CI tool for docker health check and initial ci workflow

[DRAFT] add CI tool for docker health check and initial ci workflow #133

Workflow file for this run

name: Test App Install
on:
pull_request: {}
jobs:
changed-files:
name: Get changed apps
runs-on: ubuntu-latest
outputs:
changed-apps: ${{ steps.changed-apps.outputs.changed-apps }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get changed files
id: changed-files-json
uses: tj-actions/changed-files@v44
with:
json: true
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.22.2"
- name: Get changed apps
id: changed-apps
env:
CHANGED_FILES: ${{ steps.changed-files-json.outputs.all_changed_files }}
run: |
echo $CHANGED_FILES
out=$(go run ./tools/get-changed-apps/cmd/main.go)
echo "changed-apps=${out}" >> $GITHUB_OUTPUT
echo $out
test-apps:
name: Test apps
needs: changed-files
runs-on: ubuntu-latest
strategy:
matrix:
app: ${{ fromJson(needs.changed-files.outputs.changed-apps) }}
steps:
- name: Environment Information
run: |
echo "====== Docker Info ======"
docker info
echo "========================="
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.22.2"
- name: Checkout
uses: actions/checkout@v4
- name: Install Dependencies
shell: bash
run: |
pip install -r requirements.txt
- name: Install Go Dependencies
run: |
cd tools/docker-health-check
go mod download
go build -o ../../check_health cmd/main.go
chmod +x ../../check_health
- name: Run app
shell: bash
run: |
for values_file in ix-dev/${{ matrix.app }}/ci/*.yaml; do
echo "Testing [$values_file]"
sudo ./main.py $values_file ix-dev/${{ matrix.app }} > docker-compose.yaml
# Print the parsed, by compose, template
# (as it will also remove empty lines)
docker compose -f docker-compose.yaml config
PROJECT_NAME="$(openssl rand -hex 12)"
docker compose -p $PROJECT_NAME -f docker-compose.yaml up -d
./check_health --project $PROJECT_NAME --files docker-compose.yaml
docker compose -p $PROJECT_NAME -f docker-compose.yaml down --remove-orphans --volumes
docker compose -p $PROJECT_NAME -f docker-compose.yaml rm --force --stop --volumes
# Clean up the test directory used by the app
echo "Cleaning up /mnt/test directory"
sudo rm -r /mnt/test || echo "Failed to clean up /mnt/test"
done