mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
move Linux & Mac tests to Buildkite
This commit is contained in:
parent
9d9452ee2e
commit
0afdbdf7e0
5 changed files with 148 additions and 109 deletions
17
.buildkite/linux/entrypoint
Executable file
17
.buildkite/linux/entrypoint
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
BAZEL="bazel --output_user_root=/state/bazel --output_base=/state/bazel/anki"
|
||||
BUILDARGS="--config=ci --experimental_convenience_symlinks=ignore"
|
||||
|
||||
# move existing node_modules into tree
|
||||
test -e /state/node_modules && mv /state/node_modules ts/
|
||||
|
||||
$BAZEL build $BUILDARGS ...
|
||||
$BAZEL test $BUILDARGS ...
|
||||
|
||||
# if tests succeed, back up node_modules folder
|
||||
mv ts/node_modules /state/
|
||||
|
16
.buildkite/mac/entrypoint
Executable file
16
.buildkite/mac/entrypoint
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
BAZEL="bazel --output_user_root=~/bazel --output_base=~/bazel/anki"
|
||||
BUILDARGS="--config=ci --experimental_convenience_symlinks=ignore"
|
||||
|
||||
# move existing node_modules into tree
|
||||
test -e ~/node_modules && mv ~/node_modules ts/
|
||||
|
||||
$BAZEL build $BUILDARGS ...
|
||||
$BAZEL test $BUILDARGS ...
|
||||
|
||||
# if tests succeed, back up node_modules folder
|
||||
mv ts/node_modules ~/
|
41
.buildkite/windows/entrypoint.bat
Executable file
41
.buildkite/windows/entrypoint.bat
Executable file
|
@ -0,0 +1,41 @@
|
|||
set BAZEL=\bazel\bazel.exe --output_user_root=\bazel\anki --output_base=\bazel\anki\base
|
||||
set BUILDARGS=--config=ci
|
||||
|
||||
if exist \bazel\node_modules (
|
||||
move \bazel\node_modules ts\node_modules
|
||||
)
|
||||
|
||||
echo Building...
|
||||
:: rollup may fail on the first build, so we build once without checking return code
|
||||
call %BAZEL% build %BUILDARGS% ... -k
|
||||
|
||||
:: now build/test
|
||||
echo Running tests...
|
||||
call %BAZEL% test %BUILDARGS% ...
|
||||
IF %ERRORLEVEL% NEQ 0 exit /B 1
|
||||
|
||||
:: build the wheels
|
||||
@REM call %BAZEL% build %BUILDARGS% pylib/anki:wheel qt/aqt:wheel
|
||||
@REM IF %ERRORLEVEL% NEQ 0 exit /B 1
|
||||
|
||||
@REM :: install them into a new venv
|
||||
@REM echo Creating venv...
|
||||
@REM \python\python.exe -m venv venv
|
||||
@REM IF %ERRORLEVEL% NEQ 0 exit /B 1
|
||||
@REM call venv\scripts\activate
|
||||
|
||||
@REM :: expand wildcards
|
||||
@REM for %%i in (bazel-bin/pylib/anki/*.whl) do set "pylib=%%~i"
|
||||
@REM for %%i in (bazel-bin/qt/aqt/*.whl) do set "qt=%%~i"
|
||||
@REM echo Installing wheels...
|
||||
@REM venv\scripts\pip install bazel-bin/pylib/anki/%pylib% bazel-bin/qt/aqt/%qt%
|
||||
@REM IF %ERRORLEVEL% NEQ 0 exit /B 1
|
||||
|
||||
@REM echo Importing...
|
||||
@REM python -c "import aqt"
|
||||
@REM IF %ERRORLEVEL% NEQ 0 exit /B 1
|
||||
@REM echo Import succesful.
|
||||
|
||||
move ts\node_modules \bazel\node_modules
|
||||
|
||||
echo All tests pass.
|
148
.github/workflows/checks.yml
vendored
148
.github/workflows/checks.yml
vendored
|
@ -1,6 +1,6 @@
|
|||
name: Checks
|
||||
name: GH
|
||||
|
||||
on: [push, pull_request]
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
################################
|
||||
|
@ -21,87 +21,87 @@ jobs:
|
|||
# Tests
|
||||
################################
|
||||
|
||||
tests:
|
||||
name: ${{ matrix.name }} ${{ matrix.python }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [macos-latest, ubuntu-20.04]
|
||||
python: [3.8]
|
||||
include:
|
||||
- os: macos-latest
|
||||
name: Mac
|
||||
SEP: /
|
||||
BAZEL_REPO: "~/.cache/bazelrepo"
|
||||
BAZEL_DISK: "~/.cache/bazeldisk"
|
||||
- os: ubuntu-20.04
|
||||
name: Linux
|
||||
SEP: /
|
||||
BAZEL_REPO: "~/.cache/bazelrepo"
|
||||
BAZEL_DISK: "~/.cache/bazeldisk"
|
||||
fail-fast: false
|
||||
# tests:
|
||||
# name: ${{ matrix.name }} ${{ matrix.python }}
|
||||
# runs-on: ${{ matrix.os }}
|
||||
# strategy:
|
||||
# matrix:
|
||||
# os: [macos-latest, ubuntu-20.04]
|
||||
# python: [3.8]
|
||||
# include:
|
||||
# - os: macos-latest
|
||||
# name: Mac
|
||||
# SEP: /
|
||||
# BAZEL_REPO: "~/.cache/bazelrepo"
|
||||
# BAZEL_DISK: "~/.cache/bazeldisk"
|
||||
# - os: ubuntu-20.04
|
||||
# name: Linux
|
||||
# SEP: /
|
||||
# BAZEL_REPO: "~/.cache/bazelrepo"
|
||||
# BAZEL_DISK: "~/.cache/bazeldisk"
|
||||
# fail-fast: false
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
# steps:
|
||||
# - uses: actions/checkout@v2
|
||||
|
||||
- name: Set up python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python }}
|
||||
# - name: Set up python
|
||||
# uses: actions/setup-python@v2
|
||||
# with:
|
||||
# python-version: ${{ matrix.python }}
|
||||
|
||||
- name: Cache disk
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ matrix.BAZEL_DISK }}
|
||||
key: ${{ runner.os }}-disk-2-${{ hashFiles('ts/yarn.lock') }}-${{ hashFiles('pip/requirements.txt') }}-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('**/BUILD.bazel') }}-${{ hashFiles('**/*.bzl') }}
|
||||
# - name: Cache disk
|
||||
# uses: actions/cache@v2
|
||||
# with:
|
||||
# path: ${{ matrix.BAZEL_DISK }}
|
||||
# key: ${{ runner.os }}-disk-2-${{ hashFiles('ts/yarn.lock') }}-${{ hashFiles('pip/requirements.txt') }}-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('**/BUILD.bazel') }}-${{ hashFiles('**/*.bzl') }}
|
||||
|
||||
- name: Cache repo
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ matrix.BAZEL_REPO }}
|
||||
key: ${{ runner.os }}-repo-2-${{ hashFiles('ts/yarn.lock') }}-${{ hashFiles('pip/requirements.txt') }}-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('**/BUILD.bazel') }}-${{ hashFiles('**/*.bzl') }}
|
||||
# - name: Cache repo
|
||||
# uses: actions/cache@v2
|
||||
# with:
|
||||
# path: ${{ matrix.BAZEL_REPO }}
|
||||
# key: ${{ runner.os }}-repo-2-${{ hashFiles('ts/yarn.lock') }}-${{ hashFiles('pip/requirements.txt') }}-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('**/BUILD.bazel') }}-${{ hashFiles('**/*.bzl') }}
|
||||
|
||||
################################
|
||||
# Linux
|
||||
################################
|
||||
# ################################
|
||||
# # Linux
|
||||
# ################################
|
||||
|
||||
- name: Linux
|
||||
if: matrix.os == 'ubuntu-20.04'
|
||||
run: |
|
||||
# disable command workflow processing
|
||||
echo "::stop-commands::`echo -n ${{ github.token }} | sha256sum | head -c 64`"
|
||||
# - name: Linux
|
||||
# if: matrix.os == 'ubuntu-20.04'
|
||||
# run: |
|
||||
# # disable command workflow processing
|
||||
# echo "::stop-commands::`echo -n ${{ github.token }} | sha256sum | head -c 64`"
|
||||
|
||||
set -x
|
||||
sudo apt update
|
||||
sudo apt install portaudio19-dev
|
||||
curl -L https://github.com/bazelbuild/bazelisk/releases/download/v1.7.4/bazelisk-linux-amd64 -o ./bazel && \
|
||||
chmod +x ./bazel
|
||||
# set -x
|
||||
# sudo apt update
|
||||
# sudo apt install portaudio19-dev
|
||||
# curl -L https://github.com/bazelbuild/bazelisk/releases/download/v1.7.4/bazelisk-linux-amd64 -o ./bazel && \
|
||||
# chmod +x ./bazel
|
||||
|
||||
BAZEL="./bazel"
|
||||
ARGS="--show_timestamps --isatty=0 --color=yes --disk_cache=${{ matrix.BAZEL_DISK }} --repository_cache=${{ matrix.BAZEL_REPO }}"
|
||||
$BAZEL test ... $ARGS
|
||||
$BAZEL build qt:runanki $ARGS
|
||||
ANKI_IMPORT_ONLY=1 $BAZEL run qt:runanki
|
||||
# BAZEL="./bazel"
|
||||
# ARGS="--show_timestamps --isatty=0 --color=yes --disk_cache=${{ matrix.BAZEL_DISK }} --repository_cache=${{ matrix.BAZEL_REPO }}"
|
||||
# $BAZEL test ... $ARGS
|
||||
# $BAZEL build qt:runanki $ARGS
|
||||
# ANKI_IMPORT_ONLY=1 $BAZEL run qt:runanki
|
||||
|
||||
################################
|
||||
# Mac
|
||||
################################
|
||||
# ################################
|
||||
# # Mac
|
||||
# ################################
|
||||
|
||||
- name: Mac
|
||||
if: matrix.os == 'macos-latest'
|
||||
run: |
|
||||
# disable command workflow processing
|
||||
echo "::stop-commands::`echo -n ${{ github.token }} | sha256sum | head -c 64`"
|
||||
# - name: Mac
|
||||
# if: matrix.os == 'macos-latest'
|
||||
# run: |
|
||||
# # disable command workflow processing
|
||||
# echo "::stop-commands::`echo -n ${{ github.token }} | sha256sum | head -c 64`"
|
||||
|
||||
set -x
|
||||
brew install portaudio gnu-tar
|
||||
# gnu tar for cache issue
|
||||
echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH
|
||||
# set -x
|
||||
# brew install portaudio gnu-tar
|
||||
# # gnu tar for cache issue
|
||||
# echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH
|
||||
|
||||
BAZEL="bazel"
|
||||
ARGS="--show_timestamps --isatty=0 --color=yes --disk_cache=${{ matrix.BAZEL_DISK }} --repository_cache=${{ matrix.BAZEL_REPO }}"
|
||||
$BAZEL test ... $ARGS
|
||||
$BAZEL build qt:runanki $ARGS
|
||||
# the rsync workaround is not required in CI, as it's working
|
||||
# around a webengine issue
|
||||
ANKI_IMPORT_ONLY=1 $BAZEL run qt:runanki
|
||||
# BAZEL="bazel"
|
||||
# ARGS="--show_timestamps --isatty=0 --color=yes --disk_cache=${{ matrix.BAZEL_DISK }} --repository_cache=${{ matrix.BAZEL_REPO }}"
|
||||
# $BAZEL test ... $ARGS
|
||||
# $BAZEL build qt:runanki $ARGS
|
||||
# # the rsync workaround is not required in CI, as it's working
|
||||
# # around a webengine issue
|
||||
# ANKI_IMPORT_ONLY=1 $BAZEL run qt:runanki
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
set BAZEL=\bazel\bazel.exe --output_user_root=\bazel\anki --output_base=\bazel\anki\base
|
||||
set BUILDARGS=--config=ci
|
||||
|
||||
echo Building...
|
||||
:: rollup may fail on the first build, so we build once without checking return code
|
||||
call %BAZEL% build %BUILDARGS% ... -k
|
||||
|
||||
:: now build/test
|
||||
echo Running tests...
|
||||
call %BAZEL% test %BUILDARGS% ...
|
||||
IF %ERRORLEVEL% NEQ 0 exit /B 1
|
||||
|
||||
:: build the wheels
|
||||
call %BAZEL% build %BUILDARGS% pylib/anki:wheel qt/aqt:wheel
|
||||
IF %ERRORLEVEL% NEQ 0 exit /B 1
|
||||
|
||||
:: install them into a new venv
|
||||
echo Creating venv...
|
||||
\python\python.exe -m venv venv
|
||||
IF %ERRORLEVEL% NEQ 0 exit /B 1
|
||||
call venv\scripts\activate
|
||||
|
||||
:: expand wildcards
|
||||
for %%i in (bazel-bin/pylib/anki/*.whl) do set "pylib=%%~i"
|
||||
for %%i in (bazel-bin/qt/aqt/*.whl) do set "qt=%%~i"
|
||||
echo Installing wheels...
|
||||
venv\scripts\pip install bazel-bin/pylib/anki/%pylib% bazel-bin/qt/aqt/%qt%
|
||||
IF %ERRORLEVEL% NEQ 0 exit /B 1
|
||||
|
||||
echo Importing...
|
||||
python -c "import aqt"
|
||||
IF %ERRORLEVEL% NEQ 0 exit /B 1
|
||||
echo Import succesful.
|
||||
|
||||
echo All tests pass.
|
Loading…
Reference in a new issue