Merge pull request #8 from Namgyu-Youn/04-GitHub_Action #41
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: CI/CD Workflow | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
lint-and-test: | |
strategy: | |
matrix: | |
# os: [ubuntu-latest] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ['3.11'] | |
# python-version: ['3.10', '3.11'] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Hadolint | |
uses: hadolint/[email protected] | |
continue-on-error: true | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: poetry install --no-interaction | |
- name: Run linters | |
run: | | |
poetry run ruff check . | |
poetry run ruff format . | |
- name: ONNX Model Conversion | |
run: | | |
poetry run python -c "from scripts.analyzer import TopicAnalyzer; analyzer = TopicAnalyzer(); analyzer._convert_to_onnx()" | |
- name: Run tests | |
run: | | |
poetry run pytest tests/ | |
poetry run pytest --cov=topicgen |