|
| 1 | +# This job just builds nerdctl for the golang versions we support (as a smoke test) |
| 2 | +name: build |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_call: |
| 6 | + inputs: |
| 7 | + timeout: |
| 8 | + required: true |
| 9 | + type: number |
| 10 | + go-version-stable: |
| 11 | + required: true |
| 12 | + type: string |
| 13 | + go-version-old: |
| 14 | + required: true |
| 15 | + type: string |
| 16 | + runner: |
| 17 | + required: true |
| 18 | + type: string |
| 19 | + |
| 20 | +env: |
| 21 | + GOTOOLCHAIN: local |
| 22 | + |
| 23 | +jobs: |
| 24 | + build: |
| 25 | + name: ${{ format('go {0}', matrix.canary && 'canary' || matrix.go ) }} |
| 26 | + timeout-minutes: ${{ inputs.timeout }} |
| 27 | + runs-on: "${{ matrix.runner }}" |
| 28 | + defaults: |
| 29 | + run: |
| 30 | + shell: bash |
| 31 | + |
| 32 | + strategy: |
| 33 | + fail-fast: false |
| 34 | + matrix: |
| 35 | + # Build for both old and stable go |
| 36 | + go: ["${{ inputs.go-version-old }}", "${{ inputs.go-version-stable }}"] |
| 37 | + canary: [false] |
| 38 | + # Additionally build for canary |
| 39 | + includes: |
| 40 | + - go: ${{ inputs.go-version-stable }} |
| 41 | + canary: true |
| 42 | + |
| 43 | + env: |
| 44 | + GO_VERSION: ${{ matrix.go }} |
| 45 | + |
| 46 | + steps: |
| 47 | + - name: "Init: checkout" |
| 48 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 49 | + with: |
| 50 | + fetch-depth: 1 |
| 51 | + |
| 52 | + - if: ${{ matrix.canary }} |
| 53 | + name: "Init (canary): retrieve GO_VERSION" |
| 54 | + run: | |
| 55 | + latest_go="$(. ./hack/github/go-canary.sh; go::canary::for::go-setup)" |
| 56 | + printf "GO_VERSION=%s\n" "$latest_go" >> "$GITHUB_ENV" |
| 57 | + [ "$latest_go" != "" ] || \ |
| 58 | + echo "::warning title=No canary go::There is currently no canary go version to test. Steps will not run." |
| 59 | +
|
| 60 | + - if: ${{ env.GO_VERSION != '' }} |
| 61 | + name: "Init: install go" |
| 62 | + uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 |
| 63 | + with: |
| 64 | + go-version: ${{ env.GO_VERSION }} |
| 65 | + check-latest: true |
| 66 | + |
| 67 | + - if: ${{ env.GO_VERSION != '' }} |
| 68 | + name: "Run: make binaries" |
| 69 | + run: | |
| 70 | + # We officially support these |
| 71 | + GOOS=linux make binaries |
| 72 | + GOOS=windows make binaries |
| 73 | + GOOS=freebsd make binaries |
| 74 | + GOOS=darwin make binaries |
| 75 | + GOARCH=arm GOARM=7 make binaries |
| 76 | +
|
| 77 | + # These architectures are not released, but we still verify that we can at least compile |
| 78 | + GOARCH=arm GOARM=6 make binaries |
| 79 | + GOARCH=ppc64le make binaries |
| 80 | + GOARCH=riscv64 make binaries |
| 81 | + GOARCH=s390x make binaries |
0 commit comments