fix: Make GitHub Actions workflows handle missing submodules gracefully #8
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 ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: false | |
| fetch-depth: 0 | |
| - name: Initialize submodules (optional) | |
| continue-on-error: true | |
| run: | | |
| git submodule sync --recursive || true | |
| git submodule update --init --recursive --force || echo "Warning: Submodules are optional, continuing without them" | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.24' | |
| cache-dependency-path: go.sum | |
| - name: Verify dependencies | |
| run: go mod verify | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Run go vet | |
| run: go vet ./... | |
| - name: Run go fmt check | |
| run: | | |
| if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then | |
| echo "Code is not formatted. Run 'go fmt ./...'" | |
| gofmt -s -d . | |
| exit 1 | |
| fi | |
| - name: Build | |
| run: | | |
| CGO_ENABLED=1 go build -o autoar ./cmd/autoar | |
| chmod +x autoar | |
| - name: Test build | |
| run: | | |
| ./autoar --help || true | |
| security: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Run Gosec Security Scanner | |
| uses: securego/gosec@master | |
| with: | |
| args: '-no-fail -fmt json -out gosec-report.json ./...' | |
| - name: Upload Gosec results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: gosec-report | |
| path: gosec-report.json | |