From eb25d38ae97e879a6c3b9f7d8db30aa9b3991ebc Mon Sep 17 00:00:00 2001 From: Jonatan Ryman Date: Mon, 9 Sep 2024 19:19:52 +0200 Subject: [PATCH 1/3] Add action --- .github/actions/install/action.yml | 16 ++++++++++ .github/workflows/main.yml | 51 ++++++++++++++++++++++++++++++ Makefile | 4 +-- 3 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 .github/actions/install/action.yml create mode 100644 .github/workflows/main.yml diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.yml new file mode 100644 index 0000000..b0688ad --- /dev/null +++ b/.github/actions/install/action.yml @@ -0,0 +1,16 @@ +name: Install dependencies +description: Install dependencies for the project +runs: + using: composite + steps: + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + cache: 'pip' + cache-dependency-path: .requirements.txt + - name: Install dependencies + shell: bash + run: | + python -m pip install --upgrade pip + pip install -r .requirements.txt diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..20bd2ed --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,51 @@ +name: Continuous integration + +on: + # Trigger the workflow on push or pull request, + push: + # Trigger the workflow via a manual run + workflow_dispatch: + +# Ensures that only one deploy task per branch/environment will run at a time. +concurrency: + group: environment-${{ github.ref }} + cancel-in-progress: true + +jobs: + install: + name: Install dependencies + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Check out repository + uses: actions/checkout@v4 + - name: Install dependencies + uses: ./.github/actions/install + + unit-test: + name: Run unit test + runs-on: ubuntu-latest + timeout-minutes: 10 + needs: [install] + steps: + - name: Check out repository + uses: actions/checkout@v4 + - name: Install dependencies + uses: ./.github/actions/install + - name: Run tests + run: python3 -m unittest discover + + lint: + name: Lint with Ruff + runs-on: ubuntu-latest + timeout-minutes: 10 + needs: [install] + steps: + - name: Check out repository + uses: actions/checkout@v4 + - name: Install dependencies + uses: ./.github/actions/install + - name: Lint with Ruff + run: | + pip install ruff + ruff check --output-format=github . diff --git a/Makefile b/Makefile index 5997bb7..7dd461f 100644 --- a/Makefile +++ b/Makefile @@ -153,7 +153,7 @@ coverage: .PHONY: install-tools install-tools: @$(call HELPTEXT,$@) - python3 -m pip install --requirement .requirements.txt + python3 -m pip install --requirement .requirements.txt @@ -161,7 +161,7 @@ install-tools: .PHONY: upgrade-tools upgrade-tools: @$(call HELPTEXT,$@) - python3 -m pip install --upgrade --requirement .requirements.txt + python3 -m pip install --upgrade --requirement .requirements.txt # target: check - Check versions of installed devtools. From 6846c7a22dacb3d4eea982f1d03a1b0b8dd2a3a5 Mon Sep 17 00:00:00 2001 From: Jonatan Karlsson Date: Mon, 9 Sep 2024 20:32:39 +0200 Subject: [PATCH 2/3] Updates after review --- .github/actions/install/action.yml | 3 +-- .github/workflows/main.yml | 22 ++++++++++------------ 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.yml index b0688ad..9598c7f 100644 --- a/.github/actions/install/action.yml +++ b/.github/actions/install/action.yml @@ -12,5 +12,4 @@ runs: - name: Install dependencies shell: bash run: | - python -m pip install --upgrade pip - pip install -r .requirements.txt + make install-tools diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 20bd2ed..97deec2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,8 +14,8 @@ concurrency: jobs: install: name: Install dependencies - runs-on: ubuntu-latest - timeout-minutes: 10 + runs-on: ubuntu-24.04 + timeout-minutes: 1 steps: - name: Check out repository uses: actions/checkout@v4 @@ -24,8 +24,8 @@ jobs: unit-test: name: Run unit test - runs-on: ubuntu-latest - timeout-minutes: 10 + runs-on: ubuntu-24.04 + timeout-minutes: 1 needs: [install] steps: - name: Check out repository @@ -33,19 +33,17 @@ jobs: - name: Install dependencies uses: ./.github/actions/install - name: Run tests - run: python3 -m unittest discover + run: make test lint: - name: Lint with Ruff - runs-on: ubuntu-latest - timeout-minutes: 10 + name: Lint with Pylint + runs-on: ubuntu-24.04 + timeout-minutes: 1 needs: [install] steps: - name: Check out repository uses: actions/checkout@v4 - name: Install dependencies uses: ./.github/actions/install - - name: Lint with Ruff - run: | - pip install ruff - ruff check --output-format=github . + - name: Lint with Pylint + run: make pylint From 896321f8df8c2378c1f10a801f726b347afb1065 Mon Sep 17 00:00:00 2001 From: Jonatan Karlsson Date: Mon, 9 Sep 2024 20:33:51 +0200 Subject: [PATCH 3/3] clean --- .github/actions/install/action.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.yml index 9598c7f..e8ed5c9 100644 --- a/.github/actions/install/action.yml +++ b/.github/actions/install/action.yml @@ -11,5 +11,4 @@ runs: cache-dependency-path: .requirements.txt - name: Install dependencies shell: bash - run: | - make install-tools + run: make install-tools