Skip to content

Commit

Permalink
Add back the CI
Browse files Browse the repository at this point in the history
  • Loading branch information
dudanogueira committed Mar 16, 2024
1 parent e727bd6 commit 55ccab1
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 18 deletions.
38 changes: 20 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,50 @@ env:

on:
pull_request:
branches: ['master', 'main']
paths-ignore: ['docs/**']
branches: [ "master", "main", "dev" ]
paths-ignore: [ "docs/**" ]

push:
branches: ['master', 'main']
paths-ignore: ['docs/**']
branches: [ "master", "main", "dev" ]
paths-ignore: [ "docs/**" ]

concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
linter:
runs-on: ubuntu-latest
steps:

- name: Checkout Code Repository
uses: actions/checkout@v4
uses: actions/checkout@v3.5.3

- name: Set up Python
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: '3.11'
# Consider using pre-commit.ci for open source project
- name: Run pre-commit
python-version: 3.8

# Run all pre-commit hooks on all the files.
# Getting only staged files can be tricky in case a new PR is opened
# since the action is run on a branch in detached head state
- name: Install and Run Pre-commit
uses: pre-commit/[email protected]

# With no caching at all the entire ci process takes 3m to complete!
# With no caching at all the entire ci process takes 4m 30s to complete!
pytest:
runs-on: ubuntu-latest

steps:

- name: Checkout Code Repository
uses: actions/checkout@v4
uses: actions/checkout@v3.5.3

- name: Build the Stack
run: docker compose -f local.yml build django
run: docker compose -f local.yml build

- name: Run DB Migrations
run: docker compose -f local.yml run --rm django python manage.py migrate
run: docker compose -f local.yml run --rm django python manage.py migrate

- name: Run Django Tests
run: docker compose -f local.yml run django pytest
run: docker compose -f local.yml run django pytest

- name: Tear down the Stack
run: docker compose -f local.yml down
run: docker compose -f local.yml down
42 changes: 42 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Docker Builds

on:
push:
branches:
- 'master'
- 'dev'
tags:
- 'v*'

pull_request:
branches:
- 'master'
jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/[email protected]
-
name: Docker meta
id: meta
uses: crazy-max/[email protected]
with:
images: dudanogueira/rocket.connect
-
name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Build and push
uses: docker/[email protected]
with:
context: .
file: ./compose/production/django/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 55ccab1

Please sign in to comment.