From f90856625210d9e643baaa5651520b44d4886095 Mon Sep 17 00:00:00 2001 From: evandrocoan Date: Sun, 22 Mar 2020 23:34:22 -0300 Subject: [PATCH] Created .github/workflows/mac_checks.yml --- .github/workflows/linux_checks.yml | 16 ++++---- .github/workflows/mac_checks.yml | 59 ++++++++++++++++++++++++++++ .github/workflows/windows_checks.yml | 12 +++--- Makefile | 10 +++-- README.development | 2 +- qt/tools/typecheck-setup.sh | 2 +- 6 files changed, 82 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/mac_checks.yml diff --git a/.github/workflows/linux_checks.yml b/.github/workflows/linux_checks.yml index 1a79cc270..d631d3511 100644 --- a/.github/workflows/linux_checks.yml +++ b/.github/workflows/linux_checks.yml @@ -19,7 +19,8 @@ jobs: node-version: 12 - name: Set up ripgrep, pyaudio, gettext, rename run: | - sudo apt update; sudo apt install portaudio19-dev gettext rename + sudo apt update + sudo apt install portaudio19-dev gettext rename sudo snap install ripgrep --classic # Necessary for now for the cargo cache: # https://github.com/actions/cache/issues/133#issuecomment-599102035 @@ -45,14 +46,13 @@ jobs: with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - - name: Configure project variables - run: | - echo "::set-env name=BUILDFLAGS::" - echo "::set-env name=RSPY_TARGET_DIR::~/target" - echo "::set-env name=CARGO_TARGET_DIR::~/target" - name: Run checks run: | - make check + export RSPY_TARGET_DIR=~/target + export CARGO_TARGET_DIR=~/target + make check BUILDFLAGS="" - name: Run build run: | - make build + export RSPY_TARGET_DIR=~/target + export CARGO_TARGET_DIR=~/target + make build BUILDFLAGS="" diff --git a/.github/workflows/mac_checks.yml b/.github/workflows/mac_checks.yml new file mode 100644 index 000000000..59f4cbfa6 --- /dev/null +++ b/.github/workflows/mac_checks.yml @@ -0,0 +1,59 @@ +name: Mac Tests + +# on: [push, pull_request] +# Disables Mac OS builds until this gets fixed +# https://github.com/actions/virtual-environments/issues/602 +on: + push: + branches-ignore: + - '**' + +jobs: + test: + runs-on: macOS-latest + steps: + - uses: actions/checkout@v2 + - 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: Set up brew packages + run: | + brew install portaudio protobuf gettext rename ripgrep + brew link gettext --force + - name: Cache cargo registry + uses: actions/cache@v1 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.toml') }} + - name: Cache cargo index + uses: actions/cache@v1 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.toml') }} + - name: Cache cargo build + uses: actions/cache@v1 + with: + path: ~/target + key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.toml') }} + - name: Cache pip wheels + uses: actions/cache@v1 + with: + path: ~/Library/Caches/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + - name: Run checks + run: | + export RSPY_TARGET_DIR=~/target + export CARGO_TARGET_DIR=~/target + make check BUILDFLAGS="" + - name: Run build + run: | + export RSPY_TARGET_DIR=~/target + export CARGO_TARGET_DIR=~/target + make build BUILDFLAGS="" diff --git a/.github/workflows/windows_checks.yml b/.github/workflows/windows_checks.yml index 8061092af..52a632804 100644 --- a/.github/workflows/windows_checks.yml +++ b/.github/workflows/windows_checks.yml @@ -43,10 +43,10 @@ jobs: .\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 --version .\pacman -Sv --noconfirm --overwrite='*' bash .\pacman -Sv --noconfirm --overwrite='*' rsync - name: Set up scoop, gettext, ripgrep @@ -78,24 +78,24 @@ jobs: - name: Cache cargo build uses: actions/cache@v1 with: - path: ~\target + 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: Configure project variables - run: | - echo "::set-env name=RSPY_TARGET_DIR::~\target" - echo "::set-env name=CARGO_TARGET_DIR::~\target" - 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="" diff --git a/Makefile b/Makefile index 246a60c6c..0a0a06cba 100644 --- a/Makefile +++ b/Makefile @@ -65,8 +65,13 @@ pyenv: "${PYTHON_BIN}" -m venv pyenv && \ case "$$(uname -s)" in CYGWIN*|MINGW*|MSYS*) \ dos2unix "${ACTIVATE_SCRIPT}" && \ - sed -i -- "s@VIRTUAL_ENV=\".*\"@VIRTUAL_ENV=\"$(shell pwd)/pyenv\"@g" "${ACTIVATE_SCRIPT}" \ - ;; esac; \ + # https://github.com/PyO3/maturin/issues/283 \ + # Expected `python` to be a python interpreter inside a virtualenv \ + VIRTUAL_ENV="$$(pwd)" && \ + VIRTUAL_ENV="$$(cygpath -m "$${VIRTUAL_ENV}")" && \ + sed -i -- "s@VIRTUAL_ENV=\".*\"@VIRTUAL_ENV=\"$$(pwd)/pyenv\"@g" "${ACTIVATE_SCRIPT}" && \ + sed -i -- "s@export PATH@export PATH; VIRTUAL_ENV=\"$${VIRTUAL_ENV}/pyenv\";@g" "${ACTIVATE_SCRIPT}" \ + ;; esac && \ . "${ACTIVATE_SCRIPT}" && \ python --version && \ python -m pip install --upgrade pip setuptools && \ @@ -181,4 +186,3 @@ push-i18n-ftl: pull-i18n .PHONY: push-i18n-po push-i18n-po: pull-i18n (cd qt/po && scripts/upload-latest-template) - diff --git a/README.development b/README.development index c6031425b..3cee93523 100644 --- a/README.development +++ b/README.development @@ -79,7 +79,7 @@ Mac users You can use homebrew to install some dependencies: -$ brew install python mpv lame portaudio protobuf npm rustup-init gettext rename +$ brew install python mpv lame portaudio protobuf npm rustup-init gettext rename ripgrep $ brew link gettext --force diff --git a/qt/tools/typecheck-setup.sh b/qt/tools/typecheck-setup.sh index ee68cb2a2..acda0b599 100755 --- a/qt/tools/typecheck-setup.sh +++ b/qt/tools/typecheck-setup.sh @@ -22,6 +22,6 @@ case "$(uname -s)" in ;; esac -cmd="rsync -a \"${TOOLS}/stubs/PyQt5/\" \"${modDir}/\"" +cmd="rsync -a ${TOOLS}/stubs/PyQt5/ ${modDir}/" $cmd > /dev/null 2>&1 || sudo $cmd