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-11-01 07:16:19 +01:00
|
|
|
################################
|
|
|
|
# Contributor check
|
|
|
|
################################
|
|
|
|
|
2020-11-01 06:05:28 +01:00
|
|
|
contrib:
|
|
|
|
name: Author in CONTRIBUTORS
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
|
|
|
- name: Check
|
|
|
|
run: |
|
|
|
|
set -x
|
|
|
|
.github/scripts/contrib.sh
|
|
|
|
|
2020-11-01 07:16:19 +01:00
|
|
|
################################
|
|
|
|
# Matrix generation
|
|
|
|
################################
|
|
|
|
|
2020-04-30 09:16:05 +02:00
|
|
|
check_tag:
|
2020-11-01 08:06:44 +01:00
|
|
|
name: Matrix Generation
|
2020-04-30 09:16:05 +02:00
|
|
|
outputs:
|
2020-05-01 06:07:16 +02:00
|
|
|
tagged: ${{ steps.check_tagged.outputs.tagged }}
|
|
|
|
matrix: ${{ steps.check_tagged.outputs.matrix }}
|
2020-04-30 09:16:05 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Check the ref
|
|
|
|
id: check_tagged
|
|
|
|
run: |
|
|
|
|
set -x
|
2020-05-01 20:54:47 +02:00
|
|
|
printf '%s' '#!/usr/bin/env python3
|
2020-05-01 06:07:16 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
import json
|
|
|
|
import argparse
|
|
|
|
|
|
|
|
matrix = json.loads(r"""
|
|
|
|
{
|
|
|
|
"BUILD_TYPE": [
|
2020-11-01 07:16:19 +01:00
|
|
|
"check"
|
2020-05-01 06:07:16 +02:00
|
|
|
],
|
|
|
|
"os": [
|
|
|
|
"ubuntu-latest",
|
2020-11-05 11:55:48 +01:00
|
|
|
"macos-latest"
|
2020-05-01 06:07:16 +02:00
|
|
|
],
|
|
|
|
"python": [
|
2020-11-01 06:05:28 +01:00
|
|
|
3.8
|
2020-05-01 06:07:16 +02:00
|
|
|
],
|
|
|
|
"include": [
|
|
|
|
{
|
|
|
|
"os": "ubuntu-latest",
|
|
|
|
"name": "Ubuntu",
|
|
|
|
"SEP": "/",
|
2020-11-05 02:32:59 +01:00
|
|
|
"BAZEL_REPO": "~/.cache/bazelrepo",
|
|
|
|
"BAZEL_DISK": "~/.cache/bazeldisk",
|
2020-05-01 20:57:38 +02:00
|
|
|
"ANKI_PYTHON_WHEELS": "anki_linux_python"
|
2020-05-01 06:07:16 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"os": "macos-latest",
|
|
|
|
"name": "Mac OS",
|
|
|
|
"SEP": "/",
|
2020-11-05 02:32:59 +01:00
|
|
|
"BAZEL_REPO": "~/Library/Caches/bazelrepo",
|
|
|
|
"BAZEL_DISK": "~/Library/Caches/bazeldisk",
|
2020-05-01 20:57:38 +02:00
|
|
|
"ANKI_PYTHON_WHEELS": "anki_macos_python"
|
2020-05-01 06:07:16 +02:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
""")
|
|
|
|
|
|
|
|
parser = argparse.ArgumentParser(description="Dynamically creates a build matrix for the GitHub Actions.")
|
|
|
|
parser.add_argument("--tagged", action="store_true", default=False,
|
2020-11-01 06:05:28 +01:00
|
|
|
help="Skip checks on release build")
|
2020-05-01 06:07:16 +02:00
|
|
|
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
2020-11-01 07:16:19 +01:00
|
|
|
# if args.tagged:
|
|
|
|
# pass
|
|
|
|
# else:
|
|
|
|
# matrix["BUILD_TYPE"].append("check")
|
2020-05-01 06:07:16 +02:00
|
|
|
|
|
|
|
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)"
|
2020-04-30 09:16:05 +02:00
|
|
|
else
|
2020-05-01 06:07:16 +02:00
|
|
|
printf '::set-output name=tagged::%s\n' ""
|
|
|
|
printf '::set-output name=matrix::%s\n' "$(python3 buildmatrix.py)"
|
2020-04-30 09:16:05 +02:00
|
|
|
fi
|
|
|
|
|
2020-11-01 07:16:19 +01:00
|
|
|
################################
|
|
|
|
# Tests
|
|
|
|
################################
|
|
|
|
|
2020-03-26 05:40:53 +01:00
|
|
|
tests:
|
2020-04-30 09:16:05 +02:00
|
|
|
needs:
|
|
|
|
- check_tag
|
2020-05-01 06:07:16 +02:00
|
|
|
name: ${{ matrix.name }} ${{ needs.check_tag.outputs.tagged }} ${{ matrix.BUILD_TYPE }} ${{ matrix.python }}
|
2020-03-26 05:40:53 +01:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
2020-05-01 06:07:16 +02:00
|
|
|
matrix: ${{ fromJson( needs.check_tag.outputs.matrix ) }}
|
2020-03-26 20:39:34 +01:00
|
|
|
fail-fast: false
|
|
|
|
|
2019-12-22 03:15:18 +01:00
|
|
|
steps:
|
2020-01-02 10:43:19 +01:00
|
|
|
- uses: actions/checkout@v2
|
2020-03-26 05:40:53 +01:00
|
|
|
|
2020-11-01 07:16:19 +01:00
|
|
|
- name: Set up python
|
2020-11-01 08:06:44 +01:00
|
|
|
uses: actions/setup-python@v2
|
2020-11-01 07:16:19 +01:00
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python }}
|
2020-03-25 01:59:20 +01:00
|
|
|
|
2020-11-05 02:32:59 +01:00
|
|
|
- name: Cache disk
|
2020-11-01 08:06:44 +01:00
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
2020-11-05 02:32:59 +01:00
|
|
|
path: ${{ matrix.BAZEL_DISK }}
|
|
|
|
key: ${{ runner.os }}-disk-1-${{ hashFiles('ts/yarn.lock') }}-${{ hashFiles('pip/requirements.txt') }}-${{ hashFiles('cargo/Cargo.lock') }}-${{ hashFiles('**/BUILD.bazel') }}-${{ hashFiles('**/*.bzl') }}
|
|
|
|
|
|
|
|
- name: Cache repo
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ${{ matrix.BAZEL_REPO }}
|
|
|
|
key: ${{ runner.os }}-repo-1-${{ hashFiles('ts/yarn.lock') }}-${{ hashFiles('pip/requirements.txt') }}-${{ hashFiles('cargo/Cargo.lock') }}-${{ hashFiles('**/BUILD.bazel') }}-${{ hashFiles('**/*.bzl') }}
|
2020-11-01 08:06:44 +01:00
|
|
|
|
2020-11-01 07:16:19 +01:00
|
|
|
################################
|
|
|
|
# Linux
|
|
|
|
################################
|
|
|
|
|
|
|
|
- name: Linux
|
|
|
|
if: matrix.os == 'ubuntu-latest'
|
2020-03-25 01:59:20 +01:00
|
|
|
run: |
|
2020-11-05 03:27:36 +01:00
|
|
|
# disable command workflow processing
|
|
|
|
echo "::stop-commands::`echo -n ${{ github.token }} | sha256sum | head -c 64`"
|
|
|
|
|
2020-11-01 07:16:19 +01:00
|
|
|
set -x
|
|
|
|
sudo apt update
|
|
|
|
sudo apt install portaudio19-dev gettext
|
|
|
|
curl -L https://github.com/bazelbuild/bazelisk/releases/download/v1.7.4/bazelisk-linux-amd64 -o ./bazel && \
|
|
|
|
chmod +x ./bazel
|
2020-03-26 05:40:53 +01:00
|
|
|
|
2020-11-05 02:32:59 +01:00
|
|
|
BAZEL="./bazel"
|
2020-11-05 03:23:06 +01:00
|
|
|
ARGS="--show_timestamps --isatty=0 --color=yes --disk_cache=${{ matrix.BAZEL_DISK }} --repository_cache=${{ matrix.BAZEL_REPO }}"
|
2020-11-01 08:06:44 +01:00
|
|
|
$BAZEL test ... $ARGS
|
|
|
|
$BAZEL build qt:runanki $ARGS
|
|
|
|
ANKI_IMPORT_ONLY=1 $BAZEL run qt:runanki
|
2020-03-26 07:04:47 +01:00
|
|
|
|
2020-11-01 07:16:19 +01:00
|
|
|
################################
|
|
|
|
# Mac
|
|
|
|
################################
|
2020-04-25 09:30:01 +02:00
|
|
|
|
2020-11-01 07:16:19 +01:00
|
|
|
- name: Mac
|
|
|
|
if: matrix.os == 'macos-latest'
|
|
|
|
run: |
|
2020-11-05 03:27:36 +01:00
|
|
|
# disable command workflow processing
|
|
|
|
echo "::stop-commands::`echo -n ${{ github.token }} | sha256sum | head -c 64`"
|
|
|
|
|
2020-11-01 07:16:19 +01:00
|
|
|
set -x
|
2020-11-05 03:24:10 +01:00
|
|
|
brew install portaudio gnu-tar
|
2020-08-22 01:19:32 +02:00
|
|
|
# gnu tar for cache issue
|
2020-11-05 03:27:36 +01:00
|
|
|
echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH
|
2020-08-22 01:19:32 +02:00
|
|
|
|
2020-11-05 02:32:59 +01:00
|
|
|
BAZEL="bazel"
|
2020-11-05 03:23:06 +01:00
|
|
|
ARGS="--show_timestamps --isatty=0 --color=yes --disk_cache=${{ matrix.BAZEL_DISK }} --repository_cache=${{ matrix.BAZEL_REPO }}"
|
2020-11-01 08:06:44 +01:00
|
|
|
$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
|
2020-05-01 06:07:16 +02:00
|
|
|
|
2020-11-01 07:16:19 +01:00
|
|
|
################################
|
|
|
|
# Windows
|
|
|
|
################################
|
2020-03-26 05:40:53 +01:00
|
|
|
|
2020-11-05 11:55:48 +01:00
|
|
|
# - name: Windows
|
2020-11-01 07:16:19 +01:00
|
|
|
# if: matrix.os == 'windows-latest'
|
|
|
|
# run: |
|
2020-11-05 11:55:48 +01:00
|
|
|
# Set-PSDebug -Trace 1
|
2020-11-01 07:16:19 +01:00
|
|
|
|
2020-11-05 11:55:48 +01:00
|
|
|
# $env:PATH = "$env:PATH;c:\msys64\usr\bin"
|
2020-11-01 07:16:19 +01:00
|
|
|
|
2020-11-05 11:55:48 +01:00
|
|
|
# $env:ANKI_IMPORT_ONLY = "1"
|
|
|
|
# $PYTHON = Get-Command python | Select-Object -ExpandProperty Definition
|
|
|
|
# $BAZEL = ".\bazel.exe --output_user_root=..\bazout"
|
|
|
|
# $ARGS = "--action_env=\`"PYTHON_SYS_EXECUTABLE=$PYTHON\`""
|
2020-11-01 07:16:19 +01:00
|
|
|
|
2020-11-05 11:55:48 +01:00
|
|
|
# curl --fail -L https://github.com/bazelbuild/bazelisk/releases/download/v1.7.4/bazelisk-windows-amd64.exe -o .\bazel.exe
|
2020-11-01 07:16:19 +01:00
|
|
|
|
2020-11-05 11:55:48 +01:00
|
|
|
# # try build a few times to compensate for rollup flakiness
|
2020-11-01 07:16:19 +01:00
|
|
|
|
2020-11-05 11:55:48 +01:00
|
|
|
# echo "Currently broken"
|
|
|
|
# # for ($i=1; $i -le 4; $i++) { Invoke-Expression "$BAZEL build qt:runanki -k $ARGS" -ErrorAction "continue" }
|
|
|
|
# # Invoke-Expression "$BAZEL build qt:runanki -k $ARGS"
|
|
|
|
# # Invoke-Expression "$BAZEL test ... $ARGS"
|
|
|
|
# # Invoke-Expression "$BAZEL run qt:runanki $ARGS"
|
2020-11-01 07:16:19 +01: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
|
|
|
|
# cd dist
|
|
|
|
# rm -f "%pyaudio%"
|
|
|
|
# setlocal EnableDelayedExpansion
|
|
|
|
# cmd /C set "wheels=" && for /f "delims=" %%i in ('dir /b *.*') DO set "wheels="%%i" !wheels!"
|
|
|
|
|
|
|
|
# :: https://github.com/ankitects/anki/pull/535
|
|
|
|
# perl ../scripts/rename -f "s@\+[\w\d]+-@-@g" %wheels%
|
|
|
|
# python -m pip install twine
|
|
|
|
# python -m twine upload --non-interactive --skip-existing --verbose ./*
|
|
|
|
|
|
|
|
# - 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
|
|
|
|
|
|
|
|
# # https://github.com/ankitects/anki/pull/535
|
|
|
|
# perl scripts/rename -f "s@\+[\w\d]+-@-@g" dist/*
|
|
|
|
# python -m twine upload --non-interactive --skip-existing --verbose dist/*
|