mirror of
https://github.com/labring/sealos.git
synced 2026-09-01 15:38:06 +08:00
b89d95d148
* ci: Update ci.yml to use simpler make build to build testing binaries Signed-off-by: Mercurio <signormercurio@gmail.com> * fix GOARCH bug in Makefile Signed-off-by: Mercurio <signormercurio@gmail.com> * attempt to remove some of the dependencies Signed-off-by: Mercurio <signormercurio@gmail.com> * sync makefile and goreleaser build flags Signed-off-by: Mercurio <signormercurio@gmail.com>
127 lines
3.3 KiB
YAML
Executable File
127 lines
3.3 KiB
YAML
Executable File
name: CI
|
|
|
|
env:
|
|
# Common versions
|
|
GO_VERSION: "1.17"
|
|
|
|
on:
|
|
push:
|
|
branches: main
|
|
paths-ignore:
|
|
- "docs/**"
|
|
- "**/*.md"
|
|
- "**/*.yml"
|
|
pull_request:
|
|
branches: ["*"]
|
|
paths-ignore:
|
|
- "docs/**"
|
|
- "**/*.md"
|
|
- "**/*.yml"
|
|
|
|
jobs:
|
|
check-license:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
- name: Check License
|
|
run: make verify-license
|
|
|
|
resolve-modules:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
- name: Resolve Modules
|
|
id: set-matrix
|
|
run: sh ./scripts/resolve-modules.sh
|
|
|
|
golangci-lint:
|
|
needs: [check-license, resolve-modules]
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix: ${{ fromJson(needs.resolve-modules.outputs.matrix) }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
- name: Install Dependencies
|
|
run: sudo apt install -y libgpgme-dev libdevmapper-dev libbtrfs-dev
|
|
- name: Run Linter
|
|
uses: golangci/golangci-lint-action@v3
|
|
with:
|
|
version: v1.39.0
|
|
working-directory: ${{ matrix.workdir }}
|
|
args: "--out-${NO_FUTURE}format colored-line-number"
|
|
|
|
coverage:
|
|
needs: [check-license]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
- name: Install Dependencies
|
|
run: sudo apt install -y libgpgme-dev libdevmapper-dev libbtrfs-dev
|
|
- name: Run Coverage
|
|
run: make coverage
|
|
- name: Upload Coverage to Codecov
|
|
uses: codecov/codecov-action@v2
|
|
|
|
build:
|
|
needs: [golangci-lint, coverage]
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
binary: [sealos, sealctl]
|
|
arch: [arm64, amd64]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
- name: Setup MultiArch Apt
|
|
if: ${{ matrix.arch == 'arm64' }}
|
|
run: |
|
|
sudo \cp .github/sources.list /etc/apt/sources.list
|
|
sudo apt update || true
|
|
sudo dpkg --add-architecture ${{ matrix.arch }}
|
|
|
|
- name: Install Build Dependencies
|
|
run: |
|
|
sudo apt update || true
|
|
sudo apt install -y libbtrfs-dev:${{ matrix.arch }} libgpgme-dev:${{ matrix.arch }}
|
|
|
|
- name: Install gcc
|
|
if: ${{ matrix.arch == 'arm64' }}
|
|
run: sudo apt install -y gcc-aarch64-linux-gnu
|
|
|
|
- name: Build Binaries
|
|
run: |
|
|
make build BINS=${{ matrix.binary }} PLATFORM=linux_${{ matrix.arch }}
|
|
|
|
- name: Compress Binaries
|
|
run: |
|
|
make compress BINS=${{ matrix.binary }} PLATFORM=linux_${{ matrix.arch }}
|
|
|
|
- name: Save binaries
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: ${{ matrix.binary }}-${{ matrix.arch }}
|
|
path: bin/linux_${{ matrix.arch}}/${{ matrix.binary }}
|