From b033af8ae56d6114b2da15ed3ffb9f2e10de9836 Mon Sep 17 00:00:00 2001 From: Kirk Byers Date: Tue, 21 May 2024 11:25:34 -0700 Subject: [PATCH] Adding GH Actions to gne_tests --- .github/workflows/std_tests.yaml | 72 ++++++++++++++++++++++++++++++++ gh_actions.sh | 23 ++++++++++ 2 files changed, 95 insertions(+) create mode 100644 .github/workflows/std_tests.yaml create mode 100755 gh_actions.sh diff --git a/.github/workflows/std_tests.yaml b/.github/workflows/std_tests.yaml new file mode 100644 index 0000000..8ff556f --- /dev/null +++ b/.github/workflows/std_tests.yaml @@ -0,0 +1,72 @@ +--- +name: GNE Standard Tests +on: [push,pull_request] + +jobs: + linters: + name: linters + runs-on: ubuntu-22.04 + steps: + - name: "List files and directories" + run: | + pwd + ls -al . + ls -al .. + + - name: Checkout 'gne_tests' repository + uses: actions/checkout@v4 + + - name: Checkout 'gne_exercises' repository (actions/checkout doesn't work) + run: ./gh_actions.sh + + - name: "List files and directories" + run: | + pwd + ls -al . + ls -al .. + +# - name: Setup python +# uses: actions/setup-python@v5 +# id: cp311 +# with: +# python-version: '3.11' +# architecture: x64 +# +# - name: Install Poetry +# uses: snok/install-poetry@v1 +# with: +# version: 1.7.1 +# virtualenvs-create: true +# virtualenvs-in-project: true +# +# - name: Cache Poetry virtualenv +# uses: actions/cache@v4 +# id: cached-poetry-dependencies +# with: +# path: .venv +# key: venv-${{ runner.os }}-cache-${{ steps.cp311.outputs.version }}-${{ hashFiles('**/poetry.lock') }} +# +# - name: Install Virtual Environment Dependencies +# run: poetry install -C gne_tests/ +# # if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' +# +# - name: "List files and directories" +# run: | +# pwd +# ls -al . +# ls -al .. +# +# - name: View installed packages +# run: | +# poetry run -C gne_tests python -m pip list +# +# - name: Run pylama on 'gne_tests' and 'gne_exercises' +# run: | +# poetry run -C gne_tests pylama --config=gne_tests/setup.cfg . +# poetry run -C gne_tests pylama --config=gne_tests/setup.cfg ../gne_exercises/ +# +# - name: Run black on 'gne_tests' and 'gne_exercises' +# run: | +# poetry run -C gne_tests black --check . +# poetry run -C gne_tests black --check ../gne_exercises/ +# diff --git a/gh_actions.sh b/gh_actions.sh new file mode 100755 index 0000000..b07ca69 --- /dev/null +++ b/gh_actions.sh @@ -0,0 +1,23 @@ +#!/bin/sh +if [ "$GITHUB_ACTIONS" != "true" ]; then + echo "Not running in GitHub Actions environment. Exiting..." + exit 1 +fi + +EXERCISE_DIR="gne_exercises" +CURRENT_DIR=$(pwd) +REPO="twin-bridges/gne_exercises" +cd .. + +if [ ! -d "$EXERCISE_DIR" ]; then + mkdir "$EXERCISE_DIR" +fi + +if [ -d "$EXERCISE_DIR" ]; then + cd "$EXERCISE_DIR" + git init + git remote add origin https://github.com/"$REPO" + git pull origin main +fi + +cd "$CURRENT_DIR"