From 173fc6b14bcb4f8c82879b03ba99a4415c855905 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A9r=C3=A9nice=20Batut?= Date: Tue, 25 Jun 2024 11:17:51 +0200 Subject: [PATCH] Move tests from bash to GitHub Action --- .github/workflows/run_tests.yaml | 68 +++++++++++++++++++++++----- bin/extract_all_tools_test.sh | 15 ------ bin/extract_filter_tutorials_test.sh | 32 ------------- 3 files changed, 56 insertions(+), 59 deletions(-) delete mode 100755 bin/extract_all_tools_test.sh delete mode 100644 bin/extract_filter_tutorials_test.sh diff --git a/.github/workflows/run_tests.yaml b/.github/workflows/run_tests.yaml index 8929bd6f..1fb837a0 100644 --- a/.github/workflows/run_tests.yaml +++ b/.github/workflows/run_tests.yaml @@ -2,29 +2,73 @@ name: Run tests on: [push, pull_request] jobs: - test: + test-tools: runs-on: ubuntu-20.04 environment: fetch-tools - strategy: - matrix: - python-version: [3.8] - subset: - - test.list steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version }} + python-version: '3.11' - name: Install requirement run: python -m pip install -r requirements.txt - - name: Test tool extraction + - name: Tool extraction # run: bash bin/extract_all_tools.sh run: | - bash ./bin/extract_all_tools_test.sh "${{ matrix.subset }}" + python bin/extract_galaxy_tools.py \ + extractools \ + --api $GITHUB_API_KEY \ + --all-tools "results/test_tools.tsv" \ + --all-tools-json "results/test_tools.json" \ + --planemo-repository-list "test.list" \ + --test env: GITHUB_API_KEY: ${{ secrets.GH_API_TOKEN }} - - name: Test tutorial extraction and filtering + - name: Tool filter run: | - bash ./bin/extract_filter_tutorials_test.sh + python bin/extract_galaxy_tools.py \ + filtertools \ + --tools "results/all_tools.json" \ + --ts-filtered-tools "results/microgalaxy/tools_filtered_by_ts_categories.tsv" \ + --filtered-tools "results/microgalaxy/tools.tsv" \ + --categories "data/communities/microgalaxy/categories" \ + --status "data/communities/microgalaxy/tool_status.tsv" + - name: Create interactive table + run: | + python bin/create_interactive_table.py \ + --table "results/$community/tools.tsv" \ + --template "data/interactive_table_template.html" \ + --output "results/$community/index.html" + - name: Create wordcloud + run: | + python bin/create_wordcloud.py \ + --table "results/$community/tools.tsv" \ + --wordcloud_mask "data/usage_stats/wordcloud_mask.png" \ + --output "results/$community/tools_wordcloud.png" \ + --stats_column "No. of tool users (2022-2023) (usegalaxy.eu)" + test-tutorials: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.11' + - name: Install requirement + run: python -m pip install -r requirements.txt + - name: Tutorial extraction + run: | + python bin/extract_gtn_tutorials.py \ + extracttutorials \ + --all_tutorials "results/test_tutorials.json" \ + --tools "results/all_tools.json" \ + --api $PLAUSIBLE_API_KEY \ + --test env: - PLAUSIBLE_API_KEY: ${{ secrets.PLAUSIBLE_API_TOKEN }} \ No newline at end of file + PLAUSIBLE_API_KEY: ${{ secrets.PLAUSIBLE_API_TOKEN }} + - name: Tutorial filtering + run: | + python bin/extract_gtn_tutorials.py \ + filtertutorials \ + --all_tutorials "results/test_tutorials.json" \ + --filtered_tutorials "results/microgalaxy/test_tutorials.tsv" \ + --tags "data/communities/microgalaxy/tutorial_tags" \ No newline at end of file diff --git a/bin/extract_all_tools_test.sh b/bin/extract_all_tools_test.sh deleted file mode 100755 index 2ba40be5..00000000 --- a/bin/extract_all_tools_test.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -mkdir -p 'results/' - -tsv_output="results/${1}_tools.tsv" -json_output="results/${1}_tools.json" - -python bin/extract_galaxy_tools.py \ - extractools \ - --api $GITHUB_API_KEY \ - --all-tools $tsv_output \ - --all-tools-json $json_output \ - --planemo-repository-list $1 \ - --test - diff --git a/bin/extract_filter_tutorials_test.sh b/bin/extract_filter_tutorials_test.sh deleted file mode 100644 index b4d066c3..00000000 --- a/bin/extract_filter_tutorials_test.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash - -mkdir -p 'results/' - -tsv_output="results/${1}_tools.tsv" -json_output="results/${1}_tools.json" - -python bin/extract_gtn_tutorials.py \ - extracttutorials \ - --all_tutorials "results/test_tutorials.json" \ - --tools "results/all_tools.json" \ - --api $PLAUSIBLE_API_KEY \ - --test - -if [[ ! -f "results/test_tutorials.json" ]] ; then - echo 'File "results/test_tutorials.json" is not there, aborting.' - exit -fi - -python bin/extract_gtn_tutorials.py \ - filtertutorials \ - --all_tutorials "results/test_tutorials.json" \ - --filtered_tutorials "results/microgalaxy/test_tutorials.tsv" \ - --tags "data/communities/microgalaxy/tutorial_tags" - -if [[ ! -f "results/microgalaxy/test_tutorials.tsv" ]] ; then - echo 'File "results/microgalaxy/test_tutorials.tsv" is not there, aborting.' - exit -fi - -rm "results/test_tutorials.json" -rm "results/microgalaxy/test_tutorials.tsv"