2020-03-25 01:59:20 +01:00
|
|
|
name: Checks
|
2019-12-22 03:15:18 +01:00
|
|
|
|
2019-12-22 09:39:14 +01:00
|
|
|
on: [push, pull_request]
|
2019-12-22 03:15:18 +01:00
|
|
|
|
|
|
|
jobs:
|
2020-03-26 05:40:53 +01:00
|
|
|
tests:
|
2020-03-26 20:39:34 +01:00
|
|
|
name: ${{ matrix.os }} ${{ matrix.BUILD_TYPE }}
|
2020-03-26 05:40:53 +01:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ ubuntu-latest, macos-latest, windows-latest ]
|
2020-03-26 20:39:34 +01:00
|
|
|
BUILD_TYPE: [check, build]
|
2020-03-26 05:40:53 +01:00
|
|
|
include:
|
|
|
|
- os: ubuntu-latest
|
|
|
|
SEP: /
|
|
|
|
PIP_WHEELS_DIR: ~/.cache/pip
|
|
|
|
CARGO_INDEX_DIR: ~/.cargo/git
|
|
|
|
CARGO_REGISTRY_DIR: ~/.cargo/registry
|
|
|
|
ANKI_PYTHON_WHEELS: anki_linux_python_wheels
|
|
|
|
|
|
|
|
- os: macos-latest
|
|
|
|
SEP: /
|
|
|
|
PIP_WHEELS_DIR: ~/Library/Caches/pip
|
|
|
|
CARGO_INDEX_DIR: ~/.cargo/git
|
|
|
|
CARGO_REGISTRY_DIR: ~/.cargo/registry
|
2020-03-26 06:45:55 +01:00
|
|
|
ANKI_PYTHON_WHEELS: anki_macos_python_wheels
|
2020-03-26 05:40:53 +01:00
|
|
|
|
|
|
|
- os: windows-latest
|
|
|
|
SEP: \
|
|
|
|
PIP_WHEELS_DIR: ~\AppData\Local\pip\Cache
|
|
|
|
CARGO_INDEX_DIR: C:\Rust\.cargo\git
|
|
|
|
CARGO_REGISTRY_DIR: C:\Rust\.cargo\registry
|
|
|
|
ANKI_PYTHON_WHEELS: anki_windows_python_wheels
|
|
|
|
|
2020-03-26 20:39:34 +01:00
|
|
|
# Keep running all matrices if something fail
|
|
|
|
fail-fast: false
|
|
|
|
|
2019-12-22 03:15:18 +01:00
|
|
|
steps:
|
2020-03-26 05:40:53 +01:00
|
|
|
- run: git config --global core.autocrlf false
|
|
|
|
if: matrix.os == 'windows-latest'
|
|
|
|
|
2020-01-02 10:43:19 +01:00
|
|
|
- uses: actions/checkout@v2
|
2020-03-26 05:40:53 +01:00
|
|
|
|
|
|
|
- name: Configure Linux environment variables
|
|
|
|
if: matrix.os == 'ubuntu-latest'
|
2020-03-24 03:39:05 +01:00
|
|
|
run: |
|
2020-03-24 20:29:27 +01:00
|
|
|
# echo "::set-env name=SHELLFLAGS::-x"
|
2020-03-24 03:39:05 +01:00
|
|
|
echo "::set-env name=BUILDFLAGS::"
|
|
|
|
echo "::set-env name=RSPY_TARGET_DIR::${GITHUB_WORKSPACE}/target"
|
|
|
|
echo "::set-env name=CARGO_TARGET_DIR::${GITHUB_WORKSPACE}/target"
|
2020-03-25 01:59:20 +01:00
|
|
|
|
2020-03-26 05:40:53 +01:00
|
|
|
- name: Configure Mac OS environment variables
|
|
|
|
if: matrix.os == 'macos-latest'
|
2020-03-25 01:59:20 +01:00
|
|
|
run: |
|
|
|
|
# echo "::set-env name=SHELLFLAGS::-x"
|
|
|
|
echo "::set-env name=BUILDFLAGS::"
|
2020-03-26 05:40:53 +01:00
|
|
|
|
2020-03-26 02:05:46 +01:00
|
|
|
# Disabled for Mac OS because it was not reusing the cached files
|
|
|
|
# https://github.com/ankitects/anki/pull/528
|
|
|
|
# echo "::set-env name=RSPY_TARGET_DIR::${GITHUB_WORKSPACE}/target"
|
|
|
|
# echo "::set-env name=CARGO_TARGET_DIR::${GITHUB_WORKSPACE}/target"
|
2020-03-25 01:59:20 +01:00
|
|
|
|
2020-03-26 07:04:47 +01:00
|
|
|
# Update make to use the new `.SHELLFLAGS` feature
|
|
|
|
# https://stackoverflow.com/questions/43175529/updating-make-version-4-1-on-mac
|
|
|
|
echo "::set-env name=PATH::/usr/local/opt/make/libexec/gnubin:$PATH"
|
|
|
|
|
2020-03-26 05:40:53 +01:00
|
|
|
- name: Configure Windows environment variables
|
|
|
|
if: matrix.os == 'windows-latest'
|
2020-03-25 01:59:20 +01:00
|
|
|
run: |
|
|
|
|
# echo "::set-env name=SHELLFLAGS::-x"
|
2020-03-26 05:40:53 +01:00
|
|
|
echo "::set-env name=BUILDFLAGS::"
|
2020-03-26 07:04:47 +01:00
|
|
|
echo "::set-env name=RSPY_TARGET_DIR::$env:GITHUB_WORKSPACE\target"
|
|
|
|
echo "::set-env name=CARGO_TARGET_DIR::$env:GITHUB_WORKSPACE\target"
|
2020-03-26 05:40:53 +01:00
|
|
|
|
2020-03-25 01:59:20 +01:00
|
|
|
$pyaudio=("PyAudio-0.2.11-cp37-cp37m-win_amd64.whl")
|
|
|
|
$new_path=("$env:GITHUB_WORKSPACE;$env:PATH")
|
|
|
|
$new_path=("$env:GITHUB_WORKSPACE\shims;$new_path")
|
2020-03-26 05:40:53 +01:00
|
|
|
|
2020-03-25 01:59:20 +01:00
|
|
|
echo "::set-env name=pacmanbin::pacman-5.1.1-3-x86_64.pkg.tar.xz"
|
|
|
|
echo "::set-env name=pacmanmirror::pacman-mirrors-20200307-1-any.pkg.tar.xz"
|
|
|
|
echo "::set-env name=pacmankeys::msys2-keyring-r9.397a52e-1-any.pkg.tar.xz"
|
|
|
|
echo "::set-env name=pyaudio::$pyaudio"
|
|
|
|
echo "::set-env name=PATH::$new_path"
|
|
|
|
echo "::set-env name=RUST_BACKTRACE::full"
|
|
|
|
echo "::set-env name=SCOOP::$env:GITHUB_WORKSPACE"
|
2020-03-25 03:51:44 +01:00
|
|
|
echo "::set-env name=SCOOP_GLOBAL::$env:GITHUB_WORKSPACE"
|
2020-03-25 01:59:20 +01:00
|
|
|
echo "::set-env name=ANKI_EXTRA_PIP::python -m pip install $pyaudio"
|
2020-03-26 05:40:53 +01:00
|
|
|
|
|
|
|
# Necessary for now for the cargo cache:
|
|
|
|
# https://github.com/actions/cache/issues/133#issuecomment-599102035
|
|
|
|
- name: Fix ~/.cache permissions
|
|
|
|
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
|
|
|
|
run: |
|
|
|
|
sudo chown -R $(whoami):$(id -ng) ~/.cargo/
|
|
|
|
|
|
|
|
- name: Cache pyenv
|
2020-03-25 01:59:20 +01:00
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
2020-03-26 05:40:53 +01:00
|
|
|
path: ${{ github.workspace }}${{ matrix.SEP }}pyenv
|
2020-03-27 21:13:24 +01:00
|
|
|
key: ${{ runner.os }}-pyenv-${{ hashFiles('**/requirements.*') }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/Makefile') }}-14-
|
2020-03-28 17:32:21 +01:00
|
|
|
|
|
|
|
- name: Cache pip wheels
|
|
|
|
if: matrix.BUILD_TYPE == 'build'
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: ${{ matrix.PIP_WHEELS_DIR }}
|
2020-03-27 23:12:07 +01:00
|
|
|
key: ${{ runner.os }}-pip-wheels-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/setup.py') }}-14-
|
2020-03-27 01:55:03 +01:00
|
|
|
|
2020-03-27 06:17:25 +01:00
|
|
|
- name: Cache cargo index
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: ${{ matrix.CARGO_INDEX_DIR }}
|
2020-04-02 19:24:53 +02:00
|
|
|
key: |
|
|
|
|
${{ runner.os }}-cargo-index-
|
|
|
|
${{ hashFiles('**/requirements.*') }}-
|
|
|
|
${{ hashFiles('**/setup.py') }}-
|
|
|
|
${{ hashFiles('**/Makefile') }}-
|
|
|
|
${{ hashFiles('**/Cargo.toml') }}-14-
|
2020-03-27 01:55:03 +01:00
|
|
|
|
2020-03-27 06:17:25 +01:00
|
|
|
- name: Cache cargo registry
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: ${{ matrix.CARGO_REGISTRY_DIR }}
|
2020-04-02 19:24:53 +02:00
|
|
|
key: |
|
|
|
|
${{ runner.os }}-cargo-registry-
|
|
|
|
${{ hashFiles('**/requirements.*') }}-
|
|
|
|
${{ hashFiles('**/setup.py') }}-
|
|
|
|
${{ hashFiles('**/Makefile') }}-
|
|
|
|
${{ hashFiles('**/Cargo.toml') }}-14-
|
2020-03-26 05:40:53 +01:00
|
|
|
|
2020-03-25 01:59:20 +01:00
|
|
|
- name: Cache cargo target
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
2020-03-26 05:40:53 +01:00
|
|
|
path: ${{ github.workspace }}${{ matrix.SEP }}target
|
2020-04-02 19:24:53 +02:00
|
|
|
key: |
|
|
|
|
${{ runner.os }}-cargo-target-
|
|
|
|
${{ hashFiles('**/requirements.*') }}-
|
|
|
|
${{ hashFiles('**/setup.py') }}-
|
|
|
|
${{ hashFiles('**/Makefile') }}-
|
|
|
|
${{ hashFiles('**/Cargo.toml') }}-
|
|
|
|
${{ matrix.BUILD_TYPE }}-14-
|
2020-03-26 05:40:53 +01:00
|
|
|
|
2020-03-25 01:59:20 +01:00
|
|
|
- name: Cache cargo rslib
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
2020-03-26 05:40:53 +01:00
|
|
|
path: ${{ github.workspace }}${{ matrix.SEP }}rslib${{ matrix.SEP }}target
|
2020-04-02 19:24:53 +02:00
|
|
|
key: |
|
|
|
|
${{ runner.os }}-cargo-rslib-
|
|
|
|
${{ hashFiles('**/requirements.*') }}-
|
|
|
|
${{ hashFiles('**/setup.py') }}-
|
|
|
|
${{ hashFiles('**/Makefile') }}-
|
|
|
|
${{ hashFiles('**/Cargo.toml') }}-
|
|
|
|
${{ matrix.BUILD_TYPE }}-14-
|
2020-03-26 05:40:53 +01:00
|
|
|
|
2020-03-25 01:59:20 +01:00
|
|
|
- name: Cache cargo rspy
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
2020-03-26 05:40:53 +01:00
|
|
|
path: ${{ github.workspace }}${{ matrix.SEP }}rspy${{ matrix.SEP }}target
|
2020-04-02 19:24:53 +02:00
|
|
|
key: |
|
|
|
|
${{ runner.os }}-cargo-rspy-
|
|
|
|
${{ hashFiles('**/requirements.*') }}-
|
|
|
|
${{ hashFiles('**/setup.py') }}-
|
|
|
|
${{ hashFiles('**/Makefile') }}-
|
|
|
|
${{ hashFiles('**/Cargo.toml') }}-
|
|
|
|
${{ matrix.BUILD_TYPE }}-14-
|
2020-03-26 05:40:53 +01:00
|
|
|
|
2020-03-25 01:59:20 +01:00
|
|
|
- name: Cache pacman
|
2020-03-26 05:40:53 +01:00
|
|
|
if: matrix.os == 'windows-latest'
|
2020-03-25 01:59:20 +01:00
|
|
|
uses: actions/cache@v1
|
|
|
|
id: cache-pacman
|
|
|
|
with:
|
|
|
|
path: C:\Program Files\Git
|
2020-04-02 19:24:53 +02:00
|
|
|
key: |
|
|
|
|
${{ runner.os }}-pacman-
|
|
|
|
${{ hashFiles('**/checks.yml') }}-14-
|
2020-03-26 05:40:53 +01:00
|
|
|
|
2020-03-25 01:59:20 +01:00
|
|
|
- name: Set up pacman, rsync
|
2020-03-26 05:40:53 +01:00
|
|
|
if: matrix.os == 'windows-latest' && steps.cache-pacman.outputs.cache-hit != 'true'
|
2020-03-25 01:59:20 +01:00
|
|
|
shell: cmd
|
|
|
|
run: |
|
|
|
|
echo on
|
|
|
|
curl -LO http://repo.msys2.org/msys/x86_64/%pacmanbin%
|
|
|
|
curl -LO http://repo.msys2.org/msys/x86_64/%pacmanmirror%
|
|
|
|
curl -LO http://repo.msys2.org/msys/x86_64/%pacmankeys%
|
2020-03-26 05:40:53 +01:00
|
|
|
|
2020-03-25 01:59:20 +01:00
|
|
|
:: https://stackoverflow.com/questions/1359793/programmatically-extract-tar-gz
|
|
|
|
7z x "%pacmanbin%" -so | 7z x -aoa -si -ttar -o"%programfiles%\Git"
|
|
|
|
7z x "%pacmanmirror%" -so | 7z x -aoa -si -ttar -o"%programfiles%\Git"
|
|
|
|
7z x "%pacmankeys%" -so | 7z x -aoa -si -ttar -o"%programfiles%\Git"
|
2020-03-26 05:40:53 +01:00
|
|
|
|
2020-03-25 01:59:20 +01:00
|
|
|
:: Manually Install Pacman Binaries
|
|
|
|
:: https://github.com/Alexpux/MSYS2-pacman/issues/50
|
|
|
|
set "PATH=%programfiles%\Git\usr\bin"
|
|
|
|
bash pacman-key --init
|
|
|
|
bash pacman-key --populate msys2
|
|
|
|
bash pacman-key --refresh-keys
|
|
|
|
pacman -Tv
|
|
|
|
pacman -Syyuuv --overwrite='*'
|
|
|
|
pacman -Syuuv --overwrite='*'
|
|
|
|
pacman --version
|
2020-03-26 05:40:53 +01:00
|
|
|
|
2020-03-25 01:59:20 +01:00
|
|
|
:: We must install bash first, otherwise we will have bash fork errors:
|
|
|
|
:: https://github.com/evandroforks/anki/runs/524857054?check_suite_focus=true
|
|
|
|
:: 0 [main] pacman 748 dofork: child -1 - forked process 2896 died unexpectedly
|
|
|
|
pacman -Sv --noconfirm --overwrite='*' bash
|
|
|
|
pacman -Sv --noconfirm --overwrite='*' rsync
|
2020-03-26 05:40:53 +01:00
|
|
|
|
2020-03-25 01:59:20 +01:00
|
|
|
:: clean all packages to decrease image size
|
|
|
|
pacman -Sccv --noconfirm
|
|
|
|
pacman -Qsv --noconfirm
|
2020-03-26 05:40:53 +01:00
|
|
|
|
2020-03-26 07:04:47 +01:00
|
|
|
- name: Set up curl pyaudio, rename
|
2020-03-26 05:40:53 +01:00
|
|
|
if: matrix.os == 'windows-latest'
|
2020-03-25 01:59:20 +01:00
|
|
|
shell: cmd
|
|
|
|
run: |
|
|
|
|
echo on
|
|
|
|
curl -LO https://download.lfd.uci.edu/pythonlibs/s2jqpv5t/%pyaudio%
|
|
|
|
curl -LO https://raw.githubusercontent.com/subogero/rename/master/rename
|
2020-03-26 05:40:53 +01:00
|
|
|
|
2020-03-26 07:04:47 +01:00
|
|
|
- name: Set up Windows scoop, gettext, ripgrep
|
2020-03-26 05:40:53 +01:00
|
|
|
if: matrix.os == 'windows-latest'
|
2020-03-25 01:59:20 +01:00
|
|
|
shell: cmd
|
|
|
|
run: |
|
|
|
|
echo on
|
|
|
|
powershell -executionpolicy bypass "& Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')"
|
|
|
|
scoop install -g gettext ripgrep
|
2020-03-26 05:40:53 +01:00
|
|
|
|
2020-03-26 07:04:47 +01:00
|
|
|
- name: Set up Ubuntu ripgrep, pyaudio, gettext, rename
|
2020-03-26 05:40:53 +01:00
|
|
|
if: matrix.os == 'ubuntu-latest'
|
|
|
|
run: |
|
2020-03-28 17:32:21 +01:00
|
|
|
set -x
|
2020-03-26 05:40:53 +01:00
|
|
|
sudo apt update
|
|
|
|
sudo apt install portaudio19-dev gettext rename
|
|
|
|
sudo snap install ripgrep --classic
|
|
|
|
|
2020-03-26 07:04:47 +01:00
|
|
|
- name: Set up brew ripgrep, pyaudio, gettext, rename
|
2020-03-26 05:40:53 +01:00
|
|
|
if: matrix.os == 'macos-latest'
|
|
|
|
run: |
|
2020-03-28 17:32:21 +01:00
|
|
|
set -x
|
2020-03-26 05:40:53 +01:00
|
|
|
brew install portaudio protobuf gettext rename ripgrep make
|
|
|
|
brew link gettext --force
|
|
|
|
|
2020-03-25 01:59:20 +01:00
|
|
|
- name: Set up python
|
|
|
|
uses: actions/setup-python@v1
|
|
|
|
with:
|
|
|
|
python-version: 3.7
|
2020-03-26 05:40:53 +01:00
|
|
|
|
2020-03-25 01:59:20 +01:00
|
|
|
- name: Set up protoc
|
2020-03-25 20:28:48 +01:00
|
|
|
uses: ankitects/setup-protoc@master
|
2020-03-25 01:59:20 +01:00
|
|
|
with:
|
|
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
2020-03-26 05:40:53 +01:00
|
|
|
|
2020-03-25 01:59:20 +01:00
|
|
|
- name: Set up node
|
|
|
|
uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: 12
|
2020-03-26 05:40:53 +01:00
|
|
|
|
2020-03-25 01:59:20 +01:00
|
|
|
- run: make develop
|
2020-03-28 17:32:21 +01:00
|
|
|
if: matrix.BUILD_TYPE == 'build'
|
2020-03-26 20:39:34 +01:00
|
|
|
|
2020-03-25 01:59:20 +01:00
|
|
|
- run: make build
|
2020-03-28 17:32:21 +01:00
|
|
|
if: matrix.BUILD_TYPE == 'build'
|
|
|
|
|
|
|
|
- name: Check Windows wheels
|
|
|
|
if: matrix.BUILD_TYPE == 'build' && matrix.os == 'windows-latest'
|
|
|
|
shell: cmd
|
|
|
|
run: |
|
|
|
|
echo on
|
|
|
|
copy %pyaudio% dist
|
|
|
|
cd dist
|
2020-03-27 23:12:07 +01:00
|
|
|
setlocal EnableDelayedExpansion
|
2020-03-31 05:26:53 +02:00
|
|
|
cmd /C set "wheels=" && for /f "delims=" %%i in ('dir /b *.*') DO set "wheels="%%i" !wheels!"
|
2020-03-27 23:12:07 +01:00
|
|
|
python -m pip install %wheels%
|
2020-03-28 17:32:21 +01:00
|
|
|
python -c "import aqt; # aqt.run()"
|
|
|
|
|
|
|
|
- name: Check Linux/Mac OS wheels
|
|
|
|
if: matrix.BUILD_TYPE == 'build' && ( matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' )
|
|
|
|
run: |
|
|
|
|
set -x
|
|
|
|
cd dist
|
2020-03-31 05:26:53 +02:00
|
|
|
python -m pip install *.*
|
2020-03-28 17:32:21 +01:00
|
|
|
python -c "import aqt; # aqt.run()"
|
2020-03-26 20:39:34 +01:00
|
|
|
|
2020-03-25 01:51:41 +01:00
|
|
|
- run: make check
|
2020-03-26 20:39:34 +01:00
|
|
|
if: matrix.BUILD_TYPE == 'check'
|
2020-03-26 05:40:53 +01:00
|
|
|
|
2020-03-25 01:59:20 +01:00
|
|
|
- name: Upload python wheels
|
2020-03-28 17:32:21 +01:00
|
|
|
if: matrix.BUILD_TYPE == 'build'
|
2020-03-25 01:59:20 +01:00
|
|
|
uses: actions/upload-artifact@v1
|
|
|
|
with:
|
2020-03-26 05:40:53 +01:00
|
|
|
name: ${{ matrix.ANKI_PYTHON_WHEELS }}
|
2020-03-25 01:59:20 +01:00
|
|
|
path: dist
|
2020-04-02 04:01:48 +02:00
|
|
|
|
|
|
|
- name: Upload to PyPi Windows
|
|
|
|
if: matrix.BUILD_TYPE == 'build' && startsWith(github.ref, 'refs/tags/') && matrix.os == 'windows-latest'
|
|
|
|
shell: cmd
|
|
|
|
env:
|
|
|
|
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
|
|
|
|
TWINE_USERNAME: __token__
|
|
|
|
run: |
|
|
|
|
echo on
|
|
|
|
rm -f "dist/%pyaudio%"
|
|
|
|
python -m pip install twine
|
|
|
|
twine upload --non-interactive --skip-existing --verbose dist/*
|
|
|
|
|
|
|
|
- name: Upload to PyPi Linux/Mac OS
|
|
|
|
if: matrix.BUILD_TYPE == 'build' && startsWith(github.ref, 'refs/tags/') && ( matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' )
|
|
|
|
env:
|
|
|
|
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
|
|
|
|
TWINE_USERNAME: __token__
|
|
|
|
run: |
|
|
|
|
set -x
|
|
|
|
python -m pip install twine
|
|
|
|
twine upload --non-interactive --skip-existing --verbose dist/*
|