Skip to content

Commit

Permalink
Merge branch 'master' into release/0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
ken@arch committed Jun 19, 2022
2 parents 0ee173b + 49e264a commit 00b6911
Show file tree
Hide file tree
Showing 23 changed files with 207 additions and 184 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: Build and push Linux Binary
name: Build,test and push Linux Binary

description: "Build and push Linux binary"
description: "Build, test and push Linux binary"

runs:
using: "composite"
steps:
# Step 1: Build
- uses: actions/setup-python@v3
with:
python-version: "3.7"
Expand All @@ -15,12 +16,43 @@ runs:
pip install -e ".[dev]"
- name: Generate Binary
shell: bash
run: pyinstaller --distpath ./dist --log-level=DEBUG dvc.spec
run: |
pyinstaller --distpath ./dist --log-level=DEBUG dvc.spec
cp ./dist/dvc .
- name: Smoke Test
shell: bash
run: |
echo "Now running simple smoke test to test generated binary"
dvc version
./dvc version
# Step 2: Test with Postgres
- name: Start PostgreSQL on Ubuntu
shell: bash
run: |
sudo systemctl start postgresql.service
pg_isready
- name: Create test user
shell: bash
run: |
sudo -u postgres psql --command="CREATE USER test PASSWORD 'test'" --command="\du"
- name: Create test database
shell: bash
run: |
sudo -u postgres createdb --owner=test test
PGPASSWORD=test psql --username=test --host=localhost --list test
- name: Run DVC
shell: bash
run: |
set -a
source ./.github/assets/.github.ci.env
echo "Now checking the env var.."
printenv
echo "Now running dvc....."
./dvc db ping
./dvc db ping
./dvc db init
./dvc db current
./dvc db upgrade --no-confirm
# Step 3: Zip and Upload artifact
- name: zip linux artifact
shell: bash
run: |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: Build and push Macos Binary
name: Build, test and push Macos Binary

description: "Build and push Macos binary"
description: "Build, test and push Macos binary"

runs:
using: "composite"
steps:
# Step 1: Build
- uses: actions/setup-python@v3
with:
python-version: "3.7"
Expand All @@ -15,12 +16,56 @@ runs:
pip install -e ".[dev]"
- name: Generate Binary
shell: bash
run: pyinstaller --distpath ./dist --log-level=DEBUG dvc.spec
run: |
pyinstaller --distpath ./dist --log-level=DEBUG dvc.spec
cp ./dist/dvc .
sudo chmod 755 ./dvc
- name: Smoke Test
shell: bash
run: |
echo "Now running simple smoke test to test generated binary"
dvc version
./dvc version
# Step 2: Test with Postgres
- name: Start PostgreSQL on MacOS
shell: bash
run: |
brew services start postgresql
echo "Check PostgreSQL service is running"
i=10
COMMAND='pg_isready'
while [ $i -gt 0 ]; do
echo "Check PostgreSQL service status"
eval $COMMAND && break
((i--))
if [ $i == 0 ]; then
echo "PostgreSQL service not ready, all attempts exhausted"
exit 1
fi
echo "PostgreSQL service not ready, wait 10 more sec, attempts left: $i"
sleep 10
done
# Homebrew creates an account with the same name as the installing user, but no password
- name: Create test user
shell: bash
run: |
psql --command="CREATE USER test PASSWORD 'test'" --command="\du" postgres
- name: Create test database
shell: bash
run: |
createdb --owner=test test
- name: Run DVC
shell: bash
run: |
set -a
source ./.github/assets/.github.ci.env
echo "Now checking the env var.."
printenv
echo "Now running dvc....."
./dvc db ping
./dvc db init
./dvc db current
./dvc db upgrade --no-confirm
# Step 3: Zip and Upload artifact
- name: zip mac artifact
shell: bash
run: |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,65 @@
name: Build and push Windows Binary
name: Build, test and push Windows Binary

description: "Build and push Windows binary"
description: "Build, test and push Windows binary"

runs:
using: "composite"
steps:
- uses: actions/setup-python@v3
with:
python-version: "3.7"
# Step 1: Build
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Generate Binary
shell: bash
run: pyinstaller --distpath ./dist --log-level=DEBUG dvc.spec
run: |
pyinstaller --distpath ./dist --log-level=DEBUG dvc.spec
cp ./dist/dvc.exe .
# Step 2: Test with Postgres
- name: Smoke Test
shell: bash
run: |
echo "Now running simple smoke test to test generated binary"
dvc version
- name: zip windows artifact
./dvc version
- name: Start PostgreSQL on Windows
shell: powershell
run: |
$pgService = Get-Service -Name postgresql*
Set-Service -InputObject $pgService -Status running -StartupType automatic
Start-Process -FilePath "$env:PGBIN\pg_isready" -Wait -PassThru
- name: Create test user on Windows
shell: powershell
run: |
& $env:PGBIN\psql --command="CREATE USER test PASSWORD 'test'" --command="\du"
- name: Create test database
shell: powershell
run: |
& $env:PGBIN\createdb --owner=test test
$env:PGPASSWORD = 'test'
& $env:PGBIN\psql --username=test --host=localhost --list test
- name: Run DVC
shell: bash
run: |
set -a
source ./.github/assets/.github.ci.env
echo "Now checking the env var.."
printenv
echo "Now running dvc....."
./dvc db ping
./dvc db init
./dvc db current
./dvc db upgrade --no-confirm
# Step 3: Zip and Upload artifact
- name: zip windows artifact
shell: powershell
run: |
powershell Compress-Archive ./dist windows.zip
- name: upload Windows artifact
uses: actions/upload-artifact@v2
with:
name: uploads
path: windows.zip
path: windows.zip
9 changes: 9 additions & 0 deletions .github/assets/.github.ci.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Env file for github. For Linux + Mac
# Location is relative to project root
DVC__DATABASE_REVISION_SQL_FILES_FOLDER=./.github/assets/sample_revision_sql_files
DVC__USER=test
DVC__PASSWORD=test
DVC__HOST=localhost
DVC__PORT=5432
DVC__DBNAME=test
DVC__DBFLAVOUR=postgres
8 changes: 8 additions & 0 deletions .github/assets/.github.ci.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Powershell env
$DVC__DATABASE_REVISION_SQL_FILES_FOLDER='./.github/assets/sample_revision_sql_files'
$DVC__USER='test'
$DVC__PASSWORD='test'
$DVC__HOST='localhost'
$DVC__PORT='5432'
$DVC__DBNAME='test'
$DVC__DBFLAVOUR='postgres'
8 changes: 4 additions & 4 deletions .github/workflows/test_build_push_for_tag_releases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,31 +68,31 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Build and push Macos binaries as artifacts
- name: Build, test and push Macos binaries as artifacts
uses: ./.github/actions/build-n-push-binaries-to-ghrelease/build-n-push-mac-binary

build-linux-binary:
needs: tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build and push Linux binaries as artifacts
- name: Build, test and push Linux binaries as artifacts
uses: ./.github/actions/build-n-push-binaries-to-ghrelease/build-n-push-linux-binary

build-windows-binary:
needs: tests
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Build and push Windows binaries as artifacts
- name: Build, test and push Windows binaries as artifacts
uses: ./.github/actions/build-n-push-binaries-to-ghrelease/build-n-push-windows-binary

build-n-push-binaries-to-gh-release:
needs: [build-mac-binary, build-linux-binary, build-windows-binary]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build and push binaries to Github Release
- name: Build, test and push binaries to Github Release
uses: ./.github/actions/build-n-push-binaries-to-ghrelease
with:
gh-release-tag-name: ${{ github.ref }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ https://hub.docker.com/repository/docker/kenho811/database-version-control#
git clone -b release git@github.com:kenho811/Python_Database_Version_Control.git
# cd to the repository
cd Python_Database_Version_Control
cd Python_Database_Version_Control/docker_compose_demo
# Fnd the docker-compose.yml and run
docker compose up
Expand Down
66 changes: 0 additions & 66 deletions demo_assets/sample_source_sql/hkex_ccass__ddl.sql

This file was deleted.

50 changes: 0 additions & 50 deletions demo_assets/sample_source_sql/hkex_index_future__ddl.sql

This file was deleted.

Loading

0 comments on commit 00b6911

Please sign in to comment.