From 7ab6945e158e0f08b2e1c3ed5b33d9e591677383 Mon Sep 17 00:00:00 2001 From: wpbonelli Date: Mon, 24 Jun 2024 11:51:02 -0400 Subject: [PATCH 1/4] feat(ostag): add ostag input --- action.yml | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/action.yml b/action.yml index bae36fd..c46df20 100644 --- a/action.yml +++ b/action.yml @@ -28,6 +28,10 @@ inputs: description: Tag of the release version to install required: false default: 'latest' + ostag: + description: Operating system tag; default is to automatically choose. + required: false + default: '' outputs: cache-hit: @@ -121,6 +125,10 @@ runs: subset=${subset//,/-} # replace commas with dashes key="$key-$subset" fi + if [[ "${{ inputs.ostag }}" != "" ]]; then + ostag="${{ inputs.ostag }}" + key="$key-$ostag" + fi echo "key=$key" >> "$GITHUB_OUTPUT" - name: Cache executables @@ -135,26 +143,29 @@ runs: if: inputs.cache != 'true' || steps.cache-modflow.outputs.cache-hit != 'true' shell: bash run: | + # compose arguments + args='--owner "${{ inputs.owner }}" --repo "${{ inputs.repo }}" --release-id "${{ inputs.tag }}" --force' + if [[ "${{ inputs.subset }}" != "" ]]; then + args='$args --subset "${{ inputs.subset }}"' + fi + if [[ "${{ inputs.ostag}}" != "" ]]; then + args='$args --ostag "${{ inputs.ostag }}"' + fi + + # download the installation script if necessary if command -v get-modflow &> /dev/null then - echo "get-modflow command is available, running get-modflow" - if [ "${{ inputs.subset }}" == "" ]; then - get-modflow "$MODFLOW_BIN_PATH" --owner "${{ inputs.owner }}" --repo "${{ inputs.repo }}" --release-id "${{ inputs.tag }}" --force - else - get-modflow "$MODFLOW_BIN_PATH" --owner "${{ inputs.owner }}" --repo "${{ inputs.repo }}" --release-id "${{ inputs.tag }}" --subset "${{ inputs.subset }}" --force - fi + echo "get-modflow command is available" + cmd="get-modflow" else - echo "get-modflow command not available, downloading get_modflow.py" + echo "get-modflow command not available, downloading install script" script_path="$RUNNER_TEMP/get_modflow.py" curl https://raw.githubusercontent.com/modflowpy/flopy/develop/flopy/utils/get_modflow.py -o "$script_path" - - echo "running get_modflow.py" - if [ "${{ inputs.subset }}" == "" ]; then - python3 $script_path "$MODFLOW_BIN_PATH" --owner "${{ inputs.owner }}" --repo "${{ inputs.repo }}" --release-id "${{ inputs.tag }}" - else - python3 $script_path "$MODFLOW_BIN_PATH" --owner "${{ inputs.owner }}" --repo "${{ inputs.repo }}" --release-id "${{ inputs.tag }}" --subset "${{ inputs.subset }}" - fi + cmd="python3 $script_path" fi + + echo "starting installation" + $cmd $MODFLOW_BIN_PATH $args env: GITHUB_TOKEN: ${{ steps.set-github-token.outputs.token }} From 0859ee00585625f8b7e68110ef7786cef7e71a85 Mon Sep 17 00:00:00 2001 From: wpbonelli Date: Mon, 24 Jun 2024 11:55:35 -0400 Subject: [PATCH 2/4] ci test --- .github/workflows/ci.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0e0c992..e025d3a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -213,4 +213,20 @@ jobs: script_path="$RUNNER_TEMP/get_modflow.py" python test/test.py "$TEST_BINDIR" "executables" env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Install with ostag (macOS) + if: runner.os == 'macOS' + uses: ./ + with: + path: ${{ env.TEST_BINDIR}} + tag: ${{ matrix.tag }} + ostag: mac + + - name: Test ostag (macOS) + if: runner.os == 'macOS' + run: | + script_path="$RUNNER_TEMP/get_modflow.py" + python test/test.py "$TEST_BINDIR" "executables" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From f1a82ed173f6889dd52762d3c432ceefd4da4301 Mon Sep 17 00:00:00 2001 From: wpbonelli Date: Mon, 24 Jun 2024 12:01:09 -0400 Subject: [PATCH 3/4] syntax fix --- action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index c46df20..0d45bf9 100644 --- a/action.yml +++ b/action.yml @@ -144,12 +144,12 @@ runs: shell: bash run: | # compose arguments - args='--owner "${{ inputs.owner }}" --repo "${{ inputs.repo }}" --release-id "${{ inputs.tag }}" --force' + args="--owner ${{ inputs.owner }} --repo ${{ inputs.repo }} --release-id ${{ inputs.tag }} --force" if [[ "${{ inputs.subset }}" != "" ]]; then - args='$args --subset "${{ inputs.subset }}"' + args="$args --subset ${{ inputs.subset }}" fi if [[ "${{ inputs.ostag}}" != "" ]]; then - args='$args --ostag "${{ inputs.ostag }}"' + args="$args --ostag ${{ inputs.ostag }}" fi # download the installation script if necessary From d55f3fc99e3ce0455d960720196e07174b09e5cd Mon Sep 17 00:00:00 2001 From: wpbonelli Date: Mon, 24 Jun 2024 12:26:39 -0400 Subject: [PATCH 4/4] fix ci test --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e025d3a..0fed79a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -167,7 +167,7 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest, macos-latest, windows-latest ] - tag: [ 'latest', '13.0' ] + tag: [ 'latest', '19.0' ] defaults: run: shell: bash @@ -220,7 +220,7 @@ jobs: uses: ./ with: path: ${{ env.TEST_BINDIR}} - tag: ${{ matrix.tag }} + tag: latest ostag: mac - name: Test ostag (macOS)