Configure CI #5
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: Test Build | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- windows-2022 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Install NASM | |
run: | | |
choco install --no-progress nasm | |
- name: Install cbdinocluster | |
shell: python | |
run: | | |
import os | |
import urllib.request | |
home_bin_path = os.path.expanduser("~/bin") | |
os.makedirs(home_bin_path, exist_ok=True) | |
cbdinocluster_filename = "cbdinocluster-windows-amd64.exe" if platform.system() == "Windows" else "cbdinocluster-linux" | |
cbdinocluster_url = f"https://github.com/couchbaselabs/cbdinocluster/releases/download/v0.0.46/{cbdinocluster_filename}" | |
cbdinocluster_path = os.path.join(home_bin_path, cbdinocluster_filename) | |
urllib.request.urlretrieve(cbdinocluster_url, cbdinocluster_path) | |
if platform.system() != "Windows": | |
os.chmod(cbdinocluster_path, 0o755) | |
github_path = os.getenv("GITHUB_PATH") | |
if github_path: | |
with open(github_path, "a") as f: | |
f.write(f"{home_bin_path}\n") | |
- name: Initialize cbdinocluster | |
shell: python | |
run: | | |
import os | |
import subprocess | |
home_bin_path = os.path.expanduser("~/bin") | |
cbdinocluster_filename = "cbdinocluster-windows-amd64.exe" if platform.system() == "Windows" else "cbdinocluster-linux" | |
cbdinocluster_path = os.path.join(home_bin_path, cbdinocluster_filename) | |
subprocess.run([cbdinocluster_path, '-v', 'init', '--auto']) | |
# - name: Start couchbase cluster | |
# env: | |
# CLUSTERCONFIG: | | |
# nodes: | |
# - count: 2 | |
# version: ${{ matrix.server }} | |
# services: | |
# - kv | |
# - n1ql | |
# - index | |
# - count: 1 | |
# version: ${{ matrix.server }} | |
# services: | |
# - kv | |
# - fts | |
# - cbas | |
# - eventing | |
# docker: | |
# kv-memory: 1600 | |
# run: | | |
# CLUSTER_ID=$(cbdinocluster -v allocate --def="${CLUSTERCONFIG}") | |
# CONNECTION_STRING=$(cbdinocluster -v connstr "${CLUSTER_ID}") | |
# cbdinocluster -v buckets add ${CLUSTER_ID} default --ram-quota-mb=100 --flush-enabled=true | |
# cbdinocluster -v buckets load-sample ${CLUSTER_ID} travel-sample | |
# echo "CLUSTER_ID=${CLUSTER_ID}" >> "$GITHUB_ENV" | |
# echo "CONNECTION_STRING=${CONNECTION_STRING}?dump_configuration=true" >> "$GITHUB_ENV" | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: Build | |
timeout-minutes: 60 | |
shell: python | |
run: | | |
import os | |
import subprocess | |
os.mkdir('build') | |
print("##[group]CMake Configure") | |
subprocess.run(['cmake', '-S', '.', '-B', 'build']) | |
print("##[endgroup]") | |
print("##[group]CMake Build") | |
subprocess.run(['cmake', '--build', 'build']) | |
- name: Run | |
timeout-minutes: 60 | |
shell: python | |
run: | | |
import os | |
import subprocess | |
for root, _, files in os.walk('build'): | |
for file in files: | |
filepath = os.path.join(root, file) | |
if os.access(filepath, os.X_OK) or filepath.endswith('.exe'): | |
print(f"##[group]{filepath}") | |
subprocess.run(filepath) | |
print("##[endgroup]") |