From fc58f57d10e95c0f64e6c5ce21550e7b19bbf420 Mon Sep 17 00:00:00 2001 From: thatmattlove Date: Fri, 1 Mar 2024 23:20:02 -0500 Subject: [PATCH] update ci jobs --- .github/workflows/backend.yml | 93 ++++++++++++++++----------------- .github/workflows/frontend.yml | 68 ++++++++++++------------ .github/workflows/installer.yml | 20 ------- .tests/ga-backend-app.sh | 9 ++-- 4 files changed, 84 insertions(+), 106 deletions(-) delete mode 100644 .github/workflows/installer.yml diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml index 2be3bfa..1ce7212 100644 --- a/.github/workflows/backend.yml +++ b/.github/workflows/backend.yml @@ -1,61 +1,60 @@ name: Backend Testing on: - - push - - pull_request + - push + - pull_request jobs: - backend: - name: Backend Tests - strategy: - fail-fast: false - matrix: - node-version: [18.x] - redis-version: [6] - poetry-version: [1.2.2] - python-version: [3.9] - os: [ubuntu-latest] - runs-on: ${{ matrix.os }} + backend: + name: Backend Tests + strategy: + fail-fast: false + matrix: + node-version: [20.x] + redis-version: [7] + python-version: [3.9, 3.10, 3.11] + os: [ubuntu-latest] + runs-on: ${{ matrix.os }} - steps: - - name: Git Checkout - uses: actions/checkout@v3 + steps: + - name: Git Checkout + uses: actions/checkout@v3 - - name: Install Python - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} + - name: Install Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} - - name: Install Poetry - uses: abatilo/actions-poetry@v2.2.0 - with: - poetry-version: ${{ matrix.poetry-version }} + - name: Setup Rye + uses: sksat/setup-rye@v0.8.0 - - name: Install Node - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} + - name: Install Node + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} - - name: Start Redis - uses: supercharge/redis-github-action@1.1.0 - with: - redis-version: ${{ matrix.redis-version }} + - name: Start Redis + uses: supercharge/redis-github-action@1.7.0 + with: + redis-version: ${{ matrix.redis-version }} - - name: Prepare - run: | - mkdir -p "$HOME/hyperglass" - echo "HYPERGLASS_APP_PATH=$HOME/hyperglass" >> $GITHUB_ENV - echo "HYPERGLASS_HOST=127.0.0.1" >> $GITHUB_ENV - echo "HYPERGLASS_PORT=8001" >> $GITHUB_ENV + - name: Prepare + run: | + mkdir -p "$HOME/hyperglass" + echo "HYPERGLASS_APP_PATH=$HOME/hyperglass" >> $GITHUB_ENV + echo "HYPERGLASS_HOST=127.0.0.1" >> $GITHUB_ENV + echo "HYPERGLASS_PORT=8001" >> $GITHUB_ENV - - name: Install (Poetry) - run: poetry install + - name: Enter venv + run: . .venv/bin/activate - - name: Lint (Flake8) - run: poetry run task lint + - name: Install + run: rye install - # This needs to come before testing, so redis is pre-populated. - - name: Run hyperglass - run: '.tests/ga-backend-app.sh' + - name: Lint (Rye) + run: rye lint - - name: Test (PyTest) - run: poetry run task test + - name: Tests (PyTest) + run: task test + + - name: Run hyperglass + run: ".tests/ga-backend-app.sh" diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index eb95b74..0dc8033 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -1,44 +1,44 @@ name: Frontend Testing on: - - push - - pull_request + - push + - pull_request jobs: - frontend: - name: Frontend Tests - strategy: - fail-fast: false - matrix: - node-version: [18.x] - os: [ubuntu-latest] - runs-on: ${{ matrix.os }} - env: - working-directory: ./hyperglass/ui - steps: - - name: Git Checkout - uses: actions/checkout@v3 + frontend: + name: Frontend Tests + strategy: + fail-fast: false + matrix: + node-version: [20.x] + os: [ubuntu-latest] + runs-on: ${{ matrix.os }} + env: + working-directory: ./hyperglass/ui + steps: + - name: Git Checkout + uses: actions/checkout@v3 - - name: Install Node - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} + - name: Install Node + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} - - name: Install Dependencies - working-directory: ${{ env.working-directory }} - run: yarn install + - name: Install Dependencies + working-directory: ${{ env.working-directory }} + run: pnpm install - - name: Formatting (Prettier) - working-directory: ${{ env.working-directory }} - run: yarn format:check + - name: Formatting + working-directory: ${{ env.working-directory }} + run: pnpm run format:check - - name: Lint (ESLint) - working-directory: ${{ env.working-directory }} - run: yarn lint + - name: Lint + working-directory: ${{ env.working-directory }} + run: pnpm run lint - - name: Types (TypeScript) - working-directory: ${{ env.working-directory }} - run: yarn typecheck + - name: Check Types + working-directory: ${{ env.working-directory }} + run: pnpm run typecheck - - name: Tests (Jest) - working-directory: ${{ env.working-directory }} - run: yarn test + - name: Tests + working-directory: ${{ env.working-directory }} + run: pnpm run test diff --git a/.github/workflows/installer.yml b/.github/workflows/installer.yml deleted file mode 100644 index e5e7a7b..0000000 --- a/.github/workflows/installer.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Installer Testing -on: - - push - - pull_request - -jobs: - installer: - name: Installer Tests - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - runs-on: ${{ matrix.os }} - - steps: - - name: Git Checkout - uses: actions/checkout@v3 - - - name: Run hyperglass - run: 'sudo bash ./install.sh' diff --git a/.tests/ga-backend-app.sh b/.tests/ga-backend-app.sh index fa7e3bf..be779d9 100755 --- a/.tests/ga-backend-app.sh +++ b/.tests/ga-backend-app.sh @@ -3,11 +3,10 @@ LOG_FILE="$HOME/hyperglass-ci.log" touch /tmp/hyperglass.log -export POETRY_HYPERGLASS_UI_BUILD_TIMEOUT="600" -echo "[INFO] Set build timeout to $POETRY_HYPERGLASS_UI_BUILD_TIMEOUT seconds" +. .venv/bin/activate echo "[INFO] Starting setup..." -poetry run hyperglass setup -d &>$LOG_FILE +python3 -m hyperglass.console setup -d &>$LOG_FILE echo "[SUCCESS] Setup completed." sleep 2 @@ -18,7 +17,7 @@ echo "[INFO] Copying devices.yaml file..." cp ./.tests/devices.yaml $HOME/hyperglass/devices.yaml echo "[INFO] Starting UI build." -poetry run hyperglass build-ui &>$LOG_FILE +python3 -m hyperglass.console build-ui &>$LOG_FILE if [[ ! $? == 0 ]]; then echo "[ERROR] Failed to build hyperglass ui." @@ -30,7 +29,7 @@ else fi echo "[INFO] Starting hyperglass..." -poetry run hyperglass start &>$LOG_FILE & +python3 -m hyperglass.console start &>$LOG_FILE & sleep 120 if [[ ! $? == 0 ]]; then