Skip to content

Add unit tests for the benchmark repo #514

Add unit tests for the benchmark repo

Add unit tests for the benchmark repo #514

Workflow file for this run

name: PR
on:
pull_request:
branches:
- main
jobs:
lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- run: |
echo "PYTHON_VERSION=$(cat .python-version)" >> $GITHUB_ENV
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Pipenv
run: pip install pipenv==2022.9.24
- name: Cache virtualenv
id: cache-virtualenv
uses: actions/cache@v3
with:
path: ~/.local/share/virtualenvs/
key: ${{ runner.os }}-${{ env.PYTHON_VERSION }}-virtualenvs-${{ hashFiles('Pipfile.lock') }}
- name: Install virtual environment
if: steps.cache-virtualenv.outputs.cache-hit != 'true'
run: pipenv install --dev
- name: Lint scripts
run: make lint
test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- run:
echo "PYTHON_VERSION=$(cat .python-version)" >> $GITHUB_ENV
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install pipenv
run: pip install pipenv==2023.8.22
- name: Install virtual environment
run: pipenv install --dev
- name: Running unit tests
run: make test
docker-push:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Tag
run: |
CLEAN_TAG=$(echo "${{ github.event.pull_request.head.ref }}" | tr / -)
echo "TAG=$CLEAN_TAG" >> $GITHUB_ENV
- name: Build
run: docker build -t onsdigital/eq-survey-runner-benchmark:$TAG .
- name: Push
run: |
echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
echo "Pushing with tag [$TAG]"
docker push onsdigital/eq-survey-runner-benchmark:$TAG