Bugfix cplus spec yaml #17
Workflow file for this run
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: [ master, main ] | |
| pull_request: | |
| branches: [ master, main ] | |
| env: | |
| GO_VERSION: '1.20' | |
| jobs: | |
| test: | |
| name: Test on Linux AMD64 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Cache Go modules | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.cache/go-build | |
| ~/go/pkg/mod | |
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-go- | |
| - name: Verify dependencies | |
| run: go mod verify | |
| - name: Run vet | |
| run: go vet ./... | |
| - name: Run tests | |
| run: make test | |
| - name: Upload coverage reports | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| file: ./coverage.txt | |
| flags: unittests | |
| name: codecov-umbrella | |
| # 多平台CLI编译 | |
| build-multi-platform: | |
| name: Build CLI - ${{ matrix.os }}-${{ matrix.arch }} | |
| runs-on: ubuntu-latest | |
| needs: test | |
| strategy: | |
| matrix: | |
| include: | |
| - os: linux | |
| arch: amd64 | |
| target: linux_amd64 | |
| - os: linux | |
| arch: arm64 | |
| target: linux_arm64 | |
| - os: darwin | |
| arch: amd64 | |
| target: darwin_amd64 | |
| - os: darwin | |
| arch: arm64 | |
| target: darwin_arm64 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Cache Go modules | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.cache/go-build | |
| ~/go/pkg/mod | |
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-go- | |
| - name: Install musl-gcc for static linking (Linux only) | |
| if: matrix.os == 'linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y musl-tools | |
| - name: Build CLI for ${{ matrix.target }} | |
| run: make ${{ matrix.target }} MODULES=cli | |
| - name: Verify file format and structure | |
| run: | | |
| cd target/chaosblade-*-${{ matrix.target }} | |
| # 校验文件格式 | |
| echo "Verifying file structure for ${{ matrix.target }}..." | |
| ls -la | |
| echo "Checking blade binary..." | |
| file ./blade | |