Skip to content

Commit

Permalink
fix: pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
SKairinos committed Sep 28, 2023
1 parent 217b0b4 commit 190b5d8
Showing 1 changed file with 43 additions and 23 deletions.
66 changes: 43 additions & 23 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,65 +12,60 @@ env:

jobs:
test:
name: Test Code
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v3
- name: 🛫 Checkout
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
- name: 🐍 Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install Python Packages
- name: 🛠 Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pipenv
pipenv install --dev
- name: Check Code Format
- name: 🔎 Check Code Format
run: if ! pipenv run black --check .; then exit 1; fi

- name: Check Migrations
- name: 🔎 Check Migrations
run: pipenv run python manage.py makemigrations --check --dry-run

# TODO: assert code coverage target.
- name: Test Code Units
- name: 🧪 Test Code Units
run: pipenv run pytest

release:
name: Publish Release
concurrency: release
sync:
runs-on: ubuntu-latest
needs: [test]
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
fetch-depth: 0
- name: 🛫 Checkout
uses: actions/checkout@v3

- name: Set up Python
- name: 🐍 Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install Dependencies
- name: 🛠 Install Dependencies
run: |
python -m pip install --upgrade pip
# pipenv-setup requires downgraded vistir: https://github.com/Madoshakalaka/pipenv-setup/issues/138
python -m pip install python-semantic-release~=7.33 pipenv-setup[black]==3.2.0 vistir==0.6.1
python -m pip install pipenv-setup[black]==3.2.0 vistir==0.6.1
- name: Setup Git
- name: ⚙️ Configure Git
run: |
git config --local user.name github-actions
git config --local user.email github-actions@github.com
git config --local user.name cfl-bot
git config --local user.email codeforlife-bot@ocado.com
- name: Sync Setup Dependencies
- name: 🔄 Sync Setup Dependencies
run: |
pipenv-setup sync
git add setup.py
Expand All @@ -81,7 +76,32 @@ jobs:
git push
fi
- name: Publish Semantic Release
release:
concurrency: release
runs-on: ubuntu-latest
needs: [sync]
if: github.ref_name == 'main'
steps:
- name: 🛫 Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
fetch-depth: 0

- name: 🔄 Sync Setup Dependencies
run: git pull

- name: 🐍 Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: 🛠 Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install python-semantic-release~=7.33
- name: 🚀 Publish Semantic Release
env:
GH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: semantic-release publish --verbosity=INFO

0 comments on commit 190b5d8

Please sign in to comment.