diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index c303ec09a..70783cf33 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -17,94 +17,28 @@ jobs: set -x .github/scripts/contrib.sh - ################################ - # Matrix generation - ################################ - - check_tag: - name: Matrix Generation - outputs: - tagged: ${{ steps.check_tagged.outputs.tagged }} - matrix: ${{ steps.check_tagged.outputs.matrix }} - runs-on: ubuntu-latest - steps: - - name: Check the ref - id: check_tagged - run: | - set -x - printf '%s' '#!/usr/bin/env python3 - # -*- coding: utf-8 -*- - - import json - import argparse - - matrix = json.loads(r""" - { - "BUILD_TYPE": [ - "check" - ], - "os": [ - "ubuntu-latest", - "macos-latest" - ], - "python": [ - 3.8 - ], - "include": [ - { - "os": "ubuntu-latest", - "name": "Ubuntu", - "SEP": "/", - "BAZEL_REPO": "~/.cache/bazelrepo", - "BAZEL_DISK": "~/.cache/bazeldisk", - "ANKI_PYTHON_WHEELS": "anki_linux_python" - }, - { - "os": "macos-latest", - "name": "Mac OS", - "SEP": "/", - "BAZEL_REPO": "~/Library/Caches/bazelrepo", - "BAZEL_DISK": "~/Library/Caches/bazeldisk", - "ANKI_PYTHON_WHEELS": "anki_macos_python" - } - ] - } - """) - - parser = argparse.ArgumentParser(description="Dynamically creates a build matrix for the GitHub Actions.") - parser.add_argument("--tagged", action="store_true", default=False, - help="Skip checks on release build") - - args = parser.parse_args() - - # if args.tagged: - # pass - # else: - # matrix["BUILD_TYPE"].append("check") - - 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 - printf '::set-output name=tagged::%s\n' "" - printf '::set-output name=matrix::%s\n' "$(python3 buildmatrix.py)" - fi - ################################ # Tests ################################ tests: - needs: - - check_tag - name: ${{ matrix.name }} ${{ needs.check_tag.outputs.tagged }} ${{ matrix.BUILD_TYPE }} ${{ matrix.python }} + name: ${{ matrix.name }} ${{ matrix.python }} runs-on: ${{ matrix.os }} strategy: - matrix: ${{ fromJson( needs.check_tag.outputs.matrix ) }} + 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: @@ -119,20 +53,20 @@ jobs: uses: actions/cache@v2 with: path: ${{ matrix.BAZEL_DISK }} - key: ${{ runner.os }}-disk-2-${{ hashFiles('ts/yarn.lock') }}-${{ hashFiles('pip/requirements.txt') }}-${{ hashFiles('cargo/Cargo.lock') }}-${{ hashFiles('**/BUILD.bazel') }}-${{ hashFiles('**/*.bzl') }} + 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/Cargo.lock') }}-${{ hashFiles('**/BUILD.bazel') }}-${{ hashFiles('**/*.bzl') }} + 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-latest' + if: matrix.os == 'ubuntu-20.04' run: | # disable command workflow processing echo "::stop-commands::`echo -n ${{ github.token }} | sha256sum | head -c 64`" @@ -171,60 +105,3 @@ jobs: # the rsync workaround is not required in CI, as it's working # around a webengine issue ANKI_IMPORT_ONLY=1 $BAZEL run qt:runanki - - ################################ - # Windows - ################################ - - # - name: Windows - # if: matrix.os == 'windows-latest' - # run: | - # Set-PSDebug -Trace 1 - - # $env:PATH = "$env:PATH;c:\msys64\usr\bin" - - # $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\`"" - - # curl --fail -L https://github.com/bazelbuild/bazelisk/releases/download/v1.7.4/bazelisk-windows-amd64.exe -o .\bazel.exe - - # # try build a few times to compensate for rollup flakiness - - # 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" - - # - 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/*