MAPEX-27: Implement CI/CD System #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Explorer Tests | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
jobs: | |
mappings_explorer_tests: | |
runs-on: ubuntu-latest | |
steps: | |
# Configure Environment | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install Python | |
id: setup-python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
# Prepare Poetry from cache | |
# - name: Attempt Poetry install from cache | |
# uses: actions/cache@v3 | |
# id: cached-poetry | |
# with: | |
# path: ./.poetry | |
# key: venv::${{ runner.os }}::${{ steps.setup-python.outputs.python-version }}::poetry | |
# - name: Install Poetry | |
# if: steps.cached-poetry.outputs.cache-hit != 'true' | |
# run: | | |
# python -m venv .poetry | |
# source ./.poetry/bin/activate | |
# pip install poetry | |
# mkdir ./.poetry/.bin | |
# ln -s ./.poetry/bin/poetry ./.poetry/.bin/poetry | |
# deactivate | |
# - name: Add Poetry to PATH | |
# run: echo "$PWD/.poetry/.bin" >> $GITHUB_PATH | |
# Prepare Poetry | |
- name: Install Poetry | |
run: curl -sSL https://install.python-poetry.org/ | python - | |
- name: Add Poetry to PATH | |
run: echo "$HOME/.poetry/bin" >> $GITHUB_PATH | |
# Prepare Virtual Environment | |
- name: Configure Poetry | |
run: poetry config virtualenvs.in-project true | |
- name: Load cached virtual environment | |
uses: actions/cache@v3 | |
id: cached-dependencies | |
with: | |
path: ./src/explorer/.venv | |
key: venv::${{ runner.os }}::${{ steps.setup-python.outputs.python-version }}::${{ hashFiles('./src/explorer/poetry.lock') }} | |
- name: Install dependencies | |
if: steps.cached-dependencies.outputs.cache-hit != 'true' | |
working-directory: ./src/explorer | |
run: poetry install --no-interaction --no-root | |
- name: Install Mappings Explorer | |
working-directory: ./src/explorer | |
run: poetry install --no-interaction --only-root | |
# Check Lint, Test, Security | |
- name: Lint Mappings Explorer | |
working-directory: ./src/explorer | |
run: poetry run invoke lint | |
- name: Test Mappings Explorer | |
working-directory: ./src/explorer | |
run: poetry run invoke test -xml | |
- name: Run Bandit security check | |
working-directory: ./src/explorer | |
run: poetry run bandit -r ./mappings_explorer -ll -ii | |
- name: Safety vulnerability check | |
working-directory: ./src/explorer | |
run: | | |
poetry export -f requirements.txt | poetry run safety check --full-report --stdin | |
# Upload Test Coverage | |
- name: Upload coverage to CodeCov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: $\{\{ secrets.CODECOV_SECRET \}\} | |
files: ./src/explorer/coverage.xml | |
verbose: true |