-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add linting and testing workflow for charts and webapp #4
Changes from 4 commits
62be473
76ee6a8
2c76bbd
f17235e
4b1e6f3
11a205a
6b2e59c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,77 @@ | ||||||||
name: Lint and Test Charts | ||||||||
|
||||||||
on: | ||||||||
push: | ||||||||
branches: | ||||||||
- main | ||||||||
- chartsimprovements | ||||||||
tags: | ||||||||
- '*' | ||||||||
paths: | ||||||||
# Only run test and docker publish if some code have changed | ||||||||
- 'deployment/k8s/charts/**' | ||||||||
- '.github/workflows/check_charts.yaml' | ||||||||
pull_request: | ||||||||
|
||||||||
jobs: | ||||||||
lint-test: | ||||||||
runs-on: ubuntu-latest | ||||||||
steps: | ||||||||
- name: Checkout | ||||||||
uses: actions/checkout@v4 | ||||||||
with: | ||||||||
fetch-depth: 0 | ||||||||
|
||||||||
- name: Check Version | ||||||||
run: | | ||||||||
current_version=$(grep '^version=' pyproject.toml | cut -f2 -d= | tr -d ' ' | tr -d '"') | ||||||||
app_version=$(grep 'appVersion:' deployment/k8s/charts/Chart.yaml | cut -f2 -d: | tr -d ' ') | ||||||||
if [[ "$current_version" != "$app_version" ]]; then | ||||||||
echo "❌ current version from pyproject.toml ($current_version) and appVersion from Chart.yaml ($app_version) differs"; | ||||||||
exit 1; | ||||||||
fi | ||||||||
|
||||||||
- name: Set up Helm | ||||||||
uses: azure/setup-helm@v4 | ||||||||
with: | ||||||||
version: v3.9.2 | ||||||||
|
||||||||
- uses: actions/setup-python@v5 | ||||||||
with: | ||||||||
python-version: 3.7 | ||||||||
|
||||||||
- name: Set up chart-testing | ||||||||
uses: helm/[email protected] | ||||||||
|
||||||||
- name: Run chart-testing (list-changed) | ||||||||
id: list-changed | ||||||||
run: | | ||||||||
changed=$(ct list-changed --chart-dirs deployment/k8s --target-branch ${{ github.event.repository.default_branch }}) | ||||||||
if [[ -n "$changed" ]]; then | ||||||||
echo "::set-output name=changed::true" | ||||||||
fi | ||||||||
|
||||||||
- name: Run chart-testing (lint) | ||||||||
run: ct lint --chart-dirs deployment/k8s --target-branch ${{ github.event.repository.default_branch }} | ||||||||
|
||||||||
- name: Build container | ||||||||
uses: docker/build-push-action@v6 | ||||||||
if: steps.list-changed.outputs.changed == 'true' | ||||||||
with: | ||||||||
platforms: linux/amd64 | ||||||||
context: . | ||||||||
file: dockerfiles/Dockerfile | ||||||||
push: false | ||||||||
tags: "polder:dev" | ||||||||
|
||||||||
- name: Create kind cluster | ||||||||
uses: helm/[email protected] | ||||||||
if: steps.list-changed.outputs.changed == 'true' | ||||||||
|
||||||||
- name: Load container image in kind cluster | ||||||||
run: kind load docker-image polder:dev --name chart-testing | ||||||||
if: steps.list-changed.outputs.changed == 'true' | ||||||||
|
||||||||
- name: Run chart-testing (install) | ||||||||
run: ct install --chart-dirs deployment/k8s | ||||||||
if: steps.list-changed.outputs.changed == 'true' | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,104 @@ | ||||||||
# This workflow performs basic checks: | ||||||||
# | ||||||||
# 1. run a preparation step to install and cache node modules | ||||||||
# 2. once prep succeeds, run lint and test in parallel | ||||||||
# | ||||||||
# The checks are skipped on the 'main' branch. The project relies on branch | ||||||||
# protection to avoid pushes straight to 'main'. | ||||||||
|
||||||||
name: Checks | ||||||||
|
||||||||
on: | ||||||||
push: | ||||||||
branches-ignore: | ||||||||
- 'main' | ||||||||
|
||||||||
concurrency: | ||||||||
group: ${{ github.workflow }}-${{ github.ref }} | ||||||||
cancel-in-progress: true | ||||||||
|
||||||||
jobs: | ||||||||
prep: | ||||||||
if: github.event.pull_request.draft == false | ||||||||
runs-on: ubuntu-latest | ||||||||
|
||||||||
steps: | ||||||||
- name: Checkout | ||||||||
uses: actions/checkout@v4 | ||||||||
|
||||||||
- name: Use Node.js | ||||||||
uses: actions/setup-node@v3 | ||||||||
with: | ||||||||
node-version-file: '.nvmrc' | ||||||||
|
||||||||
- name: Cache node_modules | ||||||||
uses: actions/cache@v3 | ||||||||
id: cache-node-modules | ||||||||
with: | ||||||||
path: node_modules | ||||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }} | ||||||||
|
||||||||
- name: Install | ||||||||
run: yarn install | ||||||||
|
||||||||
lint: | ||||||||
needs: prep | ||||||||
runs-on: ubuntu-latest | ||||||||
|
||||||||
steps: | ||||||||
- name: Checkout | ||||||||
uses: actions/checkout@v4 | ||||||||
|
||||||||
- name: Use Node.js | ||||||||
uses: actions/setup-node@v3 | ||||||||
with: | ||||||||
node-version-file: '.nvmrc' | ||||||||
|
||||||||
- name: Cache node_modules | ||||||||
uses: actions/cache@v3 | ||||||||
id: cache-node-modules | ||||||||
with: | ||||||||
path: node_modules | ||||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }} | ||||||||
|
||||||||
- name: Install | ||||||||
run: yarn install | ||||||||
working-directory: ./webapp | ||||||||
|
||||||||
- name: Lint | ||||||||
run: yarn lint | ||||||||
working-directory: ./webapp | ||||||||
|
||||||||
# Docker container build | ||||||||
build: | ||||||||
needs: prep | ||||||||
runs-on: ubuntu-latest | ||||||||
|
||||||||
steps: | ||||||||
- name: Checkout | ||||||||
uses: actions/checkout@v4 | ||||||||
|
||||||||
- name: Use Node.js | ||||||||
uses: actions/setup-node@v3 | ||||||||
with: | ||||||||
node-version-file: '.nvmrc' | ||||||||
|
||||||||
- name: Cache node_modules | ||||||||
uses: actions/cache@v3 | ||||||||
id: cache-node-modules | ||||||||
with: | ||||||||
path: node_modules | ||||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }} | ||||||||
|
||||||||
- name: Install | ||||||||
run: yarn install | ||||||||
working-directory: ./webapp | ||||||||
|
||||||||
- name: Build container | ||||||||
uses: docker/build-push-action@v6 | ||||||||
with: | ||||||||
platforms: linux/amd64 | ||||||||
context: . | ||||||||
file: dockerfiles/Dockerfile | ||||||||
push: false | ||||||||
tags: "polder:dev" | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,6 @@ | ||||||||
FROM node:alpine | ||||||||
WORKDIR /app | ||||||||
COPY webapp/package.json /app | ||||||||
RUN yarn install | ||||||||
COPY webapp/. /app | ||||||||
CMD ["yarn", "run", "start"] | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,44 @@ | ||||||||||
[project] | ||||||||||
name = "titiler" | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
description = "A simple web service to create maps and viewer using eoAPI" | ||||||||||
readme = "README.md" | ||||||||||
requires-python = ">=3.8" | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
license = {file = "LICENSE"} | ||||||||||
authors = [ | ||||||||||
{name = "Emmanuel Mathot", email = "[email protected]"}, | ||||||||||
{name = "Ricardo Mestre", email = "[email protected]"}, | ||||||||||
{name = "Daniel Da Silva", email = "[email protected]"}, | ||||||||||
{name = "Ciaran Sweet", email = "[email protected]"}, | ||||||||||
{name = "Olaf Veerman", email = "[email protected]"}, | ||||||||||
{name = "Felix Delattre", email = "[email protected]"}, | ||||||||||
] | ||||||||||
keywords = [ | ||||||||||
"COG", | ||||||||||
"STAC", | ||||||||||
"MosaicJSON", | ||||||||||
"Fastapi", | ||||||||||
"eoAPI" | ||||||||||
] | ||||||||||
classifiers = [ | ||||||||||
"Intended Audience :: Information Technology", | ||||||||||
"Intended Audience :: Science/Research", | ||||||||||
"License :: OSI Approved :: MIT License", | ||||||||||
"Programming Language :: Python :: 3", | ||||||||||
"Programming Language :: Python :: 3.8", | ||||||||||
"Programming Language :: Python :: 3.9", | ||||||||||
"Programming Language :: Python :: 3.10", | ||||||||||
"Programming Language :: Python :: 3.11", | ||||||||||
Comment on lines
+27
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
"Programming Language :: Python :: 3.12", | ||||||||||
"Topic :: Scientific/Engineering :: GIS", | ||||||||||
] | ||||||||||
version="0.0.1" | ||||||||||
dependencies = [ | ||||||||||
] | ||||||||||
|
||||||||||
[project.urls] | ||||||||||
Homepage = 'https://developmentseed.org/polder/' | ||||||||||
Documentation = "https://developmentseed.org/polder/" | ||||||||||
Issues = "https://github.com/developmentseed/polder/issues" | ||||||||||
Source = "https://github.com/developmentseed/polder" | ||||||||||
Changelog = "https://developmentseed.org/polder/release-notes/" | ||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.