feat: upgrade ci action version (#1080) #2019
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Layotto Dev Pipeline 🌊 | |
# Ignore some changes of commits: | |
# 1. changes in .ci/ | |
# 2. changes in docs/ | |
# 3. changes in markdown files | |
on: | |
push: | |
branches: [main] | |
paths-ignore: | |
- 'docs/**' | |
- '**/*.md' | |
pull_request: | |
branches: "*" | |
paths-ignore: | |
- 'docs/**' | |
- '**/*.md' | |
jobs: | |
style-check: | |
name: "Go Style Check" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.18.1 | |
- name: Format Go | |
run: | | |
make workspace | |
resolve-modules: | |
name: "Resolve Go Modules" | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- name: Checkout Sources | |
uses: actions/checkout@v4 | |
- id: set-matrix | |
run: sh ./etc/script/resolve-modules.sh | |
golangci-lint: | |
name: "Go CI Linter" | |
needs: [style-check,resolve-modules] | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: ${{ fromJson(needs.resolve-modules.outputs.matrix) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.18.5 | |
- name: Go Lint Test | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: v1.46.2 | |
working-directory: ${{ matrix.workdir }} | |
args: "--out-${NO_FUTURE}format colored-line-number" | |
go-unit-test: | |
name: "Go Unit Test" | |
needs: [style-check] | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.18.1 | |
- name: Go Unit Test | |
run: make test | |
coverage: | |
name: "Coverage Analysis" | |
needs: [go-unit-test,golangci-lint,style-check] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Test Coverage | |
run: make coverage | |
- name: Post Coverage | |
run: bash <(curl -s https://codecov.io/bash) | |
wasm-integrate: | |
name: "Integrate with WASM" | |
needs: [coverage] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.18.1 | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Run Integrate tests | |
run: make integrate-wasm | |
runtime-integrate: | |
name: "Integrate with Runtime" | |
needs: [coverage] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.18.1 | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Run Integrate tests | |
run: make integrate-runtime | |
build-binary-darwin-amd64-artifact: | |
name: "Darwin AMD64 Artifact" | |
needs: [runtime-integrate,wasm-integrate] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.18.1 | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Build Artifact | |
run: | | |
make go.build.darwin_amd64.layotto | |
- name: Publish Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: layotto.darwin_amd64 | |
path: _output/darwin/amd64/layotto | |
retention-days: 5 | |
if-no-files-found: error | |
build-binary-darwin-arm64-artifact: | |
name: "Darwin ARM64 Artifact" | |
needs: [runtime-integrate,wasm-integrate] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.18.1 | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Build Artifact | |
run: | | |
make go.build.darwin_arm64.layotto | |
- name: Publish Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: layotto.darwin_arm64 | |
path: _output/darwin/arm64/layotto | |
retention-days: 5 | |
if-no-files-found: error | |
build-binary-linux-amd64-artifact: | |
name: "Linux AMD64 Artifact" | |
needs: [runtime-integrate,wasm-integrate] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.18.1 | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Build Artifact | |
run: | | |
make go.build.linux_amd64.layotto | |
- name: Publish Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: layotto.linux_amd64 | |
path: _output/linux/amd64/layotto | |
retention-days: 5 | |
if-no-files-found: error | |
build-binary-linux-arm64-artifact: | |
name: "Linux ARM64 Artifact" | |
needs: [runtime-integrate,wasm-integrate] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.18.1 | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Build Artifact | |
run: | | |
make go.build.linux_arm64.layotto | |
- name: Publish Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: layotto.linux_arm64 | |
path: _output/linux/arm64/layotto | |
retention-days: 5 | |
if-no-files-found: error | |
build-wasm-binary-linux-amd64-artifact: | |
name: "Linux AMD64 WASM Artifact" | |
needs: [wasm-integrate] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.18.1 | |
- name: Check out code | |
uses: actions/checkout@v4 | |
# TODO(@Xunzhuo): open it after stabilizing wasm cmds | |
# - name: Build Artifact | |
# run: | | |
# make wasm | |
# - name: Publish Artifact | |
# uses: actions/[email protected] | |
# with: | |
# name: layotto.wasm.linux_amd64 | |
# path: _output/linux/amd64/layotto | |
# retention-days: 5 | |
# if-no-files-found: error | |
build-push-wasm-image: | |
name: "Linux AMD64 WASM Image" | |
needs: [build-wasm-binary-linux-amd64-artifact,build-binary-linux-arm64-artifact,build-binary-linux-amd64-artifact,build-binary-darwin-amd64-artifact,build-binary-darwin-arm64-artifact] | |
if: github.ref_name == 'main' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
# TODO(@Xunzhuo): open it after stabilizing wasm cmds | |
# - name: Login to DockerHub | |
# uses: docker/login-action@v3 | |
# with: | |
# username: ${{ secrets.DOCKERHUB_USERNAME }} | |
# password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# - name: Build Layotto Latest Image | |
# run: | | |
# make wasm.image VERSION=latest | |
# - name: Push Image to DockerHub | |
# run: | | |
# make wasm.image.push VERSION=latest | |
build-push-linux-amd64-image: | |
name: "Linux AMD64 Image" | |
needs: [build-wasm-binary-linux-amd64-artifact,build-binary-linux-arm64-artifact,build-binary-linux-amd64-artifact,build-binary-darwin-amd64-artifact,build-binary-darwin-arm64-artifact] | |
if: github.ref_name == 'main' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build Layotto Latest Image | |
run: | | |
make image.build.linux_amd64.layotto VERSION=latest | |
- name: Push Image to DockerHub | |
run: | | |
make image.push.linux_amd64.layotto VERSION=latest | |
- name: Build layotto/layotto_injector:latest Image | |
run: | | |
make image.build.linux_amd64.layotto_injector VERSION=latest | |
- name: Push layotto/layotto_injector:latest Image to DockerHub | |
run: | | |
make image.push.linux_amd64.layotto_injector VERSION=latest | |
- name: Build layotto/proxyv2:latest Image | |
run: | | |
make image.proxyv2.build VERSION=latest | |
- name: Push layotto/proxyv2:latest Image to DockerHub | |
run: | | |
make image.proxyv2.push VERSION=latest | |
build-push-linux-arm64-image: | |
name: "Linux ARM64 Image" | |
needs: [build-wasm-binary-linux-amd64-artifact,build-binary-linux-arm64-artifact,build-binary-linux-amd64-artifact,build-binary-darwin-amd64-artifact,build-binary-darwin-arm64-artifact] | |
if: github.ref_name == 'main' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build Layotto Latest Image | |
run: | | |
make image.build.linux_arm64.layotto VERSION=latest | |
- name: Push Image to DockerHub | |
run: | | |
make image.push.linux_arm64.layotto VERSION=latest | |
- name: Build layotto/layotto_injector:latest Image | |
run: | | |
make image.build.linux_arm64.layotto_injector VERSION=latest | |
- name: Push layotto/layotto_injector:latest Image to DockerHub | |
run: | | |
make image.push.linux_arm64.layotto_injector VERSION=latest | |
package-push-injector-helm-chart: | |
name: "Layotto Injector Helm Chart" | |
if: github.ref_name == 'main' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Package and Push Layotto Injector Latest Helm Chart | |
run: | | |
CHART_VERSION=v0.0.0-latest APP_VERSION=latest make helm-package | |
CHART_VERSION=v0.0.0-latest APP_VERSION=latest make helm-push |