Anki/.github/workflows/checks.yml
Damien Elmes 07e814ded5 clean up GHA workflow
wheel uploading to pypi will be handled separately for future releases
2020-11-24 21:00:38 +10:00

107 lines
3.4 KiB
YAML

name: Checks
on: [push, pull_request]
jobs:
################################
# Contributor check
################################
contrib:
name: Author in CONTRIBUTORS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Check
run: |
set -x
.github/scripts/contrib.sh
################################
# Tests
################################
tests:
name: ${{ matrix.name }} ${{ matrix.python }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-20.04]
python: [3.8]
include:
- os: macos-latest
name: Mac
SEP: /
BAZEL_REPO: "~/.cache/bazelrepo"
BAZEL_DISK: "~/.cache/bazeldisk"
- os: ubuntu-20.04
name: Linux
SEP: /
BAZEL_REPO: "~/.cache/bazelrepo"
BAZEL_DISK: "~/.cache/bazeldisk"
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Set up python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Cache disk
uses: actions/cache@v2
with:
path: ${{ matrix.BAZEL_DISK }}
key: ${{ runner.os }}-disk-2-${{ hashFiles('ts/yarn.lock') }}-${{ hashFiles('pip/requirements.txt') }}-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('**/BUILD.bazel') }}-${{ hashFiles('**/*.bzl') }}
- name: Cache repo
uses: actions/cache@v2
with:
path: ${{ matrix.BAZEL_REPO }}
key: ${{ runner.os }}-repo-2-${{ hashFiles('ts/yarn.lock') }}-${{ hashFiles('pip/requirements.txt') }}-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('**/BUILD.bazel') }}-${{ hashFiles('**/*.bzl') }}
################################
# Linux
################################
- name: Linux
if: matrix.os == 'ubuntu-20.04'
run: |
# disable command workflow processing
echo "::stop-commands::`echo -n ${{ github.token }} | sha256sum | head -c 64`"
set -x
sudo apt update
sudo apt install portaudio19-dev
curl -L https://github.com/bazelbuild/bazelisk/releases/download/v1.7.4/bazelisk-linux-amd64 -o ./bazel && \
chmod +x ./bazel
BAZEL="./bazel"
ARGS="--show_timestamps --isatty=0 --color=yes --disk_cache=${{ matrix.BAZEL_DISK }} --repository_cache=${{ matrix.BAZEL_REPO }}"
$BAZEL test ... $ARGS
$BAZEL build qt:runanki $ARGS
ANKI_IMPORT_ONLY=1 $BAZEL run qt:runanki
################################
# Mac
################################
- name: Mac
if: matrix.os == 'macos-latest'
run: |
# disable command workflow processing
echo "::stop-commands::`echo -n ${{ github.token }} | sha256sum | head -c 64`"
set -x
brew install portaudio gnu-tar
# gnu tar for cache issue
echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH
BAZEL="bazel"
ARGS="--show_timestamps --isatty=0 --color=yes --disk_cache=${{ matrix.BAZEL_DISK }} --repository_cache=${{ matrix.BAZEL_REPO }}"
$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