Skip to content

Commit

Permalink
Switch release workflow to CIBW
Browse files Browse the repository at this point in the history
  • Loading branch information
elprans committed Nov 12, 2021
1 parent 49c72ab commit 709928f
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 80 deletions.
25 changes: 0 additions & 25 deletions .github/workflows/build-manylinux-wheels.sh

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/install-edgedb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

set -Eexuo pipefail
shopt -s nullglob

srv="https://packages.edgedb.com"

curl -fL "${srv}/dist/x86_64-unknown-linux-musl/edgedb-cli" \
> "/usr/local/bin/edgedb"

chmod +x "/usr/local/bin/edgedb"

# XXX: replace this with edgedb server install once that supports
# portable builds.
curl -fL "${srv}/archive/x86_64-unknown-linux-gnu/edgedb-server-1.0-rc.2%2Bc328744.tar.gz" \
> "/tmp/edgedb-server.tar.gz"

mkdir -p "/opt/edgedb-server"
tar -xz --strip-components=1 -C "/opt/edgedb-server" -f "/tmp/edgedb-server.tar.gz"
ln -s "/opt/edgedb-server/bin/edgedb-server" "/usr/local/bin/edgedb-server"

useradd --shell /bin/bash edgedb
edgedb-server --version
105 changes: 53 additions & 52 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
mkdir -p dist/
echo "${VERSION}" > dist/VERSION
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v2
with:
name: dist
path: dist/
Expand All @@ -52,98 +52,99 @@ jobs:
PIP_DISABLE_PIP_VERSION_CHECK: 1

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
with:
fetch-depth: 50
submodules: true

- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: "3.9"
- name: Set up Python
uses: actions/setup-python@v2

- name: Build source distribution
run: |
pip install -U setuptools wheel pip
python setup.py sdist
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v2
with:
name: dist
path: dist/
path: dist/*.tar.*

build-wheels:
needs: validate-release-request
runs-on: ${{ matrix.os }}

env:
PIP_DISABLE_PIP_VERSION_CHECK: 1

strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
os: [ubuntu-latest, macos-latest, windows-latest]
cibw_python: ["cp36-*", "cp37-*", "cp38-*", "cp39-*", "cp310-*"]
cibw_arch: ["auto64"]
exclude:
# Tests fail on this combination.
- os: macos-latest
cibw_python: "cp36-*"

defaults:
run:
shell: bash

env:
PIP_DISABLE_PIP_VERSION_CHECK: 1

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
with:
fetch-depth: 50
submodules: true

- name: Install EdgeDB
if: "!startsWith(matrix.os, 'windows')"
uses: edgedb/setup-edgedb@v1

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Install Python Deps
run: |
python -m pip install --upgrade setuptools pip wheel
- name: Build Wheels (linux)
if: startsWith(matrix.os, 'ubuntu')
uses: docker://quay.io/pypa/manylinux1_x86_64
env:
PYTHON_VERSION: ${{ matrix.python-version }}
- name: Setup WSL
if: ${{ steps.release.outputs.version == 0 && matrix.os == 'windows-latest' }}
uses: vampire/setup-wsl@v1
with:
entrypoint: /github/workspace/.github/workflows/build-manylinux-wheels.sh
wsl-shell-user: edgedb
additional-packages:
ca-certificates
curl

- name: Build Wheels (non-linux)
if: "!startsWith(matrix.os, 'ubuntu')"
run: |
make clean
python setup.py bdist_wheel
- name: Install EdgeDB
uses: edgedb/setup-edgedb@v1

- name: Test Wheels
- uses: pypa/[email protected]
env:
PKG_VERSION: ${{ needs.validate-release-request.outputs.version }}
if: |
!startsWith(matrix.os, 'windows')
&& !contains(github.event.pull_request.labels.*.name, 'skip wheel tests')
run: |
pip install -f "file:///${GITHUB_WORKSPACE}/dist" \
edgedb[test]==${PKG_VERSION}
make -C "${GITHUB_WORKSPACE}" testinstalled
- uses: actions/upload-artifact@v1
CIBW_BUILD_VERBOSITY: 1
CIBW_BUILD: ${{ matrix.cibw_python }}
# Cannot test on Musl distros yet.
CIBW_SKIP: "*-musllinux*"
CIBW_ARCHS: ${{ matrix.cibw_arch }}
# EdgeDB doesn't run on CentOS 6, so use 2014 as baseline
CIBW_MANYLINUX_X86_64_IMAGE: "quay.io/pypa/manylinux2014_x86_64"
CIBW_BEFORE_ALL_LINUX: >
.github/workflows/install-edgedb.sh
CIBW_TEST_EXTRAS: "test"
CIBW_TEST_COMMAND: >
python {project}/tests/__init__.py
CIBW_TEST_COMMAND_WINDOWS: >
python {project}\tests\__init__.py
CIBW_TEST_COMMAND_LINUX: >
PY=`which python`
&& chmod -R go+rX "$(dirname $(dirname $(dirname $PY)))"
&& su -l edgedb -c "$PY {project}/tests/__init__.py"
- uses: actions/upload-artifact@v2
with:
name: dist
path: dist/
path: wheelhouse/*.whl

publish:
needs: [build-sdist, build-wheels]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
with:
fetch-depth: 5
submodules: false

- uses: actions/download-artifact@v1
- uses: actions/download-artifact@v2
with:
name: dist
path: dist/
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ docs/_build
/reflog.txt
/edgedb/**/*.html
/tmp
/wheelhouse
1 change: 1 addition & 0 deletions edgedb/_testbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def _start_cluster(*, cleanup_atexit=True):
universal_newlines=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
encoding="utf-8",
env=env,
cwd=tmpdir.name,
).stdout:
Expand Down
8 changes: 5 additions & 3 deletions tests/test_con_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,13 @@ def test_test_connect_params_run_testcase(self):
})

def test_connect_params(self):
testcases_path = os.path.abspath(
'tests/shared-client-testcases/connection_testcases.json'
testcases_path = (
pathlib.Path(__file__).parent
/ "shared-client-testcases"
/ "connection_testcases.json"
)
try:
with open(testcases_path) as f:
with open(testcases_path, encoding="utf-8") as f:
testcases = json.load(f)
except FileNotFoundError as err:
raise FileNotFoundError(
Expand Down

0 comments on commit 709928f

Please sign in to comment.