Skip to content

Mod: Refactor interal vocab code. #375

Mod: Refactor interal vocab code.

Mod: Refactor interal vocab code. #375

# Template: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python package using Pip
on:
push:
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]
env:
CACHE_NUMBER: 0 # increase to reset cache manually
AAC_METRICS_TMP_PATH: '/tmp'
# Cancel workflow if a new push occurs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest,windows-latest,macos-latest]
python-version: ["3.9"]
java-version: ["11"]
steps:
# --- INSTALLATIONS ---
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Set up Java ${{ matrix.java-version }}
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: ${{ matrix.java-version }}
java-package: jre
- name: Install package
shell: bash
# note: ${GITHUB_REF##*/} gives the branch name
# note 2: dev is NOT the branch here, but the dev dependencies
run: |
python -m pip install "aac-metrics[dev] @ git+https://github.com/Labbeti/aac-metrics@${GITHUB_REF##*/}"
- name: Load cache of external code and data
uses: actions/cache@master
id: cache_external
with:
path: /home/runner/.cache/aac-metrics/*
key: ${{ runner.os }}-${{ hashFiles('src/aac_metrics/download.py') }}
restore-keys: |
${{ runner.os }}-
# --- TESTS ---
- name: Compile python files
run: |
python -m compileall src
- name: Lint with flake8
run: |
python -m flake8 --config .flake8 --exit-zero --show-source --statistics src
- name: Check format with Black
run: |
python -m black --check --diff src
- name: Print install info
run: |
aac-metrics-info
- name: Print Java version
run: |
java -version
- name: Install external code if needed
if: steps.cache_external.outputs.cache-hit != 'true'
run: |
aac-metrics-download
- name: Test with pytest
run: |
python -m pytest -v