From 831122e4bc4af543a1f858fa16f0847dc5db1e57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Kwiecin=CC=81ski?= Date: Sun, 10 Mar 2024 18:33:43 +0700 Subject: [PATCH] Test on various OSs --- .github/workflows/pull_request.yml | 15 +++++++++++++++ entrypoint.py | 15 +++++++++++---- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 03effb0..158c8f0 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -33,3 +33,18 @@ jobs: comment-id: ${{ steps.find_comment.outputs.comment-id }} issue-number: ${{ github.event.pull_request.number }} token: ${{ secrets.GITHUB_TOKEN }} + + os-test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ ubuntu-latest, macos-latest, windows-latest ] + name: Run action + steps: + - uses: actions/checkout@v4 + + - id: agp-version-finder + uses: ./ + + - run: echo "${{join(steps.agp-version-finder.outputs.*, '\n')}}" diff --git a/entrypoint.py b/entrypoint.py index 93f6a22..85c4bd7 100644 --- a/entrypoint.py +++ b/entrypoint.py @@ -10,9 +10,16 @@ def version_regex(_suffix): def is_debug(): + print(os.getenv("INPUT_DEBUG", False)) + print(os.getenv("INPUT_DEBUG", False) == True) return os.getenv("INPUT_DEBUG", False) +def github_output(key, value): + with open(os.environ['GITHUB_OUTPUT'], mode='a', encoding='UTF-8') as fh: + print(f'{key}={value}', file=fh) + + url = "https://dl.google.com/android/maven2/com/android/tools/build/gradle/maven-metadata.xml" stable_regex = re.compile(r"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$") alpha_regex = re.compile(version_regex("alpha")) @@ -39,7 +46,7 @@ def is_debug(): rc_count={len(all_rc)} """) -os.system(f"echo \"latest-stable={all_stable[-1]}\" >> $GITHUB_OUTPUT") -os.system(f"echo \"latest-alpha={all_alpha[-1]}\" >> $GITHUB_OUTPUT") -os.system(f"echo \"latest-beta={all_beta[-1]}\" >> $GITHUB_OUTPUT") -os.system(f"echo \"latest-rc={all_rc[-1]}\" >> $GITHUB_OUTPUT") +github_output(key="latest-stable", value=all_stable[-1]) +github_output(key="latest-alpha", value=all_alpha[-1]) +github_output(key="latest-beta", value=all_beta[-1]) +github_output(key="latest-rc", value=all_rc[-1])