Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(gha): update ci #138

Merged
merged 5 commits into from
May 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CI

on:
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'poetry'
- name: Lint
run: |
poetry install --no-root --sync
poetry run flake8 .
build:
runs-on: ubuntu-latest
env:
PLATFORMS: linux/amd64,linux/arm64/v8,linux/arm/v7
DOCKERHUB_USERNAME: isac322
steps:
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v2
with:
platforms: ${{ env.PLATFORMS }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Restore buildkit state
uses: isac322/buildkit-state@v1
with:
buildx-name: ${{ steps.buildx.outputs.name }}

- name: Build
uses: docker/build-push-action@v4
with:
push: false
platforms: ${{ env.PLATFORMS }}
cache-from: type=gha
cache-to: type=gha,mode=min
71 changes: 0 additions & 71 deletions .github/workflows/ci.yml

This file was deleted.

68 changes: 68 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: publish

on:
release:
types: [ released ]

jobs:
build_image:
runs-on: ubuntu-latest
env:
PLATFORMS: linux/amd64,linux/arm64/v8 #,linux/arm/v7
DOCKERHUB_USERNAME: isac322
steps:
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v4
with:
flavor: latest=false
images: ${{ env.DOCKERHUB_USERNAME }}/static-lb
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v2
with:
platforms: ${{ env.PLATFORMS }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
platforms: ${{ env.PLATFORMS }}

- name: Enable buildkit cache
uses: actions/cache@v3
with:
path: /tmp/buildkit-cache/buildkit-state.tar
key: ${{ runner.os }}-buildkit-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildkit-
- name: Load buildkit state from cache
uses: dashevo/gh-action-cache-buildkit-state@v1
with:
builder: buildx_buildkit_${{ steps.buildx.outputs.name }}0
cache-path: /tmp/buildkit-cache
cache-max-size: 8g

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build
id: docker_build
uses: docker/build-push-action@v4
with:
context: .
push: true
platforms: ${{ env.PLATFORMS }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=min
Loading