From 70fe241000dfdf46294a24ddda3fae1b70e7f7a4 Mon Sep 17 00:00:00 2001 From: Benjamin Dornel Date: Wed, 8 Nov 2023 23:01:40 +0800 Subject: [PATCH] refactor(ci): switch from docker to local gha runner tests --- .github/workflows/tests.yaml | 43 ++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index c5c4f709..69623e91 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -2,9 +2,6 @@ name: tests on: pull_request -env: - TEST_TAG: monopoly-test:latest - jobs: tests: runs-on: ubuntu-latest @@ -12,26 +9,30 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Set up Git Crypt + - uses: actions/cache@v3 + id: brew-cache + with: + path: /home/linuxbrew/.linuxbrew + key: brew-packages-${{ runner.os }}-${{ hashFiles('.github/workflows/main.yml') }} + restore-keys: | + brew-packages-${{ runner.os }}- + + - name: Install pdftotext dependencies + run: | + sudo apt-get update && sudo apt-get -y install build-essential libpoppler-cpp-dev pkg-config + + - name: Setup Python & Poetry + uses: ./.github/actions/setup-python-poetry + with: + python-version: "3.11" + poetry-version: "1.6.1" + + - name: Install git crypt/john & run tests run: | eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" - brew install git-crypt + brew fetch git-crypt & brew fetch john-jumbo + brew install git-crypt john-jumbo echo '${{ secrets.GIT_CRYPT_KEY }}' | base64 --decode > /tmp/git-crypt-key git-crypt unlock /tmp/git-crypt-key rm /tmp/git-crypt-key - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Build image - uses: docker/build-push-action@v4 - with: - context: . - load: true - target: test - tags: ${{ env.TEST_TAG }} - cache-from: type=gha,scope=test - cache-to: type=gha,mode=max,scope=test - - - name: Test - run: docker run --rm ${{ env.TEST_TAG }} + poetry run task test