Skip to content

Commit

Permalink
Switch to GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
9dogs committed Jan 15, 2024
1 parent 3e35af6 commit 19e2bf9
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 128 deletions.
19 changes: 0 additions & 19 deletions .azure-pipelines/azure-pipelines.yml

This file was deleted.

29 changes: 0 additions & 29 deletions .azure-pipelines/stage-lint.yml

This file was deleted.

21 changes: 0 additions & 21 deletions .azure-pipelines/stage-publish.yml

This file was deleted.

59 changes: 0 additions & 59 deletions .azure-pipelines/stage-test.yml

This file was deleted.

84 changes: 84 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Lint and test

on:
push:
branches:
- '*'
tags:
- '*'

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11

- name: Install poetry
run: pip install poetry

- name: Install dependencies
run: poetry install --with main,dev

- name: Run linters
run: make lint

test:
strategy:
matrix:
python-version: ['3.10', '3.11']
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

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

- name: Install poetry
run: pip install poetry

- name: Install dependencies
run: poetry install --with main,dev

- name: Run tests
run: make test

publish:
runs-on: ubuntu-latest
if: github.ref_type == 'tag'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11

- name: Install poetry
run: pip install poetry

- name: Publish to PyPI
run: poetry publish --build
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}

- name: Login to DockerHub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin

- name: Build and push Docker image
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/tg-odesli-bot:${{ github.ref }} .
docker push ${{ secrets.DOCKER_USERNAME }}/tg-odesli-bot:${{ github.ref }}

0 comments on commit 19e2bf9

Please sign in to comment.