119 lines
4.9 KiB
YAML
119 lines
4.9 KiB
YAML
name: Windows Tests
|
|
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: windows-latest
|
|
steps:
|
|
- run: git config --global core.autocrlf false
|
|
- uses: actions/checkout@v2
|
|
- name: Configure environment variables
|
|
run: |
|
|
$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")
|
|
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"
|
|
echo "::set-env name=SCOOP_GLOBAL::$env:GITHUB_WORKSPACE\"
|
|
echo "::set-env name=ANKI_EXTRA_PIP::python -m pip install $pyaudio"
|
|
- name: Cache pyenv
|
|
uses: actions/cache@v1
|
|
with:
|
|
path: ${{ github.workspace }}\pyenv
|
|
key: ${{ runner.os }}-pyenv-${{ hashFiles('**/Makefile') }}-${{ hashFiles('**/requirements.txt') }}-
|
|
- name: Cache cargo registry
|
|
uses: actions/cache@v1
|
|
with:
|
|
path: C:\Rust\.cargo\registry
|
|
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
|
|
- name: Cache cargo index
|
|
uses: actions/cache@v1
|
|
with:
|
|
path: C:\Rust\.cargo\git
|
|
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.toml') }}
|
|
- name: Cache cargo build
|
|
uses: actions/cache@v1
|
|
with:
|
|
path: ${{ github.workspace }}\target
|
|
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.toml') }}
|
|
- name: Cache pip wheels
|
|
uses: actions/cache@v1
|
|
with:
|
|
path: ~\AppData\Local\pip\Cache
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
|
- name: Cache pacman
|
|
uses: actions/cache@v1
|
|
id: cache-pacman
|
|
with:
|
|
path: C:\Program Files\Git
|
|
key: ${{ runner.os }}-pacman-${{ hashFiles('**/windows_checks.yml') }}
|
|
- name: Set up pacman, pyaudio, rsync, rename
|
|
if: steps.cache-pacman.outputs.cache-hit != 'true'
|
|
shell: cmd
|
|
run: |
|
|
echo on
|
|
curl -LO https://download.lfd.uci.edu/pythonlibs/s2jqpv5t/%pyaudio%
|
|
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%
|
|
curl -LO https://raw.githubusercontent.com/subogero/rename/master/rename
|
|
:: 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"
|
|
:: Manually Install Pacman Binaries
|
|
:: https://github.com/Alexpux/MSYS2-pacman/issues/50
|
|
cd /d "%programfiles%\Git\usr\bin"
|
|
.\bash pacman-key --init
|
|
.\bash pacman-key --populate msys2
|
|
.\bash pacman-key --refresh-keys
|
|
.\pacman -Tv
|
|
.\pacman -Syuv --overwrite='*'
|
|
.\pacman --version
|
|
:: 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
|
|
- name: Set up scoop, gettext, ripgrep
|
|
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
|
|
- name: Set up python
|
|
uses: actions/setup-python@v1
|
|
with:
|
|
python-version: 3.7
|
|
- name: Set up protoc
|
|
uses: Arduino/actions/setup-protoc@master
|
|
- name: Set up node
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: 12
|
|
- name: Run checks
|
|
shell: cmd
|
|
run: |
|
|
echo on
|
|
set "RSPY_TARGET_DIR=%GITHUB_WORKSPACE%\target"
|
|
set "CARGO_TARGET_DIR=%GITHUB_WORKSPACE%\target"
|
|
make check BUILDFLAGS=""
|
|
- name: Run build
|
|
shell: cmd
|
|
run: |
|
|
echo on
|
|
set "RSPY_TARGET_DIR=%GITHUB_WORKSPACE%\target"
|
|
set "CARGO_TARGET_DIR=%GITHUB_WORKSPACE%\target"
|
|
make build BUILDFLAGS=""
|
|
- name: Upload python wheels
|
|
uses: actions/upload-artifact@v1
|
|
with:
|
|
name: windows_python_wheels
|
|
path: dist
|