From 70e88de15ddfe1f24d0c83ffb49a5375c8a387dd Mon Sep 17 00:00:00 2001
From: Kevin Liu <kevinjqliu@users.noreply.github.com>
Date: Sun, 3 Mar 2024 10:26:22 -0800
Subject: [PATCH 1/4] cache poetry in ci

---
 .github/actions/install-env/action.yml | 42 ++++++++++++++++++++++++++
 .github/workflows/python-ci.yml        | 22 ++++++++------
 2 files changed, 55 insertions(+), 9 deletions(-)
 create mode 100644 .github/actions/install-env/action.yml

diff --git a/.github/actions/install-env/action.yml b/.github/actions/install-env/action.yml
new file mode 100644
index 0000000000..f3fa74c8fc
--- /dev/null
+++ b/.github/actions/install-env/action.yml
@@ -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: ['3.8', '3.9', '3.10', '3.11']
+
+    - 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
\ No newline at end of file
diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml
index 2983c890af..1896f802cc 100644
--- a/.github/workflows/python-ci.yml
+++ b/.github/workflows/python-ci.yml
@@ -38,16 +38,20 @@ jobs:
 
     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: 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
+
     - name: Linters
       run: make lint
+
     - name: Tests
       run: make test-coverage

From bb89b8cdb8aeaf230cd02b82dbdaebbb9645ac06 Mon Sep 17 00:00:00 2001
From: Kevin Liu <kevinjqliu@users.noreply.github.com>
Date: Sun, 3 Mar 2024 10:28:51 -0800
Subject: [PATCH 2/4] run action for branch

---
 .github/workflows/python-ci.yml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml
index 1896f802cc..a9d814e13d 100644
--- a/.github/workflows/python-ci.yml
+++ b/.github/workflows/python-ci.yml
@@ -24,6 +24,8 @@ on:
     branches:
     - 'main'
   pull_request:
+    branches:
+      - "*"
 
 concurrency:
   group: ${{ github.workflow }}-${{ github.ref }}

From d12f81853047c75211f4c542baecb57f9fae3dfe Mon Sep 17 00:00:00 2001
From: Kevin Liu <kevinjqliu@users.noreply.github.com>
Date: Sun, 3 Mar 2024 10:46:31 -0800
Subject: [PATCH 3/4] matrix python-version

---
 .github/actions/install-env/action.yml |  2 +-
 .github/workflows/python-ci.yml        | 13 +------------
 2 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/.github/actions/install-env/action.yml b/.github/actions/install-env/action.yml
index f3fa74c8fc..85488aa240 100644
--- a/.github/actions/install-env/action.yml
+++ b/.github/actions/install-env/action.yml
@@ -11,7 +11,7 @@ runs:
       id: set-up-python
       uses: actions/setup-python@v4
       with:
-        python-version: ['3.8', '3.9', '3.10', '3.11']
+        python-version: ${{ matrix.python-version }}
 
     - name: Load cached Poetry installation
       uses: actions/cache@v3
diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml
index a9d814e13d..a596d0817a 100644
--- a/.github/workflows/python-ci.yml
+++ b/.github/workflows/python-ci.yml
@@ -36,22 +36,11 @@ 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
     - uses: ./.github/actions/install-env
-    # - 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
-
     - name: Linters
       run: make lint
 

From b47f0900ac92ca52d82d736f36922427b5c8ec90 Mon Sep 17 00:00:00 2001
From: Kevin Liu <kevinjqliu@users.noreply.github.com>
Date: Sun, 3 Mar 2024 11:18:25 -0800
Subject: [PATCH 4/4] make lint

---
 .github/actions/install-env/action.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/actions/install-env/action.yml b/.github/actions/install-env/action.yml
index 85488aa240..0b93e039ef 100644
--- a/.github/actions/install-env/action.yml
+++ b/.github/actions/install-env/action.yml
@@ -39,4 +39,4 @@ runs:
 
     - name: Activate environment
       shell: bash
-      run: source $VENV
\ No newline at end of file
+      run: source $VENV