-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Unit Tests; Simplify the Installation; Create the CI (#9)
- Loading branch information
1 parent
48dfcb3
commit 510d51f
Showing
40 changed files
with
1,577 additions
and
380 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,39 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright (C) 2023 Benjamin Thomas Schwertfeger | ||
# Github: https://github.com/btschwertfeger | ||
# | ||
# Template workflow to build and install BiasAdjustCXX | ||
# | ||
|
||
name: Build and install BiasAdjustCXX | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
Build: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: alpine:3.17 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install dependencies | ||
run: | | ||
apk add --update linux-headers libc-dev g++ build-base git cmake libaec-dev netcdf-dev hdf5-dev curl-dev | ||
git clone https://github.com/Unidata/netcdf-cxx4.git | ||
cd netcdf-cxx4 | ||
cmake -S . -B build | ||
cmake --build build | ||
cd build | ||
ctest | ||
make install | ||
cd ../.. | ||
rm -rf netcdf-cxx4 | ||
- name: Build and install BiasAdjustCXX | ||
run: | | ||
make build | ||
make install | ||
make uninstall |
29 changes: 23 additions & 6 deletions
29
.github/workflows/docker_build.yaml → .github/workflows/_build_docker.yml
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 |
---|---|---|
@@ -1,27 +1,44 @@ | ||
name: Docker build | ||
## Checks the code logic, style and more | ||
# -*- coding: utf-8 -*- | ||
# Copyright (C) 2023 Benjamin Thomas Schwertfeger | ||
# Github: https://github.com/btschwertfeger | ||
# | ||
# Workflow to build the docker image. | ||
|
||
name: Build Docker Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'master' | ||
workflow_call: | ||
inputs: | ||
TAG: | ||
type: string | ||
required: true | ||
secrets: | ||
DOCKERHUB_USERNAME: | ||
required: true | ||
DOCKERHUB_TOKEN: | ||
required: true | ||
|
||
jobs: | ||
build: | ||
Deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: true | ||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/biasadjustcxx:latest | ||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/biasadjustcxx:${{ inputs.TAG }} |
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,19 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright (C) 2023 Benjamin Thomas Schwertfeger | ||
# Github: https://github.com/btschwertfeger | ||
# | ||
# Template workflow to run pre-commit. | ||
# | ||
|
||
name: Pre-Commit | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
Pre-Commit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- uses: pre-commit/[email protected] |
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,38 @@ | ||
## Checks the code logic, style and more | ||
# -*- coding: utf-8 -*- | ||
# Copyright (C) 2023 Benjamin Thomas Schwertfeger | ||
# Github: https://github.com/btschwertfeger | ||
# | ||
# Workflow to build the test suite and run the unit tests. | ||
|
||
name: Unit Tests | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
Test: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: alpine:3.17 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install dependencies | ||
run: | | ||
apk add --update linux-headers libc-dev g++ build-base git cmake libaec-dev netcdf-dev hdf5-dev curl-dev | ||
git clone https://github.com/Unidata/netcdf-cxx4.git | ||
cd netcdf-cxx4 | ||
cmake -S . -B build | ||
cmake --build build | ||
cd build | ||
ctest | ||
make install | ||
cd ../.. | ||
rm -rf netcdf-cxx4 | ||
- name: Test BiasAdjustCXX | ||
run: | | ||
make dev | ||
make test |
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,59 @@ | ||
## Checks the code logic, style and more | ||
# -*- coding: utf-8 -*- | ||
# Copyright (C) 2023 Benjamin Thomas Schwertfeger | ||
# Github: https://github.com/btschwertfeger | ||
# | ||
# Workflow to apply pre-commit, build, test and upload the docker | ||
# image(s). | ||
|
||
name: CI/CD | ||
|
||
on: | ||
push: | ||
branches: | ||
- "**" | ||
|
||
concurrency: | ||
group: CICD-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
## Run the pre-commit content | ||
Pre-Commit: | ||
uses: ./.github/workflows/_pre_commit.yml | ||
|
||
## Build the BiasAdjustCXX command-line tool | ||
## | ||
Build: | ||
needs: [Pre-Commit] | ||
uses: ./.github/workflows/_build.yml | ||
|
||
## Build the test suite and run the unit tests | ||
## | ||
Test: | ||
needs: [Pre-Commit] | ||
uses: ./.github/workflows/_test.yml | ||
|
||
## Create and upload a docker image | ||
## | ||
Docker: | ||
if: success() && github.ref != 'refs/heads/master' | ||
needs: [Build, Test] | ||
uses: ./.github/workflows/_build_docker.yml | ||
with: | ||
TAG: ${{ github.ref_name }} | ||
secrets: | ||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | ||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
## Create and upload the latest docker image | ||
## | ||
Docker-latest: | ||
needs: [Build, Test] | ||
if: success() && github.ref == 'refs/heads/master' | ||
uses: ./.github/workflows/_build_docker.yml | ||
with: | ||
TAG: latest | ||
secrets: | ||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | ||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} |
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 |
---|---|---|
|
@@ -40,4 +40,4 @@ output/ | |
qdm_result.nc | ||
del/ | ||
del.cxx | ||
del.nc | ||
del.nc |
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,19 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- id: check-added-large-files | ||
- id: check-merge-conflict | ||
- id: check-added-large-files | ||
args: ["--maxkb=500"] | ||
- id: check-executables-have-shebangs | ||
- id: trailing-whitespace | ||
- id: fix-byte-order-marker | ||
- id: fix-encoding-pragma | ||
- id: requirements-txt-fixer | ||
- id: mixed-line-ending | ||
- id: end-of-file-fixer | ||
- id: detect-private-key |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.