Skip to content

Commit

Permalink
Merge pull request #32 from chanzuckerberg/ninabernick/ci
Browse files Browse the repository at this point in the history
baseline platformics CI
  • Loading branch information
ninabernick authored Jun 7, 2024
2 parents c1a67fa + b0a179d commit 10b33d7
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 2 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build and push docker image

on:
push:
branches:
- main

jobs:
build-and-push:
name: Build and push docker image
runs-on: ubuntu-latest

steps:
- name: checkout code
uses: actions/checkout@v4
- name: set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11'
- name: install poetry
run: |
python -m pip install --no-cache-dir poetry==1.8 supervisor
- name: set up docker
run: |
make gha-setup
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Clean previous builds
run: rm -rf dist/*.whl

- name: Build with Poetry
run: poetry build

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
35 changes: 35 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build and test

on:
pull_request:
push:
branches: [main]

jobs:
build-and-test:
name: pytest
runs-on: ubuntu-latest

concurrency:
group: platformics-build-and-test-${{ github.ref }}
cancel-in-progress: true

steps:
- name: checkout code
uses: actions/checkout@v4
- name: set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11'
- name: install poetry
run: |
python -m pip install --no-cache-dir poetry==1.8 supervisor
- name: set up docker
run: make gha-setup

- name: Build docker image
run: make build

- name: run tests
run: make test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -254,3 +254,6 @@ test_app/database/*
test_app/cerbos/*
test_app/support/*
test_app/test_infra/*

# temp files
/tmp/*
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
platformics:
image: "platformics"
image: ghcr.io/chanzuckerberg/platformics:latest
build:
context: "."
dockerfile: "Dockerfile"
Expand Down
2 changes: 1 addition & 1 deletion test_app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM platformics
FROM ghcr.io/chanzuckerberg/platformics:latest

RUN apt update && \
apt install -y nginx nginx-extras && \
Expand Down
1 change: 1 addition & 0 deletions test_app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ init:
$(docker_compose_run) $(APP_CONTAINER) sh -c 'strawberry export-schema main:schema > /app/api/schema.graphql'
sleep 5 # wait for the app to reload after having files updated.
docker compose up -d
sleep 5
docker compose exec $(APP_CONTAINER) python3 -m sgqlc.introspection --exclude-deprecated --exclude-description http://localhost:9009/graphql api/schema.json

.PHONY: clean
Expand Down

0 comments on commit 10b33d7

Please sign in to comment.