Add: Expand user for paths and change /homelocal/labbeti to ~ in defa… #213
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
# 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 ] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest,windows-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 | |
# note: ${GITHUB_REF##*/} gives the branch name | |
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 |