Skip to content

Commit

Permalink
feat: lint GitHub Actions workflows TDE-919 (#720)
Browse files Browse the repository at this point in the history
* feat: lint GitHub Actions workflows

* fix: Follow ShellCheck advice about lints in workflow code

* feat: Enforce ShellCheck of workflow code

Via actionlint.
  • Loading branch information
l0b0 authored Nov 9, 2023
1 parent 967157b commit 1d32588
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 27 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ jobs:
id: version
run: |
GIT_VERSION=$(git describe --tags --always --match 'v*')
GIT_VERSION_MAJOR=$(echo $GIT_VERSION | cut -d. -f1)
GIT_VERSION_MAJOR_MINOR=$(echo $GIT_VERSION | cut -d. -f1,2)
echo "version=${GIT_VERSION}" >> $GITHUB_OUTPUT
echo "version_major=${GIT_VERSION_MAJOR}" >> $GITHUB_OUTPUT
echo "version_major_minor=${GIT_VERSION_MAJOR_MINOR}" >> $GITHUB_OUTPUT
GIT_VERSION_MAJOR=$(echo "$GIT_VERSION" | cut -d. -f1)
GIT_VERSION_MAJOR_MINOR=$(echo "$GIT_VERSION" | cut -d. -f1,2)
{ echo "version=${GIT_VERSION}"; echo "version_major=${GIT_VERSION_MAJOR}"; echo "version_major_minor=${GIT_VERSION_MAJOR_MINOR}"; } >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
Expand Down
32 changes: 16 additions & 16 deletions .github/workflows/format-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,37 +28,37 @@ jobs:
- name: End to end test - Aerial Imagery
run: |
docker run -v ${HOME}/tmp/:/tmp/ topo-imagery python3 standardise_validate.py --from-file ./tests/data/aerial.json --preset webp --target-epsg 2193 --source-epsg 2193 --target /tmp/ --collection-id 123 --start-datetime 2023-01-01 --end-datetime 2023-01-01
cmp --silent ${HOME}/tmp/BG35_1000_4829.tiff ./scripts/tests/data/output/BG35_1000_4829.tiff
docker run -v "${HOME}/tmp/:/tmp/" topo-imagery python3 standardise_validate.py --from-file ./tests/data/aerial.json --preset webp --target-epsg 2193 --source-epsg 2193 --target /tmp/ --collection-id 123 --start-datetime 2023-01-01 --end-datetime 2023-01-01
cmp --silent "${HOME}/tmp/BG35_1000_4829.tiff" ./scripts/tests/data/output/BG35_1000_4829.tiff
- name: End to end test - Elevation
run: |
docker run -v ${HOME}/tmp/:/tmp/ topo-imagery python3 standardise_validate.py --from-file ./tests/data/dem.json --preset dem_lerc --target-epsg 2193 --source-epsg 2193 --target /tmp/ --collection-id 123 --start-datetime 2023-01-01 --end-datetime 2023-01-01
cmp --silent ${HOME}/tmp/BK39_10000_0102.tiff ./scripts/tests/data/output/BK39_10000_0102.tiff
cmp --silent ${HOME}/tmp/BK39_10000_0101.tiff ./scripts/tests/data/output/BK39_10000_0101.tiff
docker run -v "${HOME}/tmp/:/tmp/" topo-imagery python3 standardise_validate.py --from-file ./tests/data/dem.json --preset dem_lerc --target-epsg 2193 --source-epsg 2193 --target /tmp/ --collection-id 123 --start-datetime 2023-01-01 --end-datetime 2023-01-01
cmp --silent "${HOME}/tmp/BK39_10000_0102.tiff" ./scripts/tests/data/output/BK39_10000_0102.tiff
cmp --silent "${HOME}/tmp/BK39_10000_0101.tiff" ./scripts/tests/data/output/BK39_10000_0101.tiff
- name: End to end test - Historical Aerial Imagery
run: |
docker run -v ${HOME}/tmp/:/tmp/ topo-imagery python3 standardise_validate.py --from-file ./tests/data/hi.json --preset webp --target-epsg 2193 --source-epsg 2193 --target /tmp/ --collection-id 123 --start-datetime 2023-01-01 --end-datetime 2023-01-01
cmp --silent ${HOME}/tmp/BQ31_5000_0608.tiff ./scripts/tests/data/output/BQ31_5000_0608.tiff
docker run -v "${HOME}/tmp/:/tmp/" topo-imagery python3 standardise_validate.py --from-file ./tests/data/hi.json --preset webp --target-epsg 2193 --source-epsg 2193 --target /tmp/ --collection-id 123 --start-datetime 2023-01-01 --end-datetime 2023-01-01
cmp --silent "${HOME}/tmp/BQ31_5000_0608.tiff" ./scripts/tests/data/output/BQ31_5000_0608.tiff
- name: End to end test - Cutline (Aerial Imagery)
run: |
docker run -v ${HOME}/tmp/:/tmp/ topo-imagery python3 standardise_validate.py --from-file ./tests/data/aerial.json --preset webp --target-epsg 2193 --source-epsg 2193 --target /tmp/cutline/ --collection-id 123 --start-datetime 2023-01-01 --end-datetime 2023-01-01 --cutline ./tests/data/cutline_aerial.fgb
cmp --silent ${HOME}/tmp/cutline/BG35_1000_4829.tiff ./scripts/tests/data/output/BG35_1000_4829_cut.tiff
docker run -v "${HOME}/tmp/:/tmp/" topo-imagery python3 standardise_validate.py --from-file ./tests/data/aerial.json --preset webp --target-epsg 2193 --source-epsg 2193 --target /tmp/cutline/ --collection-id 123 --start-datetime 2023-01-01 --end-datetime 2023-01-01 --cutline ./tests/data/cutline_aerial.fgb
cmp --silent "${HOME}/tmp/cutline/BG35_1000_4829.tiff" ./scripts/tests/data/output/BG35_1000_4829_cut.tiff
- name: End to end test - Thumbnails (Topo50/Topo250)
run: |
docker run -v ${HOME}/tmp/:/tmp/ topo-imagery python3 thumbnails.py --from-file ./tests/data/thumbnails.json --target /tmp/
cmp --silent ${HOME}/tmp/CB07_GeoTifv1-02-thumbnail.jpg ./scripts/tests/data/output/CB07_GeoTifv1-02-thumbnail.jpg
cmp --silent ${HOME}/tmp/CB07_TIFFv1-02-thumbnail.jpg ./scripts/tests/data/output/CB07_TIFFv1-02-thumbnail.jpg
docker run -v "${HOME}/tmp/:/tmp/" topo-imagery python3 thumbnails.py --from-file ./tests/data/thumbnails.json --target /tmp/
cmp --silent "${HOME}/tmp/CB07_GeoTifv1-02-thumbnail.jpg" ./scripts/tests/data/output/CB07_GeoTifv1-02-thumbnail.jpg
cmp --silent "${HOME}/tmp/CB07_TIFFv1-02-thumbnail.jpg" ./scripts/tests/data/output/CB07_TIFFv1-02-thumbnail.jpg
- name: End to end test - Restandardise Aerial Imagery
run: |
docker run -v ${HOME}/tmp/:/tmp/ topo-imagery python3 standardise_validate.py --from-file ./tests/data/restandardise.json --preset webp --target-epsg 2193 --source-epsg 2193 --target /tmp/restandardise/ --collection-id 123 --start-datetime 2023-01-01 --end-datetime 2023-01-01
cmp --silent ${HOME}/tmp/restandardise/BG35_1000_4829.tiff ./scripts/tests/data/output/BG35_1000_4829.tiff
docker run -v "${HOME}/tmp/:/tmp/" topo-imagery python3 standardise_validate.py --from-file ./tests/data/restandardise.json --preset webp --target-epsg 2193 --source-epsg 2193 --target /tmp/restandardise/ --collection-id 123 --start-datetime 2023-01-01 --end-datetime 2023-01-01
cmp --silent "${HOME}/tmp/restandardise/BG35_1000_4829.tiff" ./scripts/tests/data/output/BG35_1000_4829.tiff
- name: End to end test - Translate Ascii Files (Elevation)
run: |
docker run -v ${HOME}/tmp/:/tmp/ topo-imagery python3 translate_ascii.py --from-file ./tests/data/elevation_ascii.json --target /tmp/
cmp --silent ${HOME}/tmp/elevation_ascii.tiff ./scripts/tests/data/output/elevation_ascii.tiff
docker run -v "${HOME}/tmp/:/tmp/" topo-imagery python3 translate_ascii.py --from-file ./tests/data/elevation_ascii.json --target /tmp/
cmp --silent "${HOME}/tmp/elevation_ascii.tiff" ./scripts/tests/data/output/elevation_ascii.tiff
8 changes: 3 additions & 5 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,9 @@ jobs:
id: version
run: |
GIT_VERSION=$(git describe --tags --always --match 'v*')
GIT_VERSION_MAJOR=$(echo $GIT_VERSION | cut -d. -f1)
GIT_VERSION_MAJOR_MINOR=$(echo $GIT_VERSION | cut -d. -f1,2)
echo "version=${GIT_VERSION}" >> $GITHUB_OUTPUT
echo "version_major=${GIT_VERSION_MAJOR}" >> $GITHUB_OUTPUT
echo "version_major_minor=${GIT_VERSION_MAJOR_MINOR}" >> $GITHUB_OUTPUT
GIT_VERSION_MAJOR=$(echo "$GIT_VERSION" | cut -d. -f1)
GIT_VERSION_MAJOR_MINOR=$(echo "$GIT_VERSION" | cut -d. -f1,2)
{ echo "version=${GIT_VERSION}"; echo "version_major=${GIT_VERSION_MAJOR}"; echo "version_major_minor=${GIT_VERSION_MAJOR_MINOR}"; } >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
Expand Down
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,9 @@ repos:
- id: prettier
stages: [commit]
exclude_types: [python]

- repo: https://github.com/rhysd/actionlint
rev: ea8102762106cdca9c88829f1295b39a544706f3 # frozen: v1.6.26
hooks:
- id: actionlint
stages: [commit]
15 changes: 14 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ pytest = "^7.4.3"
pytest-dependency = "^0.5.1"
moto = "^4.2.6"
pytest-mock = "^3.12.0"
shellcheck-py = "*"
vulture = "^2.10"

0 comments on commit 1d32588

Please sign in to comment.