Skip to content

Commit

Permalink
ci: split CI pull jobs (#122)
Browse files Browse the repository at this point in the history
Signed-off-by: wuhuizuo <wuhuizuo@126.com>
  • Loading branch information
wuhuizuo authored Nov 15, 2023
1 parent 2146149 commit 14922bd
Show file tree
Hide file tree
Showing 11 changed files with 548 additions and 281 deletions.
217 changes: 0 additions & 217 deletions .github/workflows/ci.yaml

This file was deleted.

81 changes: 81 additions & 0 deletions .github/workflows/pull-cd-build-base-images.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Pull test for CD builder images
on:
pull_request:
branches:
- main
paths:
- "dockerfiles/cd/**/Dockerfile"
- "dockerfiles/cd/**/*.Dockerfile"
- "dockerfiles/cd/skaffold.yaml"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
skaffold:
name: build images with skaffold
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

strategy:
matrix:
builder-profile: [local-docker]
platform: [linux/amd64, linux/arm64]
# go-profile: [go-1.21, go-1.20, go-1.19]
# module: [builder-go, builder-others]
go-profile: [go-1.21]
module: [builder-go]
exclude:
- module: builder-others
go-profile: go-1.20
- module: builder-others
go-profile: go-1.19

steps:
- name: Checkout sources
uses: actions/checkout@v4

# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Setup skaffold
run: |
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/v2.8.0/skaffold-linux-amd64 && \
sudo install skaffold /usr/local/bin/
- name: Cache layers
uses: actions/cache@v3
with:
path: "~/.skaffold/cache"
key: skaffold/${{ matrix.platform }}/cd/${{ matrix.module }}/${{ matrix.go-profile }}-${{ github.sha }}
restore-keys: |
skaffold/${{ matrix.platform }}/cd/${{ matrix.module }}/${{ matrix.go-profile }}-${{ github.sha }}
skaffold/${{ matrix.platform }}/cd/${{ matrix.module }}/${{ matrix.go-profile }}-
skaffold/${{ matrix.platform }}/cd/${{ matrix.module }}/
- name: Build images
working-directory: dockerfiles/cd
run: |
skaffold build \
--push=false \
--build-concurrency 1 \
--platform ${{ matrix.platform }} \
--module ${{ matrix.module }} \
--profile ${{ matrix.go-profile }},${{ matrix.builder-profile }} \
--default-repo ghcr.io/pingcap-qe/cd/builders
71 changes: 71 additions & 0 deletions .github/workflows/pull-ci-release-utils-images.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Pull test for CI utils images
on:
pull_request:
branches:
- main
paths:
- "dockerfiles/ci/release-utils/**/Dockerfile"
- "dockerfiles/ci/release-utils/**/*.Dockerfile"
- "dockerfiles/ci/skaffold.yaml"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
skaffold:
name: build images with skaffold
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

strategy:
matrix:
builder-profile: [local-docker]
platform: [linux/amd64, linux/arm64]

steps:
- name: Checkout sources
uses: actions/checkout@v4

# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Setup skaffold
run: |
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/v2.8.0/skaffold-linux-amd64 && \
sudo install skaffold /usr/local/bin/
- name: Cache layers
uses: actions/cache@v3
with:
path: "~/.skaffold/cache"
key: skaffold/${{ matrix.platform }}/release-utils-${{ github.sha }}
restore-keys: |
skaffold/${{ matrix.platform }}/release-utils-${{ github.sha }}
skaffold/${{ matrix.platform }}/release-utils-
- name: Build images
working-directory: dockerfiles/ci
run: |
skaffold build \
--cache-artifacts \
--push=false \
--platform ${{ matrix.platform }} \
--module release-utils \
--profile ${{ matrix.builder-profile }} \
--default-repo ghcr.io/pingcap-qe/ci
Loading

0 comments on commit 14922bd

Please sign in to comment.