mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-19 00:02:03 +00:00
279 lines
9.0 KiB
YAML
279 lines
9.0 KiB
YAML
env:
|
|
LOCAL_REGISTRY: registry.wimill.xyz
|
|
REGISTRY: ghcr.io
|
|
ECR_REGISTRY: 976079455550.dkr.ecr.us-east-1.amazonaws.com
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
name: Build and push docker image
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
tags: ["*"]
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
|
|
concurrency:
|
|
group: ${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: [self-hosted, new]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Login to registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Docker meta
|
|
id: meta-slim
|
|
if: github.event_name == 'pull_request'
|
|
uses: docker/metadata-action@v4
|
|
with:
|
|
images: |
|
|
${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}-slim
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=ref,event=pr
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
|
|
- name: Build and push publicly
|
|
uses: docker/build-push-action@v3
|
|
if: github.event_name == 'pull_request'
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: |
|
|
${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}-slim:latest
|
|
${{ steps.meta-slim.outputs.tags }}
|
|
labels: |
|
|
${{ steps.meta-slim.outputs.labels }}
|
|
cache-from: type=registry,ref=${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}-slim:buildcache
|
|
cache-to: type=registry,ref=${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}-slim:buildcache,mode=max
|
|
|
|
- name: Docker meta
|
|
id: meta-public
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/metadata-action@v4
|
|
with:
|
|
images: |
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=ref,event=pr
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
|
|
|
|
- name: Build and push publicly
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: |
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
|
${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}-slim:latest
|
|
${{ steps.meta-public.outputs.tags }}
|
|
labels: |
|
|
${{ steps.meta-public.outputs.labels }}
|
|
org.opencontainers.image.licenses=AGPLv3
|
|
cache-from: type=registry,ref=${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}-slim:buildcache
|
|
cache-to: type=registry,ref=${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}-slim:buildcache,mode=max
|
|
|
|
build_ee:
|
|
runs-on: [self-hosted, new]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Docker meta
|
|
id: meta-slim
|
|
if: github.event_name == 'pull_request'
|
|
uses: docker/metadata-action@v4
|
|
with:
|
|
images: |
|
|
${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}-slim
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=ref,event=pr
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
|
|
|
|
- name: Docker meta
|
|
id: meta-ee-public
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/metadata-action@v4
|
|
with:
|
|
images: |
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-ee
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=ref,event=pr
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
|
|
- name: Login to registry
|
|
uses: docker/login-action@v2
|
|
if: github.event_name != 'pull_request'
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build and push publicly ee
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
context: .
|
|
push: true
|
|
build-args: |
|
|
features=enterprise
|
|
nsjail=true
|
|
tags: |
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-ee:latest
|
|
${{ steps.meta-ee-public.outputs.tags }}
|
|
labels: |
|
|
${{ steps.meta-ee-public.outputs.labels }}
|
|
org.opencontainers.image.licenses=Windmill-Enterprise-License
|
|
cache-from: type=registry,ref=${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}-ee:buildcache
|
|
cache-to: type=registry,ref=${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}-ee:buildcache,mode=max
|
|
|
|
playwright:
|
|
runs-on: [self-hosted, new]
|
|
needs: [build]
|
|
services:
|
|
postgres:
|
|
image: postgres
|
|
env:
|
|
POSTGRES_DB: windmill
|
|
POSTGRES_USER: admin
|
|
POSTGRES_PASSWORD: changeme
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: "Docker"
|
|
run: echo "::set-output name=id::$(docker run --network=host --rm -d -p 8000:8000 --privileged -it -e DATABASE_URL=postgres://admin:changeme@localhost:5432/windmill -e BASE_INTERNAL_URL=http://localhost:8000 ${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}-slim:latest)"
|
|
id: docker-container
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 16
|
|
- name: "Playwright run"
|
|
timeout-minutes: 2
|
|
run: cd frontend && npm ci @playwright/test && npx playwright install && npm run test
|
|
- name: "Clean up"
|
|
run: docker kill ${{ steps.docker-container.outputs.id }}
|
|
if: always()
|
|
|
|
|
|
publish_privately_heavy:
|
|
needs: [build_ee]
|
|
runs-on: [self-hosted, new]
|
|
if: github.event_name != 'pull_request'
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Docker meta
|
|
id: meta-heavy
|
|
uses: docker/metadata-action@v4
|
|
with:
|
|
images: |
|
|
${{ env.ECR_REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=ref,event=pr
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=sha
|
|
|
|
- name: Login to ECR
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ${{ env.ECR_REGISTRY }}
|
|
username: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
|
|
- name: Login to registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build and push privately
|
|
uses: docker/build-push-action@v3
|
|
if: github.event_name != 'pull_request'
|
|
with:
|
|
context: .
|
|
push: true
|
|
file: ./docker/DockerfileHeavy
|
|
tags: |
|
|
${{ steps.meta-heavy.outputs.tags }}
|
|
labels: ${{ steps.meta-heavy.outputs.labels }}
|
|
cache-from: type=registry,ref=${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}-heavy:buildcache
|
|
cache-to: type=registry,ref=${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}-heavy:buildcache,mode=max
|
|
|
|
publish_privately_helm:
|
|
runs-on: [self-hosted, new]
|
|
needs: [build_ee]
|
|
if: github.event_name != 'pull_request'
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
|
|
- name: Login to registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Login to ECR
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ${{ env.ECR_REGISTRY }}
|
|
username: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
|
|
- name: Build and push privately
|
|
uses: docker/build-push-action@v3
|
|
if: github.event_name != 'pull_request'
|
|
with:
|
|
context: .
|
|
push: true
|
|
file: ./docker/DockerfileHelm
|
|
tags: |
|
|
${{ env.ECR_REGISTRY }}/${{ env.IMAGE_NAME }}:helm
|
|
cache-from: type=registry,ref=${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}-helm:buildcache
|
|
cache-to: type=registry,ref=${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}-helm:buildcache,mode=max
|