Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kevinjqliu/GitHub action #1

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/actions/install-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Install env
runs:
using: "composite"
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
submodules: true

- name: Set up python
id: set-up-python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Load cached Poetry installation
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-0

- name: Install poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

- name: Load cached virtual env
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.set-up-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
shell: bash
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: make install-dependencies

- name: Activate environment
shell: bash
run: source $VENV
15 changes: 5 additions & 10 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ on:
branches:
- 'main'
pull_request:
branches:
- "*"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -34,20 +36,13 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
python: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v4
- name: Install poetry
run: make install-poetry
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: poetry
cache-dependency-path: ./poetry.lock
- name: Install
run: make install-dependencies
- uses: ./.github/actions/install-env
- name: Linters
run: make lint

- name: Tests
run: make test-coverage
Loading