mirror of
https://github.com/yzernik/squeaknode.git
synced 2026-08-17 13:07:32 +02:00
115 lines
3.3 KiB
YAML
115 lines
3.3 KiB
YAML
name: CI
|
|
|
|
permissions:
|
|
packages: write
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 10 * * *' # everyday at 10am
|
|
push:
|
|
branches:
|
|
- '**'
|
|
tags:
|
|
- 'v*.*.*'
|
|
pull_request:
|
|
|
|
jobs:
|
|
Timestamp-Tags:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v2
|
|
- name: Run OpenTimestamps github action
|
|
uses: yzernik/open-timestamps-github-action@v1
|
|
main:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
-
|
|
name: Checkout
|
|
uses: actions/checkout@v2
|
|
- name: Install Protoc
|
|
uses: arduino/setup-protoc@v1
|
|
- name: Set up Python 3.8
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: 3.8
|
|
- name: Install dependencies
|
|
run: |
|
|
pip install -r requirements.txt
|
|
pip install -r requirements-dev.txt
|
|
pip install tox
|
|
- name: Run tests and collect coverage
|
|
run: |
|
|
make gen-protos
|
|
coverage run -m pytest tests
|
|
coverage xml
|
|
-
|
|
name: Coverage
|
|
uses: codecov/codecov-action@v2
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
|
|
-
|
|
name: Docker meta
|
|
id: docker_meta
|
|
uses: docker/metadata-action@v3
|
|
with:
|
|
images: ghcr.io/${{ github.repository_owner }}/squeaknode
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=ref,event=pr
|
|
type=semver,pattern=v{{version}}
|
|
type=semver,pattern=v{{major}}.{{minor}}
|
|
type=semver,pattern=v{{major}}
|
|
type=sha
|
|
-
|
|
name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v1
|
|
-
|
|
name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
-
|
|
name: Cache Docker layers
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: /tmp/.buildx-cache
|
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
|
restore-keys: |
|
|
${{ runner.os }}-buildx-
|
|
-
|
|
name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v1
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
-
|
|
name: Build and push
|
|
id: docker_build
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
platforms: linux/arm64,linux/amd64
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.docker_meta.outputs.tags }}
|
|
labels: ${{ steps.docker_meta.outputs.labels }}
|
|
cache-from: type=local,src=/tmp/.buildx-cache
|
|
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache
|
|
build-n-publish:
|
|
name: Build and publish Python 🐍 distributions 📦 to PyPI
|
|
runs-on: ubuntu-18.04
|
|
steps:
|
|
- uses: actions/checkout@master
|
|
- name: Set up Python 3.9
|
|
uses: actions/setup-python@v1
|
|
with:
|
|
python-version: 3.9
|
|
- name: Install dependencies and build
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements.txt
|
|
pip install setuptools wheel twine
|
|
python setup.py sdist bdist_wheel
|
|
- name: Publish distribution 📦 to PyPI
|
|
if: startsWith(github.ref, 'refs/tags')
|
|
uses: pypa/gh-action-pypi-publish@master
|
|
with:
|
|
password: ${{ secrets.PYPI_API_TOKEN }}
|