diff --git a/.github/workflows/setup.yaml b/.github/workflows/setup.yaml deleted file mode 100644 index bc20af7..0000000 --- a/.github/workflows/setup.yaml +++ /dev/null @@ -1,28 +0,0 @@ -name: Reusable setup workflow for actions tests - -on: - workflow_call: - inputs: - recipes-version: - required: true - type: string - -jobs: - runs-on: ubuntu-latest - setup: - - uses: actions/checkout@v4 - - name: "Clone test feedstock" - # Fetches test feedstock (containing example test recipes) from pangeo-forge-recipes - run: | - git clone --depth 1 --branch ${{ inputs.recipes-version }} https://github.com/pangeo-forge/pangeo-forge-recipes.git - - name: "Add requirements.txt" - # The clone step above gives us recipe modules and meta.yaml, but does not contain a requirements file, - # so we add that here, providing the action with the correct version of pangeo-forge-recipes to install - # in the container at action runtime. - run: | - echo "pangeo-forge-recipes==${{ inputs.recipes-version }}" > pangeo-forge-recipes/examples/feedstock/requirements.txt - - name: "Overwrite meta.yaml" - # The example feedstock contains multiple recipes, but we just want to test gpcp - run: | - grep -E 'recipes|gpcp' pangeo-forge-recipes/examples/feedstock/meta.yaml > temp.yaml \ - && mv temp.yaml pangeo-forge-recipes/examples/feedstock/meta.yaml diff --git a/.github/workflows/test-action-file-config.yaml b/.github/workflows/test-action-file-config.yaml deleted file mode 100644 index 9ad34d1..0000000 --- a/.github/workflows/test-action-file-config.yaml +++ /dev/null @@ -1,47 +0,0 @@ -name: Test action (file config) - -on: - push: - branches: ["main"] - pull_request: - branches: [ "*" ] - -jobs: - test: - name: (recipes@${{ matrix.recipes-version }}) - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - recipes-version: ["0.10.3"] # , "main"] - steps: - - uses: actions/checkout@v4 - - uses: ./.github/workflows/setup.yaml - with: - recipes-version: ${{ matrix.recipes-version }} - - name: Write local-config.json - run: | - cat << EOF > ./local-config.json - { - "BaseCommand": { - "feedstock_subdir": "pangeo-forge-recipes/examples/feedstock" - }, - "Bake": { - "prune": true, - "bakery_class": "pangeo_forge_runner.bakery.local.LocalDirectBakery" - }, - "TargetStorage": { - "fsspec_class": "fsspec.implementations.local.LocalFileSystem", - "root_path": "./target" - }, - "InputCacheStorage": { - "fsspec_class": "fsspec.implementations.local.LocalFileSystem", - "root_path": "./cache" - } - } - EOF - - name: "Deploy recipes" - uses: ./ - with: - # select_recipe_by_label: true - pangeo_forge_runner_config: ./local-config.json diff --git a/.github/workflows/test-action-inline-config.yaml b/.github/workflows/test-action-inline-config.yaml deleted file mode 100644 index 681e7bb..0000000 --- a/.github/workflows/test-action-inline-config.yaml +++ /dev/null @@ -1,43 +0,0 @@ -name: Test action (inline config) - -on: - push: - branches: ["main"] - pull_request: - branches: [ "*" ] - -jobs: - test: - name: (recipes@${{ matrix.recipes-version }}) - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - recipes-version: ["0.10.3"] # , "main"] - steps: - - uses: actions/checkout@v4 - - uses: ./.github/workflows/setup.yaml - with: - recipes-version: ${{ matrix.recipes-version }} - - name: "Deploy recipes" - uses: ./ - with: - # select_recipe_by_label: true - pangeo_forge_runner_config: > - { - "BaseCommand": { - "feedstock_subdir": "pangeo-forge-recipes/examples/feedstock" - }, - "Bake": { - "prune": true, - "bakery_class": "pangeo_forge_runner.bakery.local.LocalDirectBakery" - }, - "TargetStorage": { - "fsspec_class": "fsspec.implementations.local.LocalFileSystem", - "root_path": "./target" - }, - "InputCacheStorage": { - "fsspec_class": "fsspec.implementations.local.LocalFileSystem", - "root_path": "./cache" - } - } diff --git a/.github/workflows/test-action.yaml b/.github/workflows/test-action.yaml new file mode 100644 index 0000000..028d024 --- /dev/null +++ b/.github/workflows/test-action.yaml @@ -0,0 +1,99 @@ +name: Test action + +on: + push: + branches: ["main"] + pull_request: + branches: [ "*" ] + +jobs: + test: + name: (recipes@${{ matrix.recipes-version }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + recipes-version: [ + # "main", + # "0.10.3", + "0.10.4", + ] + config: [ + "inline", + "file", + ] + steps: + - uses: actions/checkout@v4 + + # ----- Shared setup -------------------------------------------------------------- + - name: "Clone test feedstock" + # Fetches test feedstock (containing example test recipes) from pangeo-forge-recipes + run: | + git clone --depth 1 --branch ${{ matrix.recipes-version }} https://github.com/pangeo-forge/pangeo-forge-recipes.git + - name: "Add requirements.txt" + # The clone step above gives us recipe modules and meta.yaml, but does not contain a requirements file, + # so we add that here, providing the action with the correct version of pangeo-forge-recipes to install + # in the container at action runtime. + run: | + echo "pangeo-forge-recipes==${{ matric.recipes-version }}" > pangeo-forge-recipes/examples/feedstock/requirements.txt + - name: "Overwrite meta.yaml" + # The example feedstock contains multiple recipes, but we just want to test gpcp + run: | + grep -E 'recipes|gpcp' pangeo-forge-recipes/examples/feedstock/meta.yaml > temp.yaml \ + && mv temp.yaml pangeo-forge-recipes/examples/feedstock/meta.yaml + + # ----- File based config --------------------------------------------------------- + - name: Write local-config.json + if: matrix.config == 'file' + run: | + cat << EOF > ./local-config.json + { + "BaseCommand": { + "feedstock_subdir": "pangeo-forge-recipes/examples/feedstock" + }, + "Bake": { + "prune": true, + "bakery_class": "pangeo_forge_runner.bakery.local.LocalDirectBakery" + }, + "TargetStorage": { + "fsspec_class": "fsspec.implementations.local.LocalFileSystem", + "root_path": "./target" + }, + "InputCacheStorage": { + "fsspec_class": "fsspec.implementations.local.LocalFileSystem", + "root_path": "./cache" + } + } + EOF + - name: "Deploy recipes" + if: matrix.config == 'file' + uses: ./ + with: + # select_recipe_by_label: true + pangeo_forge_runner_config: ./local-config.json + + + # ---- Inline config -------------------------------------------------------------- + - name: "Deploy recipes" + if: matrix.config == 'inline' + uses: ./ + with: + # select_recipe_by_label: true + pangeo_forge_runner_config: > + { + "BaseCommand": { + "feedstock_subdir": "pangeo-forge-recipes/examples/feedstock" + }, + "Bake": { + "prune": true, + "bakery_class": "pangeo_forge_runner.bakery.local.LocalDirectBakery" + }, + "TargetStorage": { + "fsspec_class": "fsspec.implementations.local.LocalFileSystem", + "root_path": "./target" + }, + "InputCacheStorage": { + "fsspec_class": "fsspec.implementations.local.LocalFileSystem", + "root_path": "./cache" + } + }