Skip to content

Commit

Permalink
Consolidate GitHub Workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
peanutfun committed Jan 16, 2023
1 parent b9e9c25 commit 9302bf2
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 61 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@ jobs:
docker-build:
uses: ./.github/workflows/docker.yml
secrets: inherit

unit-tests:
needs: docker-build
uses: ./.github/workflows/test.yml
with:
test-type: unit-test
new_image: ${{ github.event.created }}

data-api-tests:
tests:
needs: docker-build
uses: ./.github/workflows/test.yml
with:
test-type: data-test
test_types: unit-test,data-test
16 changes: 15 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: docker

on:
workflow_call:
inputs:
new_image:
required: true
type: boolean
secrets:
DOCKER_USERNAME:
required: true
Expand Down Expand Up @@ -33,6 +37,16 @@ jobs:
-
name: Build and push
uses: docker/build-push-action@v3
if: inputs.new_image
with:
push: true
tags: ${{ env.DOCKER_IMAGE }}
-
name: Update and push
uses: docker/build-push-action@v3
if: !(inputs.new_image)
with:
push: true
tags: peanutfunn/climada_env:${{ github.ref_name }}
tags: ${{ env.DOCKER_IMAGE }}
build_args:
- base_image=${{ env.DOCKER_IMAGE }}
49 changes: 0 additions & 49 deletions .github/workflows/main.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ name: test
on:
workflow_call:
inputs:
test-type:
test_types:
required: true
type: string

jobs:
unit-test:
if: inputs.test-type == 'unit-test'
if: contains( inputs.test_types, 'unit-test' )
runs-on: ubuntu-latest
container:
image: peanutfunn/climada_env:${{ github.ref_name }}
Expand All @@ -24,7 +24,7 @@ jobs:
micromamba run python -m coverage run tests_runner.py unit
data-test:
if: inputs.test-type == 'data-test'
if: contains( inputs.test_types, 'data-test' )
runs-on: ubuntu-latest
container:
image: peanutfunn/climada_env:${{ github.ref_name }}
Expand Down
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
FROM mambaorg/micromamba:latest
# Define the base image for the task
ARG base_image=mambaorg/micromamba:latest
FROM $base_image

# Copy the requirements into the container
COPY --chown=$MAMBA_USER:$MAMBA_USER requirements /tmp/requirements/

# Install requirements, drop in an update for good measure
RUN micromamba install -y -n base -f /tmp/requirements/env_climada.yml && \
micromamba install -y -n base -f /tmp/requirements/env_developer.yml && \
micromamba update -y -n base && \
micromamba clean --all --yes
1 change: 1 addition & 0 deletions requirements/env_developer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ dependencies:
- ipython
- ipykernel
- mccabe>=0.6
- make
- pandoc
- sphinx>=2.0
- pip
Expand Down

0 comments on commit 9302bf2

Please sign in to comment.