Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

baseline platformics CI #32

Merged
merged 20 commits into from
Jun 7, 2024
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
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added because the following line was unable to connect to the port

docker compose exec $(APP_CONTAINER) python3 -m sgqlc.introspection --exclude-deprecated --exclude-description http://localhost:9009/graphql api/schema.json

.PHONY: clean
Expand Down
Loading