diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..5f72800 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,71 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +env: + earthly_version: ^0.7.19 + +jobs: + go-mod: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version-file: 'go.mod' + + - run: go mod tidy + + - name: Check go.mod and go.sum + run: git diff --exit-code -- go.mod go.sum + + go-generate: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + + - uses: earthly/actions-setup@v1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + version: ${{ env.earthly_version }} + + - run: earthly +generate + + - name: Check diff + run: git diff --exit-code + + go-build: + runs-on: ubuntu-22.04 + strategy: + matrix: + go-env: + - name: amd64 + env: GOOS=linux GOARCH=amd64 + - name: arm64 + env: GOOS=linux GOARCH=arm64 + - name: armv7 + env: GOOS=linux GOARCH=arm GOARM=7 + steps: + - uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version-file: 'go.mod' + + - name: Build + run: CGO_ENABLED=0 ${{ matrix.go-env.env }} go build -o out/ + + - uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.go-env.name }} + path: out/**/*