Create composite action to create constructor-based installers #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test errors | |
on: | |
pull_request: | |
paths: | |
- action.yaml | |
push: | |
branches: | |
- main | |
permissions: {} | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
validate-conda-root-input: | |
# This test doubles as a template injection test. | |
# If the cat command is not escaped, the build will succeed. | |
name: conda-root directory does not exist | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
persist-credentials: false | |
- name: Set up Miniconda | |
uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3.1.0 | |
with: | |
activate-environment: '' | |
run-post: false | |
- name: Create file with conda-root location | |
run: echo "${{ env.CONDA }}" >> ${{ runner.temp }}/path.txt | |
shell: bash | |
- name: Run action | |
uses: ./ | |
id: run-action | |
with: | |
conda-root: $(cat ${{ runner.temp }}/path.txt) | |
environment-yaml-file: recipes/defaults/environment.yaml | |
input-directory: recipes/defaults | |
continue-on-error: true | |
- name: Error if successful | |
if: ${{ steps.run-action.outcome == 'success' }} | |
run: | | |
echo "::error::The build action succeeded unexpectedly." | |
exit 1 | |
shell: bash | |
validate-environment-yaml-input: | |
# This test doubles as a template injection test. | |
# If the cat command is not escaped, the build will succeed. | |
name: environment-yaml file does not exist | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
persist-credentials: false | |
- name: Create file with environment-yaml location | |
run: echo "recipes/defaults/environment.yaml" >> ${{ runner.temp }}/path.txt | |
shell: bash | |
- name: Run action | |
uses: ./ | |
id: run-action | |
with: | |
environment-yaml-file: $(cat ${{ runner.temp }}/path.txt) | |
input-directory: recipes/defaults | |
continue-on-error: true | |
- name: Error if successful | |
if: ${{ steps.run-action.outcome == 'success' }} | |
run: | | |
echo "::error::The build action succeeded unexpectedly." | |
exit 1 | |
shell: bash | |
validate-input-directory-input: | |
# This test doubles as a template injection test. | |
# If the cat command is not escaped, the build will succeed. | |
name: input-directory does not exist | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
persist-credentials: false | |
- name: Create file with input-directory location | |
run: echo "recipes/defaults" >> ${{ runner.temp }}/path.txt | |
shell: bash | |
- name: Run action | |
uses: ./ | |
id: run-action | |
with: | |
environment-yaml-file: recipes/defaults/environment.yaml | |
input-directory: $(cat ${{ runner.temp }}/path.txt) | |
continue-on-error: true | |
- name: Error if successful | |
if: ${{ steps.run-action.outcome == 'success' }} | |
run: | | |
echo "::error::The build action succeeded unexpectedly." | |
exit 1 | |
shell: bash | |
validate-standalone-location-input: | |
# This test doubles as a template injection test. | |
# If the cat command is not escaped, the build will succeed. | |
name: standalone-location file does not exist | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
persist-credentials: false | |
- name: Download micromamba | |
uses: mamba-org/setup-micromamba@0dea6379afdaffa5d528b3d1dabc45da37f443fc # v2.0.4 | |
with: | |
init-shell: none | |
- name: Create file with standalone binary location | |
run: echo "${{ env.MAMBA_EXE }}" >> ${{ runner.temp }}/path.txt | |
shell: bash | |
- name: Run action | |
uses: ./ | |
id: run-action | |
with: | |
environment-yaml-file: recipes/defaults/environment.yaml | |
input-directory: recipes/defaults | |
standalone-location: $(cat ${{ runner.temp }}/path.txt) | |
continue-on-error: true | |
- name: Error if successful | |
if: ${{ steps.run-action.outcome == 'success' }} | |
run: | | |
echo "::error::The build action succeeded unexpectedly." | |
exit 1 | |
shell: bash | |
no-conda: | |
name: No conda or mamba binary | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
persist-credentials: false | |
- name: Run action | |
uses: ./ | |
id: run-action | |
with: | |
container-image: debian:latest # Does not contain conda or mamba | |
environment-yaml-file: recipes/defaults/environment.yaml | |
input-directory: recipes/defaults | |
continue-on-error: true | |
- name: Error if successful | |
if: ${{ steps.run-action.outcome == 'success' }} | |
run: | | |
echo "::error::The build action succeeded unexpectedly." | |
exit 1 | |
shell: bash |