Skip to content

Commit

Permalink
ci: more boolean fixes and respecting skip_rust
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Jul 22, 2022
1 parent b48bbdd commit ba6ad08
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
os: [ubuntu-20.04, windows-latest, macOS-latest]
python_version: [3.8]
node_version: [16]
rust: [true]
skip_rust: [false]
skip_webui: [false]
experimental: [false]

Expand Down Expand Up @@ -65,13 +65,13 @@ jobs:
PYTHON_VERSION: ${{ matrix.python_version }}.9

- name: Set up Node
if: ${{ !(matrix.skip_webui == 'true') }}
if: ${{ !matrix.skip_webui }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node_version }}

- name: Set up Rust nightly
if: ${{ matrix.rust }}
if: ${{ !matrix.skip_rust }}
uses: actions-rs/toolchain@v1
id: toolchain
with:
Expand All @@ -86,7 +86,7 @@ jobs:
- uses: actions/cache@v1
name: Cache npm
if: ${{ !(matrix.skip_webui == 'true') }}
if: ${{ !matrix.skip_webui }}
env:
cache-name: node
with:
Expand All @@ -97,7 +97,7 @@ jobs:
- name: Cache cargo build
uses: actions/cache@v1
if: ${{ (matrix.rust == 'true') && (runner.os != 'macOS') }} # cache doesn't seem to behave nicely on macOS, see: https://github.com/ActivityWatch/aw-server-rust/issues/180
if: ${{ !matrix.skip_rust && (runner.os != 'macOS') }} # cache doesn't seem to behave nicely on macOS, see: https://github.com/ActivityWatch/aw-server-rust/issues/180
env:
cache-name: cargo-build-target
with:
Expand Down Expand Up @@ -144,13 +144,13 @@ jobs:
python3 -m virtualenv venv
source venv/bin/activate || source venv/Scripts/activate
poetry install
make build SKIP_WEBUI=${{ matrix.skip_webui }} SKIP_SERVER_RUST=${{ !(matrix.rust == 'true') }}
make build SKIP_WEBUI=${{ matrix.skip_webui }} SKIP_SERVER_RUST=${{ matrix.skip_rust }}
- name: Run tests
shell: bash
run: |
source venv/bin/activate || source venv/Scripts/activate
make test SKIP_SERVER_RUST=${{ !(matrix.rust == 'true') }}
make test SKIP_SERVER_RUST=${{ matrix.skip_rust }}
# Don't run integration tests on Windows, doesn't work for some reason
- name: Run integration tests
Expand All @@ -164,7 +164,7 @@ jobs:
run: |
source venv/bin/activate || source venv/Scripts/activate
poetry install # run again to ensure we have the correct version of PyInstaller
make package SKIP_SERVER_RUST=${{ !(matrix.rust == 'true') }}
make package SKIP_SERVER_RUST=${{ matrix.skip_rust }}
- name: Package dmg
if: startsWith(runner.os, 'macOS')
Expand Down
17 changes: 12 additions & 5 deletions aw.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
import os
import platform
import subprocess
import aw_core
import flask_restx
import shlex
from pathlib import Path

import flask_restx

import aw_core

current_release = subprocess.run(
shlex.split("git describe --tags --abbrev=0"),
stdout=subprocess.PIPE,
Expand Down Expand Up @@ -49,6 +51,11 @@ if platform.system() == "Windows":
pyqt_path = os.path.dirname(PyQt5.__file__)
extra_pathex.append(pyqt_path + "\\Qt\\bin")

skip_rust = False
if not aw_server_rust_bin.exists():
skip_rust = True
print("Skipping Rust build because aw-server-rust binary not found.")

aw_server_a = Analysis(
["aw-server/__main__.py"],
pathex=[],
Expand All @@ -71,11 +78,11 @@ aw_server_a = Analysis(
aw_qt_a = Analysis(
[aw_qt_location / "aw_qt/__main__.py"],
pathex=[] + extra_pathex,
binaries=[(aw_server_rust_bin, ".")],
binaries=[(aw_server_rust_bin, ".")] if not skip_rust else [],
datas=[
(aw_qt_location / "resources/aw-qt.desktop", "aw_qt/resources"),
(aw_server_rust_webui, "aw_server_rust/static"),
],
]
+ ([(aw_server_rust_webui, "aw_server_rust/static")] if not skip_rust else []),
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
Expand Down

0 comments on commit ba6ad08

Please sign in to comment.