mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
Set to checks.yml upload Python 3.8 wheels to PyPi
This commit is contained in:
parent
cde8be654f
commit
998e418a83
1 changed files with 93 additions and 43 deletions
136
.github/workflows/checks.yml
vendored
136
.github/workflows/checks.yml
vendored
|
@ -6,17 +6,86 @@ jobs:
|
||||||
check_tag:
|
check_tag:
|
||||||
name: Tag name
|
name: Tag name
|
||||||
outputs:
|
outputs:
|
||||||
tagged: ${{ steps.check_tagged.outputs.is_tagged }}
|
tagged: ${{ steps.check_tagged.outputs.tagged }}
|
||||||
|
matrix: ${{ steps.check_tagged.outputs.matrix }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check the ref
|
- name: Check the ref
|
||||||
id: check_tagged
|
id: check_tagged
|
||||||
run: |
|
run: |
|
||||||
set -x
|
set -x
|
||||||
if [[ ${{ github.ref }} == refs/tags/* ]]; then
|
printf '%s' '
|
||||||
echo "::set-output name=is_tagged::tagged"
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import json
|
||||||
|
import argparse
|
||||||
|
|
||||||
|
matrix = json.loads(r"""
|
||||||
|
{
|
||||||
|
"BUILD_TYPE": [
|
||||||
|
"check",
|
||||||
|
"build"
|
||||||
|
],
|
||||||
|
"os": [
|
||||||
|
"ubuntu-latest",
|
||||||
|
"macos-latest",
|
||||||
|
"windows-latest"
|
||||||
|
],
|
||||||
|
"python": [
|
||||||
|
3.7
|
||||||
|
],
|
||||||
|
"include": [
|
||||||
|
{
|
||||||
|
"os": "ubuntu-latest",
|
||||||
|
"name": "Ubuntu",
|
||||||
|
"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",
|
||||||
|
"name": "Mac OS",
|
||||||
|
"SEP": "/",
|
||||||
|
"PIP_WHEELS_DIR": "~/Library/Caches/pip",
|
||||||
|
"CARGO_INDEX_DIR": "~/.cargo/git",
|
||||||
|
"CARGO_REGISTRY_DIR": "~/.cargo/registry",
|
||||||
|
"ANKI_PYTHON_WHEELS": "anki_macos_python_wheels"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"os": "windows-latest",
|
||||||
|
"name": "Windows",
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
""")
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(description="Dynamically creates a build matrix for the GitHub Actions.")
|
||||||
|
parser.add_argument("--tagged", action="store_true", default=False,
|
||||||
|
help="Adds Python 3.8 builds into the matrix")
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
if args.tagged:
|
||||||
|
matrix["python"].append("3.8")
|
||||||
|
|
||||||
|
print(json.dumps(matrix))
|
||||||
|
' > buildmatrix.py;
|
||||||
|
|
||||||
|
if [[ ${{ github.ref }} == refs/tags/* ]];
|
||||||
|
then
|
||||||
|
printf '::set-output name=tagged::%s\n' "tagged"
|
||||||
|
printf '::set-output name=matrix::%s\n' "$(python3 buildmatrix.py --tagged)"
|
||||||
else
|
else
|
||||||
echo "::set-output name=is_tagged::"
|
printf '::set-output name=tagged::%s\n' ""
|
||||||
|
printf '::set-output name=matrix::%s\n' "$(python3 buildmatrix.py)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
contrib:
|
contrib:
|
||||||
|
@ -32,42 +101,11 @@ jobs:
|
||||||
tests:
|
tests:
|
||||||
needs:
|
needs:
|
||||||
- check_tag
|
- check_tag
|
||||||
name: ${{ matrix.name }} ${{ needs.check_tag.outputs.tagged }} ${{ matrix.BUILD_TYPE }}
|
name: ${{ matrix.name }} ${{ needs.check_tag.outputs.tagged }} ${{ matrix.BUILD_TYPE }} ${{ matrix.python }}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
# https://github.com/ankitects/anki/pull/598
|
||||||
BUILD_TYPE:
|
matrix: ${{ fromJson( needs.check_tag.outputs.matrix ) }}
|
||||||
- check
|
|
||||||
- build
|
|
||||||
os:
|
|
||||||
- ubuntu-latest
|
|
||||||
- macos-latest
|
|
||||||
- windows-latest
|
|
||||||
|
|
||||||
include:
|
|
||||||
- os: ubuntu-latest
|
|
||||||
name: Ubuntu
|
|
||||||
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
|
|
||||||
name: Mac OS
|
|
||||||
SEP: /
|
|
||||||
PIP_WHEELS_DIR: ~/Library/Caches/pip
|
|
||||||
CARGO_INDEX_DIR: ~/.cargo/git
|
|
||||||
CARGO_REGISTRY_DIR: ~/.cargo/registry
|
|
||||||
ANKI_PYTHON_WHEELS: anki_macos_python_wheels
|
|
||||||
|
|
||||||
- os: windows-latest
|
|
||||||
name: Windows
|
|
||||||
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
|
|
||||||
|
|
||||||
# Keep all systems running if something fails
|
# Keep all systems running if something fails
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
@ -112,7 +150,14 @@ jobs:
|
||||||
echo "::set-env name=RSPY_TARGET_DIR::$env:GITHUB_WORKSPACE\target"
|
echo "::set-env name=RSPY_TARGET_DIR::$env:GITHUB_WORKSPACE\target"
|
||||||
echo "::set-env name=CARGO_TARGET_DIR::$env:GITHUB_WORKSPACE\target"
|
echo "::set-env name=CARGO_TARGET_DIR::$env:GITHUB_WORKSPACE\target"
|
||||||
|
|
||||||
$pyaudio=("PyAudio-0.2.11-cp37-cp37m-win_amd64.whl")
|
# https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio
|
||||||
|
if( "3.7".equals( "${{ matrix.python }}" ) ) {
|
||||||
|
$pyaudio=("PyAudio-0.2.11-cp37-cp37m-win_amd64.whl")
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$pyaudio=("PyAudio-0.2.11-cp38-cp38-win_amd64.whl")
|
||||||
|
}
|
||||||
|
|
||||||
$new_path=("$env:GITHUB_WORKSPACE;$env:PATH")
|
$new_path=("$env:GITHUB_WORKSPACE;$env:PATH")
|
||||||
$new_path=("$env:GITHUB_WORKSPACE\shims;$new_path")
|
$new_path=("$env:GITHUB_WORKSPACE\shims;$new_path")
|
||||||
|
|
||||||
|
@ -129,13 +174,13 @@ jobs:
|
||||||
# Necessary for now for the cargo cache:
|
# Necessary for now for the cargo cache:
|
||||||
# https://github.com/actions/cache/issues/133#issuecomment-599102035
|
# https://github.com/actions/cache/issues/133#issuecomment-599102035
|
||||||
- name: Fix ~/.cache permissions
|
- name: Fix ~/.cache permissions
|
||||||
if: matrix.os == 'ubuntu-latest'
|
if: matrix.os == 'ubuntu-latest' && matrix.python == '3.7'
|
||||||
run: |
|
run: |
|
||||||
sudo chown -R $(whoami):$(id -ng) ~/.cargo/
|
sudo chown -R $(whoami):$(id -ng) ~/.cargo/
|
||||||
|
|
||||||
# Disable it for macos because it pyenv cache is bugged (https://github.com/ankitects/anki/pull/563)
|
# Disable it for macos because it pyenv cache is bugged (https://github.com/ankitects/anki/pull/563)
|
||||||
- name: Cache pyenv
|
- name: Cache pyenv
|
||||||
if: matrix.os != 'macos-latest'
|
if: matrix.os != 'macos-latest' && matrix.python == '3.7'
|
||||||
uses: actions/cache@v1
|
uses: actions/cache@v1
|
||||||
with:
|
with:
|
||||||
path: ${{ github.workspace }}${{ matrix.SEP }}pyenv
|
path: ${{ github.workspace }}${{ matrix.SEP }}pyenv
|
||||||
|
@ -143,37 +188,42 @@ jobs:
|
||||||
|
|
||||||
# # Disable it in attempt to reduce the overall cache size (https://github.com/ankitects/anki/pull/528)
|
# # Disable it in attempt to reduce the overall cache size (https://github.com/ankitects/anki/pull/528)
|
||||||
# - name: Cache pip wheels
|
# - name: Cache pip wheels
|
||||||
# if: matrix.BUILD_TYPE == 'build'
|
# if: matrix.BUILD_TYPE == 'build' && matrix.python == '3.7'
|
||||||
# uses: actions/cache@v1
|
# uses: actions/cache@v1
|
||||||
# with:
|
# with:
|
||||||
# path: ${{ matrix.PIP_WHEELS_DIR }}
|
# path: ${{ matrix.PIP_WHEELS_DIR }}
|
||||||
# key: ${{ runner.os }}-pip-wheels-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/setup.py') }}-15-
|
# key: ${{ runner.os }}-pip-wheels-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/setup.py') }}-15-
|
||||||
|
|
||||||
- name: Cache cargo index
|
- name: Cache cargo index
|
||||||
|
if: matrix.python == '3.7'
|
||||||
uses: actions/cache@v1
|
uses: actions/cache@v1
|
||||||
with:
|
with:
|
||||||
path: ${{ matrix.CARGO_INDEX_DIR }}
|
path: ${{ matrix.CARGO_INDEX_DIR }}
|
||||||
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/requirements.*') }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/Makefile') }}-${{ hashFiles('**/Cargo.toml') }}-15-
|
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/requirements.*') }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/Makefile') }}-${{ hashFiles('**/Cargo.toml') }}-15-
|
||||||
|
|
||||||
- name: Cache cargo registry
|
- name: Cache cargo registry
|
||||||
|
if: matrix.python == '3.7'
|
||||||
uses: actions/cache@v1
|
uses: actions/cache@v1
|
||||||
with:
|
with:
|
||||||
path: ${{ matrix.CARGO_REGISTRY_DIR }}
|
path: ${{ matrix.CARGO_REGISTRY_DIR }}
|
||||||
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/requirements.*') }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/Makefile') }}-${{ hashFiles('**/Cargo.toml') }}-15-
|
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/requirements.*') }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/Makefile') }}-${{ hashFiles('**/Cargo.toml') }}-15-
|
||||||
|
|
||||||
- name: Cache cargo target
|
- name: Cache cargo target
|
||||||
|
if: matrix.python == '3.7'
|
||||||
uses: actions/cache@v1
|
uses: actions/cache@v1
|
||||||
with:
|
with:
|
||||||
path: ${{ github.workspace }}${{ matrix.SEP }}target
|
path: ${{ github.workspace }}${{ matrix.SEP }}target
|
||||||
key: ${{ runner.os }}-cargo-target-${{ hashFiles('**/requirements.*') }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/Makefile') }}-${{ hashFiles('**/Cargo.toml') }}-${{ matrix.BUILD_TYPE }}-15-
|
key: ${{ runner.os }}-cargo-target-${{ hashFiles('**/requirements.*') }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/Makefile') }}-${{ hashFiles('**/Cargo.toml') }}-${{ matrix.BUILD_TYPE }}-15-
|
||||||
|
|
||||||
- name: Cache cargo rslib
|
- name: Cache cargo rslib
|
||||||
|
if: matrix.python == '3.7'
|
||||||
uses: actions/cache@v1
|
uses: actions/cache@v1
|
||||||
with:
|
with:
|
||||||
path: ${{ github.workspace }}${{ matrix.SEP }}rslib${{ matrix.SEP }}target
|
path: ${{ github.workspace }}${{ matrix.SEP }}rslib${{ matrix.SEP }}target
|
||||||
key: ${{ runner.os }}-cargo-rslib-${{ hashFiles('**/requirements.*') }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/Makefile') }}-${{ hashFiles('**/Cargo.toml') }}-${{ matrix.BUILD_TYPE }}-15-
|
key: ${{ runner.os }}-cargo-rslib-${{ hashFiles('**/requirements.*') }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/Makefile') }}-${{ hashFiles('**/Cargo.toml') }}-${{ matrix.BUILD_TYPE }}-15-
|
||||||
|
|
||||||
- name: Cache cargo rspy
|
- name: Cache cargo rspy
|
||||||
|
if: matrix.python == '3.7'
|
||||||
uses: actions/cache@v1
|
uses: actions/cache@v1
|
||||||
with:
|
with:
|
||||||
path: ${{ github.workspace }}${{ matrix.SEP }}rspy${{ matrix.SEP }}target
|
path: ${{ github.workspace }}${{ matrix.SEP }}rspy${{ matrix.SEP }}target
|
||||||
|
@ -257,7 +307,7 @@ jobs:
|
||||||
- name: Set up python
|
- name: Set up python
|
||||||
uses: actions/setup-python@v1
|
uses: actions/setup-python@v1
|
||||||
with:
|
with:
|
||||||
python-version: 3.7
|
python-version: ${{ matrix.python }}
|
||||||
|
|
||||||
- name: Set up protoc
|
- name: Set up protoc
|
||||||
uses: ankitects/setup-protoc@master
|
uses: ankitects/setup-protoc@master
|
||||||
|
|
Loading…
Reference in a new issue