Skip to content

Commit

Permalink
Add minimal example
Browse files Browse the repository at this point in the history
  • Loading branch information
benpankow committed Oct 19, 2021
1 parent 900b3e3 commit 85f9f50
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 4 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/example-minimal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Minimal Example
on: push

jobs:
minimal-example:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v1

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2

- name: Login to ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Cache Docker builds
uses: satackey/[email protected]
continue-on-error: true

- name: Run Dagster Cloud CI action
# Here, use `uses: dagster-io/dagster-cloud-ci-action@{version}`
# e.g. `uses: dagster-io/[email protected]`
uses: ./
with:
location-file: ./example/minimal/locations.yaml
dagit-url: https://elementl.dogfood.dagster.cloud/dev
api-token: ${{ secrets.DAGSTER_AGENT_TOKEN }}
9 changes: 5 additions & 4 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

This folder contains a number of examples of potential use cases of the Dagster Cloud CI Action.

- [`requirements-txt`](./multiple-locations): A minimal example containing multiple code locations,
which are built and pushed separately.
- [`multiple-locations`](./multiple-locations): A minimal example containing multiple code locations,
which are built and pushed separately.
- [`minimal`](./minimal): A minimal example which builds a single code location from a Dockerfile.
- [`requirements-txt`](./requirements-txt): A lightweight example which builds from a `requirements.txt`
file instead of a Dockerfile.
- [`multiple-locations`](./multiple-locations): An example containing multiple code locations,
which are built and pushed separately.
11 changes: 11 additions & 0 deletions example/minimal/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM python:3.8-slim

ENV DAGSTER_VERSION=0.12.14

RUN pip install \
dagster==${DAGSTER_VERSION} \
dagster-cloud==${DAGSTER_VERSION}

WORKDIR /opt/dagster/app

COPY repo.py /opt/dagster/app
8 changes: 8 additions & 0 deletions example/minimal/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Minimal Example

This is a minimal example of a repo set up to use the CI Action. The [`locations.yaml`](./locations.yaml) file
specifies to build the `github_action_demo_minimal` code location using the Dockerfile in the current
directory, using `repo.py` as an entry point.

The GitHub actions workflow for this example can be found at
[`.github/workflows/example-minimal.yml`](../../.github/workflows/example-minimal.yml).
5 changes: 5 additions & 0 deletions example/minimal/locations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
locations:
github_action_demo_minimal:
build: .
registry: 764506304434.dkr.ecr.us-west-2.amazonaws.com/github-action-demo-minimal
python_file: repo.py
27 changes: 27 additions & 0 deletions example/minimal/repo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from dagster import RunRequest, pipeline, repository, schedule, sensor, solid


@solid()
def foo_solid(_):
pass


@solid()
def foo_solid_2(_):
pass


@pipeline
def foo_pipeline():
foo_solid()
foo_solid_2()


@pipeline
def other_foo_pipeline():
foo_solid()


@repository
def foo_repo():
return [foo_pipeline]

0 comments on commit 85f9f50

Please sign in to comment.