Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Database, Build and Deploy | |
on: | |
push: | |
branches: | |
# @todo Add properregex. | |
- 'feature/**' | |
pull_request: | |
branches: | |
# @todo Add properregex. | |
- 'feature/**' | |
# schedule: | |
# - cron: '0 18 * * *' | |
workflow_dispatch: | |
inputs: | |
enable_terminal: | |
type: boolean | |
description: 'Enable terminal session.' | |
required: false | |
default: false | |
jobs: | |
database: | |
runs-on: ubuntu-latest | |
container: | |
image: drevops/ci-runner:canary | |
# options: --privileged | |
env: | |
TZ: Australia/Melbourne | |
TERM: xterm-256color | |
VORTEX_CONTAINER_REGISTRY_USER: ${{ secrets.VORTEX_CONTAINER_REGISTRY_USER }} | |
VORTEX_CONTAINER_REGISTRY_PASS: ${{ secrets.VORTEX_CONTAINER_REGISTRY_PASS }} | |
VORTEX_DEBUG: ${{ vars.VORTEX_DEBUG }} | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Process codebase to run in CI | |
run: | | |
find . -name "docker-compose.yml" -print0 | xargs -0 -I {} sh -c "sed -i -e '/###/d' {} && sed -i -e 's/##//' {}" | |
mkdir -p /tmp/workspace/code | |
# - name: Create cache keys for database caching as files | |
# run: | | |
# echo "${{ github.ref }}" | tee /tmp/db_cache_branch | |
# echo "yes" | tee /tmp/db_cache_fallback_yes | |
# echo "$(date +%Y%m%d)" | tee /tmp/db_cache_timestamp | |
# echo "v24.8.0-db10-${{ steps.cache_branch.outputs.checksum }}-${{ steps.cache_fallback.outputs.checksum }}-${{ steps.cache_timestamp.outputs.checksum }}" | |
# - name: Restore DB cache | |
# uses: actions/cache@v3 | |
# with: | |
# path: /root/project/.data | |
## key: ${{ steps.cache_branch.outputs.checksum }}-${{ steps.cache_fallback.outputs.checksum }}-${{ steps.cache_timestamp.outputs.checksum }} | |
- name: Download DB | |
run: | | |
VORTEX_DB_DOWNLOAD_SEMAPHORE=/tmp/download-db-success ./scripts/vortex/download-db.sh | |
timeout-minutes: 30 | |
- run: | | |
apt update | |
apt install sudo ssh -y | |
- shell: bash | |
run: 'echo HOME=/home/sf | sudo tee -a $GITHUB_ENV' | |
- run: | | |
ls -al /github/home/. | |
- name: Export DB | |
run: | | |
[ ! -f /tmp/download-db-success ] && echo "==> Database download semaphore file is missing. DB export will not proceed." && exit 0 | |
./scripts/vortex/login-container-registry.sh | |
docker compose up --detach | |
sleep 15 | |
docker compose exec cli mkdir -p .data && docker compose cp -L .data/db.sql cli:/app/.data/db.sql || true | |
docker compose exec cli bash -c "VORTEX_PROVISION_POST_OPERATIONS_SKIP=1 ./scripts/vortex/provision.sh" | |
./scripts/vortex/export-db.sh db.sql | |
timeout-minutes: 30 | |
continue-on-error: true | |
- name: Setup tmate session | |
# if: ${{ !cancelled() && github.event.inputs.enable_terminal }} | |
uses: mxschmitt/action-tmate@v3 | |
timeout-minutes: 5 | |
# with: | |
# detached: true | |
# | |
# - name: Upload Database as an artifact | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: database | |
# path: .data/db.sql | |
# - name: Save DB Cache | |
# uses: actions/cache@v3 | |
# with: | |
# path: /root/project/.data | |
# key: ${{ steps.cache_branch.outputs.checksum }}-${{ steps.cache_fallback_yes.outputs.checksum }}-${{ steps.cache_timestamp.outputs.checksum }} | |
# | |
# | |
# | |
# build: | |
# runs-on: ubuntu-latest | |
# needs: database | |
# | |
# container: | |
# image: drevops/ci-runner:24.8.0 | |
# env: | |
# TZ: Australia/Melbourne | |
# TERM: xterm-256color | |
# | |
# steps: | |
# - name: Check out code | |
# uses: actions/checkout@v3 | |
# | |
# - name: Process codebase to run in CI | |
# run: | | |
# find . -name "docker-compose.yml" -print0 | xargs -0 -I {} sh -c "sed -i -e '/###/d' {} && sed -i -e 's/##//' {}" | |
# mkdir -p /tmp/workspace/code | |
# | |
# - name: Build Stack | |
# run: docker compose up -d | |
# | |
# - name: Download Database as an artifact | |
# uses: actions/download-artifact@v4 | |
# with: | |
# name: database | |
# path: .data/db.sql | |
# | |
# - run: ls -al .data | |
# | |
# - name: Run Tests | |
# run: | | |
# docker compose exec -T cli vendor/bin/phpunit | |
# docker compose exec -T cli vendor/bin/behat --profile=default | |
# | |
# - name: Store Artifacts | |
# run: | | |
# mkdir -p /tmp/artifacts | |
# docker compose cp cli:/app/.logs/. /tmp/artifacts/ | |
# | |
# deploy: | |
# runs-on: ubuntu-latest | |
# needs: build | |
# | |
# container: | |
# image: drevops/ci-runner:24.8.0 | |
# env: | |
# TZ: Australia/Melbourne | |
# TERM: xterm-256color | |
# | |
# steps: | |
# - name: Check out code | |
# uses: actions/checkout@v3 | |
# | |
# - name: Process codebase | |
# run: | | |
# find . -name "docker-compose.yml" -print0 | xargs -0 -I {} sh -c "sed -i -e '/###/d' {} && sed -i -e 's/##//' {}" | |
# mkdir -p /tmp/workspace/code | |
# | |
# - name: Deploy | |
# run: | | |
# VORTEX_DEPLOY_BRANCH="${{ github.ref }}" | |
# ./scripts/vortex/deploy.sh | |
# timeout-minutes: 30 |