-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add linting and testing workflow for charts and webapp (#4)
* Add linting and testing workflow for charts and webapp * 1 - webapp * Refactor GitHub Actions workflow for webapp.yaml * Refactor GitHub Actions workflow to update node version file path * Refactor project name in pyproject.toml
- Loading branch information
1 parent
cf3b29d
commit ca0353e
Showing
12 changed files
with
200 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
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/helm/**' | ||
- '.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/helm/Chart.yaml | cut -f2 -d: | tr -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 --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 --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: webapp/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' |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# 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: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build container | ||
uses: docker/build-push-action@v6 | ||
with: | ||
platforms: linux/amd64 | ||
context: ./webapp/ | ||
file: ./webapp/Dockerfile | ||
push: true | ||
tags: "polder:dev" |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
dependencies: | ||
- name: eoapi | ||
repository: https://devseed.com/eoapi-k8s/ | ||
version: 0.4.17 | ||
digest: sha256:adbb8a0db399bf32efbf12ffafafbf07c6d4f676f78b2bf2aa6befdc5f1a4f51 | ||
generated: "2024-10-16T11:33:15.655622351+02:00" |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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
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"] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
[project] | ||
name = "polder" | ||
description = "A simple web service to create maps and viewer using eoAPI" | ||
readme = "README.md" | ||
requires-python = ">=3.8" | ||
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", | ||
"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/" | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM node:20-alpine as build | ||
WORKDIR /src | ||
RUN corepack enable && corepack prepare yarn@stable --activate | ||
COPY . . | ||
RUN yarn install | ||
RUN yarn build | ||
RUN ls -la . | ||
|
||
FROM nginx:alpine | ||
COPY --from=build /src/dist /usr/share/nginx/html | ||
EXPOSE 8080 |
This file contains 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