diff --git a/.circleci/config.yml b/.circleci/config.yml index 2aa989d..48eafc8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,38 +1,6 @@ version: 2.1 -executors: - ubuntu_docker: - docker: - # Match target OS of TLJH - - image: ubuntu:18.04 - working_directory: ~/repo - commands: - setup_venv: - description: Setup hub venv - steps: - - run: - name: Setup venv - command: | - python3 -m venv /srv/venv - echo 'export PATH=/srv/venv/bin:$PATH' >> $BASH_ENV - - install_python: - description: Install python3, venv, git and make - steps: - - run: - name: install python - command: | - apt-get update --yes && apt-get install --yes python3 python3-venv git make - - upgrade_pip: - description: Upgrade the pip version to 20.0.* - steps: - - run: - name: upgrade pip - command: | - python3 -m pip install -U pip==20.0.* - build_systemd_image: steps: - run: @@ -114,45 +82,6 @@ commands: jobs: - unit-test: - executor: ubuntu_docker - steps: - - checkout - - # Setup Python - - install_python - - # Download and cache dependencies - - restore_cache: - keys: - - v1-dependencies-py3.6-{{ checksum "setup.py" }}-{{ checksum "dev-requirements.txt" }} - - v1-dependencies-py3.6- - - - setup_venv - - - upgrade_pip - - - run: - name: install dependencies - command: | - pip install -r dev-requirements.txt - pip install -e . - - - save_cache: - paths: - - /srv/venv/ - key: v1-dependencies-py3.6-{{ checksum "setup.py" }}-{{ checksum "dev-requirements.txt" }} - - - run: - name: run unit tests - command: | - py.test --cov=tljh tests/ - - - run: - name: upload code coverage stats - command: | - codecov - integration-test: docker: - image: docker:18.05.0-ce-git @@ -216,6 +145,5 @@ workflows: version: 2 all-tests: jobs: - - unit-test - integration-test - upgrade-test diff --git a/.github/workflows/unit-test.yaml b/.github/workflows/unit-test.yaml new file mode 100644 index 0000000..a3f15cb --- /dev/null +++ b/.github/workflows/unit-test.yaml @@ -0,0 +1,36 @@ +on: + pull_request: + push: + workflow_dispatch: + +jobs: + unit-test: + runs-on: ubuntu-18.04 + container: ubuntu:18.04 + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: 3.6 + - name: Install and setup venv + run: | + apt-get update --yes && apt-get install --yes python3-venv + python3 -m venv /srv/venv + echo '/srv/venv/bin' >> $GITHUB_PATH + - name: Cache pip deps + uses: actions/cache@v2 + with: + path: /srv/venv/ + key: ${{ runner.os }}-pip-dependencies-${{ hashFiles('*setup.py', '*dev-requirements.txt') }} + - name: Install Python dependencies + run: | + python3 -m pip install -U pip==20.0.* + python3 -m pip install -r dev-requirements.txt + python3 -m pip install -e . + pip freeze + - name: Run unit tests + run: | + pytest --cov=tljh tests/ + - name: Upload code coverage stats + run: | + codecov