From 3e7ed6627cac9eeeeaad391f179c1df4352ce048 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Wed, 6 Mar 2024 10:56:24 +1000 Subject: [PATCH] Fix build from master workflow (#63) * Fix build from master workflow * Make test more robust --- .github/workflows/build.yml | 19 ++++++++++++++----- felt/test/test_recent_projects_model.py | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5ae63ac..4751f0c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,10 +9,13 @@ jobs: steps: - name: Get source code - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + # To fetch tags + fetch-depth: 0 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.10" cache: "pip" @@ -26,13 +29,19 @@ jobs: - name: Install Python requirements run: pip install -r requirements/packaging.txt + - name: Set plugin version environment variables + run: | + TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) + echo "VERSION=$(echo ${TAG} | awk -F. -v OFS=. 'NF==1{print ++$NF}; NF>1{if(length($NF+1)>length($NF))$(NF-1)++; $NF=sprintf("%0*d", length($NF), ($NF+1)%(10^length($NF))); print}')-alpha" >> $GITHUB_ENV + echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV + - name: Build package run: | - qgis-plugin-ci package dev-${GITHUB_SHA} + qgis-plugin-ci --no-validation package ${{ env.VERSION }} mkdir tmp - unzip felt.dev-${GITHUB_SHA}.zip -d tmp + unzip felt.${{ env.VERSION }}.zip -d tmp - uses: actions/upload-artifact@v2 with: - name: felt_plugin + name: felt_plugin.${{ env.VERSION }}.${{ env.SHA_SHORT }} path: tmp diff --git a/felt/test/test_recent_projects_model.py b/felt/test/test_recent_projects_model.py index b2119b8..13e9109 100644 --- a/felt/test/test_recent_projects_model.py +++ b/felt/test/test_recent_projects_model.py @@ -51,7 +51,7 @@ def test_pretty_date(self): self.assertEqual(model.pretty_format_date(two_weeks_ago), "2 weeks ago") - one_month_ago = now.addMonths(-1) + one_month_ago = now.addDays(-35) self.assertEqual(model.pretty_format_date(one_month_ago), "1 month ago")