Skip to content

CI

CI #79

Workflow file for this run

# Copyright © 2020 Interplanetary Database Association e.V.,
# Planetmint and IPDB software contributors.
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
# Code is Apache-2.0 and docs are CC-BY-4.0
---
name: CI
on:
schedule:
- cron: "0 3 * * *"
push:
branches:
- "*"
tags:
- "v*.*.*"
pull_request:
branches:
- "main"
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
with:
options: "--check -l 119"
src: "."
test:
needs: lint
runs-on: ubuntu-latest
env:
REDIS_HOST: localhost
REDIS_AUTH: ''
JWT_SECRET: ZngzLUI1dFM5dXhTNEJTVnI1c2RQb1dsWm03YWtwMXo5UzRhSHBGWGhCZw==
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Setup poetry
uses: Gr1N/setup-poetry@v8
- name: Install Planetmint
run: poetry install --with dev
- name: Execute Tests
run: docker-compose up -d && poetry run pytest -vvv tests
publish-docker:
needs: test
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Login to GHCR
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_PACKAGE_DEPLOYMENT }}
- name: Docker meta
id: semver # you'll use this in the next step
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/rddl-network/cid-resolver
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.semver.outputs.tags }}
labels: ${{ steps.semver.outputs.labels }}