ignore md files updates for actions #69
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: Go Build and Test | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths-ignore: | |
| - '**.md' | |
| pull_request: | |
| branches: [ main ] | |
| paths-ignore: | |
| - '**.md' | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Cache Go modules | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.cache/go-build | |
| $GOPATH/pkg/mod | |
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-go- | |
| - name: Use Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: '^1.20' | |
| - name: Install dependencies | |
| run: go mod tidy | |
| - name: Create required directories | |
| run: | | |
| mkdir -p $(mktemp -d)/basic-docker/containers | |
| mkdir -p $(mktemp -d)/basic-docker/images | |
| - name: Build project with error handling | |
| run: | | |
| echo "==== Building Project ====" | |
| if ! go build -o basic-docker main.go network.go image.go kubernetes.go; then | |
| echo "Error: Build failed. Please check the errors above." >&2 | |
| exit 1 | |
| fi | |
| - name: Run Go tests | |
| run: | | |
| echo "==== Running Go Tests ====" | |
| go test -v ./... | |
| - name: Run verification script | |
| run: | | |
| chmod +x verify.sh | |
| ./verify.sh |