Skip to content

ci: we don't need note... #85

ci: we don't need note...

ci: we don't need note... #85

Workflow file for this run

name: hermes
on:
push:
paths:
- "hermes/**"
- ".github/workflows/hermes.yaml"
defaults:
run:
shell: bash
working-directory: hermes
jobs:
validation:
name: lint & pytest
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
ports:
- 5432:5432
env:
POSTGRES_DB: dbtest
POSTGRES_USER: dbtest
POSTGRES_PASSWORD: dbtest
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
AKB_DATABASE_HOST: localhost
AKB_DATABASE_PORT: 5432
AKB_DATABASE_USER: dbtest
AKB_DATABASE_PASSWORD: dbtest
AKB_DATABASE_DBNAME: dbtest
steps:
- name: install python3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: checkout
uses: actions/checkout@v3
- name: install poetry
run: pip install poetry
- name: setup env
run: poetry install
- name: black
run: poetry run black . --check
- name: pytest
run: poetry run coverage run -m pytest
- name: coverage report
run: poetry run coverage report
release:
name: release new version
runs-on: ubuntu-latest
needs: validation
if: github.ref == 'refs/heads/master'
env:
GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }}
steps:
- name: checkout
uses: actions/checkout@v3
with:
ref: 'master'
- name: install node
uses: actions/setup-node@v3
with:
node-version: 20
- name: install dependencies
run: sudo npm install -g semantic-release @semantic-release/git @semantic-release/exec
- name: git pull
run: git pull
- name: run semantic release
run: semantic-release
build:
name: build docker image
runs-on: ubuntu-latest
needs: release
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: 'master'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
platforms: linux/amd64,linux/arm/v7,linux/arm64
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: install poetry
run: pip install poetry
- name: git latest tag
run: |
git fetch --tags --prune --unshallow
tag=$(git describe --tags --abbrev=0 --match 'hermes-*')
version=$(echo $tag | cut -d'-' -f2 | cut -d'v' -f2)
echo "image_version=${version}" >> $GITHUB_ENV
- name: Export requirements
run: poetry export --with-credentials -o requirements.txt
- name: Build and push
uses: docker/build-push-action@v4
with:
context: hermes
push: true
platforms: linux/amd64,linux/arm/v7,linux/arm64
tags: |
yomain/hermes:${{ env.image_version }}
yomain/hermes:latest