Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lint workflows with actionlint #182

Merged
merged 6 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@ concurrency:

defaults:
run:
shell: micromamba-shell {0}
shell: bash -leo pipefail {0}

jobs:
date:
runs-on: ubuntu-latest
steps:
- run: echo "date=$(date +%Y.%m.%d)" >> $GITHUB_OUTPUT
- run: echo date="$(date +%Y.%m.%d)" >> $GITHUB_OUTPUT
id: date
shell: bash
outputs:
date: ${{ steps.date.outputs.date }}
build:
Expand All @@ -49,8 +48,8 @@ jobs:
cache-downloads-key: downloads-${{ needs.date.outputs.date }}
cache-environment: true
cache-environment-key: environment-${{ needs.date.outputs.date }}
init-shell: none
generate-run-shell: true
init-shell: bash
generate-run-shell: false
- run: echo "filename=stenv-${{ runner.os }}-${{ runner.arch }}-py${{ matrix.python-version }}-${{ needs.date.outputs.date }}.yaml" >> $GITHUB_OUTPUT
id: output
- run: |
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: check

on:
pull_request:
paths:
- .github/workflows/*
push:
branches:
- main
paths:
- .github/workflows/*

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1

61 changes: 29 additions & 32 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ concurrency:

defaults:
run:
shell: micromamba-shell {0}
shell: bash -leo pipefail {0}

env:
PYSYN_CDBS: /tmp/trds
Expand All @@ -24,8 +24,10 @@ env:
jobs:
build:
uses: ./.github/workflows/build.yaml
crds-contexts:
uses: spacetelescope/crds/.github/workflows/contexts.yml@4c82b705635e6bab73a577bfe89e6fc71f40b62d # 12.0.5
test_installed:
needs: [ build, crds_contexts ]
needs: [ build, crds-contexts ]
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -70,11 +72,11 @@ jobs:
name: "`pytest --pyargs ${{ matrix.package }} ${{ matrix.pytest-args }} -n auto --dist=loadscope` (${{ matrix.runs-on }}, py${{ matrix.python-version }})"
steps:
- if: matrix.crds-observatory != ''
run: |
echo CRDS_OBSERVATORY=${{ matrix.crds-observatory }} >> $GITHUB_ENV
echo CRDS_SERVER_URL=https://${{ matrix.crds-observatory }}-crds.stsci.edu >> $GITHUB_ENV
echo CRDS_CONTEXT=${{ matrix.crds-observatory == 'hst' && needs.crds_contexts.outputs.hst || matrix.crds-observatory == 'jwst' && needs.crds_contexts.outputs.jwst || matrix.crds-observatory == 'roman' && needs.crds_contexts.outputs.roman || '' }} >> $GITHUB_ENV
shell: bash
run: echo CRDS_OBSERVATORY=${{ matrix.crds-observatory }} >> $GITHUB_ENV
- if: matrix.crds-observatory != ''
run: echo CRDS_SERVER_URL=https://${{ matrix.crds-observatory }}-crds.stsci.edu >> $GITHUB_ENV
- if: matrix.crds-observatory != ''
run: echo CRDS_CONTEXT=${{ matrix.crds-observatory == 'hst' && needs.crds-contexts.outputs.hst || (matrix.crds-observatory == 'jwst' && needs.crds-contexts.outputs.jwst || (matrix.crds-observatory == 'roman' && needs.crds-contexts.outputs.roman || '')) }} >> $GITHUB_ENV
- if: env.CRDS_CONTEXT != ''
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
Expand All @@ -91,16 +93,16 @@ jobs:
cache-downloads-key: downloads-${{ needs.build.outputs.date }}
cache-environment: true
cache-environment-key: environment-${{ needs.build.outputs.date }}
init-shell: none
generate-run-shell: true
init-shell: bash
generate-run-shell: false
- run: pip install pytest pytest-xdist ${{ matrix.test-dependencies }}
- if: matrix.test-extras != ''
run: pip install ${{ matrix.package }}[${{ matrix.test-extras }}]
- run: micromamba update -f environment.yaml
- run: pip list
- run: pytest --pyargs ${{ matrix.package }} ${{ matrix.pytest-args }} -n auto --dist=loadscope
test_from_source:
needs: [ build, crds_contexts ]
needs: [ build, crds-contexts ]
strategy:
matrix:
package: [ calcos, drizzlepac, hstcal, stistools, stsynphot ]
Expand Down Expand Up @@ -142,11 +144,11 @@ jobs:
name: "`pytest ${{ matrix.package }}/${{ matrix.test-directory }} ${{ matrix.pytest-args }} -n auto --dist=loadscope` (${{ matrix.runs-on }}, py${{ matrix.python-version }})"
steps:
- if: matrix.crds-observatory != ''
run: |
echo CRDS_OBSERVATORY=${{ matrix.crds-observatory }} >> $GITHUB_ENV
echo CRDS_SERVER_URL=${{ matrix.crds-observatory }}-crds.stsci.edu >> $GITHUB_ENV
echo CRDS_CONTEXT=${{ matrix.crds-observatory == 'hst' && needs.crds_contexts.outputs.hst || matrix.crds-observatory == 'jwst' && needs.crds_contexts.outputs.jwst || matrix.crds-observatory == 'roman' && needs.crds_contexts.outputs.roman || '' }} >> $GITHUB_ENV
shell: bash
run: echo CRDS_OBSERVATORY=${{ matrix.crds-observatory }} >> $GITHUB_ENV
- if: matrix.crds-observatory != ''
run: echo CRDS_SERVER_URL=${{ matrix.crds-observatory }}-crds.stsci.edu >> $GITHUB_ENV
- if: matrix.crds-observatory != ''
run: echo CRDS_CONTEXT=${{ matrix.crds-observatory == 'hst' && needs.crds-contexts.outputs.hst || matrix.crds-observatory == 'jwst' && needs.crds-contexts.outputs.jwst || matrix.crds-observatory == 'roman' && needs.crds-contexts.outputs.roman || '' }} >> $GITHUB_ENV
- if: env.CRDS_CONTEXT != ''
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
Expand All @@ -165,8 +167,8 @@ jobs:
cache-downloads-key: downloads-${{ needs.build.outputs.date }}
cache-environment: true
cache-environment-key: environment-${{ needs.build.outputs.date }}
init-shell: none
generate-run-shell: true
init-shell: bash
generate-run-shell: false
- run: echo "version=$(pip list | awk '$1 == "${{ matrix.package }}" {print $2}')" >> $GITHUB_OUTPUT
id: package_version
# TODO: figure out a better way to use package version when checking out a Git ref
Expand All @@ -185,13 +187,8 @@ jobs:
working-directory: ${{ matrix.package }}
- run: micromamba update -f stenv/environment.yaml
- run: pip list
- if: matrix.pre_command != ''
run: ${{ matrix.pre_command }}
working-directory: ${{ matrix.package }}
- run: pytest ${{ matrix.test-directory }} ${{ matrix.pytest-args }} -n auto --dist=loadscope
working-directory: ${{ matrix.package }}
crds_contexts:
uses: spacetelescope/crds/.github/workflows/contexts.yml@4c82b705635e6bab73a577bfe89e6fc71f40b62d # 12.0.5
crds_test_cache:
uses: spacetelescope/crds/.github/workflows/cache.yml@4c82b705635e6bab73a577bfe89e6fc71f40b62d # 12.0.5
test_crds_with_data:
Expand Down Expand Up @@ -236,8 +233,8 @@ jobs:
cache-downloads-key: downloads-${{ needs.build.outputs.date }}
cache-environment: true
cache-environment-key: environment-${{ needs.build.outputs.date }}
init-shell: none
generate-run-shell: true
init-shell: bash
generate-run-shell: false
- run: micromamba install -y filelock requests
- run: pip install parsely roman-datamodels git+https://github.com/spacetelescope/jwst
- run: pip list
Expand Down Expand Up @@ -293,11 +290,11 @@ jobs:
jref: /tmp/crds_cache/${{ matrix.jref }}
steps:
- if: matrix.crds-observatory != ''
run: |
echo CRDS_OBSERVATORY=${{ matrix.crds-observatory }} >> $GITHUB_ENV
echo CRDS_SERVER_URL=${{ matrix.crds-observatory }}-crds.stsci.edu >> $GITHUB_ENV
echo CRDS_CONTEXT=${{ matrix.crds-observatory == 'hst' && needs.crds_contexts.outputs.hst || matrix.crds-observatory == 'jwst' && needs.crds_contexts.outputs.jwst || matrix.crds-observatory == 'roman' && needs.crds_contexts.outputs.roman || '' }} >> $GITHUB_ENV
shell: bash
run: echo CRDS_OBSERVATORY=${{ matrix.crds-observatory }} >> $GITHUB_ENV
- if: matrix.crds-observatory != ''
run: echo CRDS_SERVER_URL=${{ matrix.crds-observatory }}-crds.stsci.edu >> $GITHUB_ENV
- if: matrix.crds-observatory != ''
run: echo CRDS_CONTEXT=${{ matrix.crds-observatory == 'hst' && needs.crds-contexts.outputs.hst || (matrix.crds-observatory == 'jwst' && needs.crds-contexts.outputs.jwst || (matrix.crds-observatory == 'roman' && needs.crds-contexts.outputs.roman || '')) }} >> $GITHUB_ENV
- if: env.CRDS_CONTEXT != ''
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
Expand All @@ -316,9 +313,9 @@ jobs:
cache-downloads-key: downloads-${{ needs.build.outputs.date }}
cache-environment: true
cache-environment-key: environment-${{ needs.build.outputs.date }}
init-shell: none
generate-run-shell: true
- run: pip install pytest pytest-xdist ${{ matrix.test-dependencies }}
init-shell: bash
generate-run-shell: false
- run: pip install pytest pytest-xdist
- run: pip list
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
Expand Down
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
repos:
- repo: https://github.com/rhysd/actionlint
rev: v1.7.4
hooks:
- id: actionlint
args:
- -shellcheck=
- -ignore=".*crds-contexts.*"
Loading