From 80e001aca52cb4b012ab4cac8a0b665f2c6a9c77 Mon Sep 17 00:00:00 2001 From: Tomas Peterka Date: Tue, 13 Feb 2024 12:33:46 +0100 Subject: [PATCH] chore(ci): add tests to CI --- .github/workflows/release.yml | 3 + .github/workflows/test.yml | 34 +++++++++++ .gitignore | 1 - .pre-commit-config.yaml | 2 - tests/local-template/poetry/poetry.lock | 78 ++++++++++++------------- tests/run.sh | 2 +- 6 files changed, 77 insertions(+), 43 deletions(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 649b5bd..2b80f84 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,6 +8,9 @@ jobs: name: Tag and Release runs-on: ubuntu-latest steps: + - name: Test first + uses: test.yml + - name: Checkout repository (full-depth) uses: actions/checkout@v4 with: { fetch-depth: 0 } # Required to determine version diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..3bda770 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,34 @@ +name: "[auto] test" + +on: + push: + branches: + - main + pull_request: + branches: + - main + workflow_call: + +jobs: + build: + name: Run automated tests + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install tools + run: python3 -m pip install --upgrade pip setuptools wheel + + - name: Install DEV dependencies + run: pip install -e .[dev] + + - name: Run pro-commit checks + run: | + pip install pre-commit + pre-commit run --all-files + + - name: Run tests + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: env GITHUB_TOKEN=$GITHUB_TOKEN bash run_tests.sh diff --git a/.gitignore b/.gitignore index 9e73593..9a58687 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,3 @@ *.egg-info *.pyc *.pyo - diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a2d0bf8..9497008 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -35,8 +35,6 @@ repos: stages: [pre-commit] - id: check-added-large-files stages: [pre-commit] - - id: detect-aws-credentials - stages: [pre-commit] - id: detect-private-key stages: [pre-commit] - id: check-json diff --git a/tests/local-template/poetry/poetry.lock b/tests/local-template/poetry/poetry.lock index c399ef1..42ac9f4 100644 --- a/tests/local-template/poetry/poetry.lock +++ b/tests/local-template/poetry/poetry.lock @@ -1,39 +1,39 @@ -# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. - -[[package]] -name = "click" -version = "8.1.7" -description = "Composable command line interface toolkit" -optional = false -python-versions = ">=3.7" -files = [ - {file = "click-8.1.7-py3-none-any.whl", hash = "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28"}, - {file = "click-8.1.7.tar.gz", hash = "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de"}, -] - -[package.dependencies] -colorama = {version = "*", markers = "platform_system == \"Windows\""} - -[[package]] -name = "dep1-poetry" -version = "1.0.0" -description = "The dummy dependency" -optional = false -python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" -files = [ - {file = "dummy.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, - {file = "dummy-1.0.0.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, -] - -[package.extras] -test = ["pytest (>=6)"] - -[[package]] -name = "future" -version = "0.18.3" -description = "Clean single-source support for Python 3 and 2" -optional = false -python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" -files = [ - {file = "future-0.18.3.tar.gz", hash = "sha256:34a17436ed1e96697a86f9de3d15a3b0be01d8bc8de9c1dffd59fb8234ed5307"}, -] +# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. + +[[package]] +name = "click" +version = "8.1.7" +description = "Composable command line interface toolkit" +optional = false +python-versions = ">=3.7" +files = [ + {file = "click-8.1.7-py3-none-any.whl", hash = "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28"}, + {file = "click-8.1.7.tar.gz", hash = "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "platform_system == \"Windows\""} + +[[package]] +name = "dep1-poetry" +version = "1.0.0" +description = "The dummy dependency" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +files = [ + {file = "dummy.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "dummy-1.0.0.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] + +[package.extras] +test = ["pytest (>=6)"] + +[[package]] +name = "future" +version = "0.18.3" +description = "Clean single-source support for Python 3 and 2" +optional = false +python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" +files = [ + {file = "future-0.18.3.tar.gz", hash = "sha256:34a17436ed1e96697a86f9de3d15a3b0be01d8bc8de9c1dffd59fb8234ed5307"}, +] diff --git a/tests/run.sh b/tests/run.sh index 217c053..6079e38 100644 --- a/tests/run.sh +++ b/tests/run.sh @@ -1,4 +1,4 @@ -set -e +set -ex export GIRA_TEST_ROOT=$PWD