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

Stabilize local dev and CI #13

Merged
merged 2 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
jobs:
release:
name: Push to DockerHub
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
Expand Down
19 changes: 3 additions & 16 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,19 @@
name: Test
on:
push: { branches: [ main ] }
pull_request_target:
pull_request:

jobs:
# Inspired from: https://dvc.ai/blog/testing-external-contributions-using-github-actions-secrets
authorize:
environment: |
${{ github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.full_name != github.repository &&
'external' || 'internal' }}
runs-on: ubuntu-latest
steps:
- run: true

test:
name: Run test suite
runs-on: ubuntu-latest
needs: authorize
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
uses: actions/checkout@v4

- name: Login to DockerHub
run: echo $DOCKER_PASS | docker login --username $DOCKER_USER --password-stdin
Expand All @@ -38,4 +25,4 @@ jobs:
run: make env-up

- name: Run tests
run: docker-compose run test
run: make test
15 changes: 11 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Available commands:

- env-up: Boot up development environment

- test: Run all tests

- env-down: Tear down development environment

- help: Display this help message
Expand All @@ -18,14 +20,19 @@ help:
.PHONY: help

build:
docker-compose build
docker compose pull
docker compose build
.PHONY: build

env-up: build
docker-compose up --detach
while ! (docker-compose logs app | grep 'Starting Metastore'); do sleep 1 && printf .; done
docker compose up --detach
while ! (docker compose logs app | grep 'Starting Metastore'); do sleep 1 && printf .; done
.PHONY: env-up

test:
docker compose run --no-deps test
.PHONY: test

env-down:
docker-compose down
docker compose down
.PHONY: env-down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ S3_PREFIX | Yes | S3 bucket prefix

This project has most of the batteries included to test and verify that the app works

1. Install docker and docker-compose
1. Install docker (27+) with compose

2. Launch dev environment
```bash
$ make env-up
$ make build env-up
```

3. Run test(s)
```bash
$ docker-compose run test
$ make test
```
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.9'

services:
postgres:
image: postgres:14-alpine
Expand Down
Loading