diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fca0b84e7..82816bc9e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,13 +15,35 @@ on: - cron: 1 1 * * * jobs: + # Determine the latest go versions + go-versions: + runs-on: ubuntu-latest + steps: + - id: go-versions + run: | + curl -s 'https://go.dev/dl/?mode=json' -o go-latest.json + curl -s 'https://go.dev/dl/?mode=json&include=all' -o go-all.json + + LATEST=$(jq -r '.[0]|.version' go-latest.json) + PREV=$(jq -r '.[1]|.version' go-latest.json) + UNSTABLE=$(jq -r '.[0]|.version' go-all.json) + + echo "latest=${LATEST#go}" >> $GITHUB_OUTPUT + echo "prev=${PREV#go}" >> $GITHUB_OUTPUT + echo "unstable=${UNSTABLE#go}" >> $GITHUB_OUTPUT + outputs: + latest: ${{ steps.go-versions.outputs.latest }} + prev: ${{ steps.go-versions.outputs.prev }} + unstable: ${{ steps.go-versions.outputs.unstable }} + # Run static/code-quality checks check: + needs: go-versions runs-on: ubuntu-latest steps: - uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version: ${{ needs.go-versions.outputs.latest }} - uses: actions/checkout@v3 - name: Install revive run: go install github.com/mgechev/revive@latest @@ -30,6 +52,9 @@ jobs: # Run the test suite in a container per-ceph-codename test-suite: + name: > + test-suite (${{ matrix.ceph_version }}${{ matrix.go_version != needs.go-versions.outputs.latest && format(', go{0}', matrix.go_version) || '' }}) + needs: go-versions runs-on: ubuntu-latest strategy: fail-fast: false @@ -43,16 +68,23 @@ jobs: - "pre-quincy" - "pre-reef" - "main" + go_version: + - ${{ needs.go-versions.outputs.latest }} + include: + - ceph_version: "reef" + go_version: ${{ needs.go-versions.outputs.prev }} + - ceph_version: "reef" + go_version: ${{ needs.go-versions.outputs.unstable }} steps: - uses: actions/checkout@v3 - name: Run tests - run: make test-containers-test "CEPH_VERSION=${{ matrix.ceph_version }}" "RESULTS_DIR=$PWD/_results" + run: make test-containers-test "CEPH_VERSION=${{ matrix.ceph_version }}" "GO_VERSION=${{ matrix.go_version }}" "RESULTS_DIR=$PWD/_results" - name: Clean up test containers run: make test-containers-clean "CEPH_VERSION=${{ matrix.ceph_version }}" - name: Archive test results uses: actions/upload-artifact@v3 with: - name: "go-ceph-results-${{ matrix.ceph_version }}" + name: "go-ceph-results-${{ matrix.ceph_version }}-${{ matrix.go_version }}" path: | _results/ retention-days: 30 diff --git a/Makefile b/Makefile index e94f83c2f..fddda58a7 100644 --- a/Makefile +++ b/Makefile @@ -113,6 +113,9 @@ endif # Assemble the various build args that will be passed container build command(s) CONTAINER_BUILD_ARGS:=$(DEFAULT_BUILD_ARGS) CONTAINER_BUILD_ARGS += --build-arg GOARCH=$(GOARCH) +ifneq ($(GO_VERSION),) + CONTAINER_BUILD_ARGS += --build-arg GO_VERSION=$(GO_VERSION) +endif ifdef CEPH_IMG CONTAINER_BUILD_ARGS += --build-arg CEPH_IMG=$(CEPH_IMG) endif diff --git a/testing/containers/ceph/Dockerfile b/testing/containers/ceph/Dockerfile index 12e14e5b7..64e80a890 100644 --- a/testing/containers/ceph/Dockerfile +++ b/testing/containers/ceph/Dockerfile @@ -14,9 +14,9 @@ RUN true && \ yum update -y && \ cv="$(rpm -q --queryformat '%{version}-%{release}' ceph-common)" && \ yum install -y \ - git wget curl make \ - /usr/bin/cc /usr/bin/c++ \ - "libcephfs-devel-${cv}" "librados-devel-${cv}" "librbd-devel-${cv}" && \ + git wget curl make \ + /usr/bin/cc /usr/bin/c++ \ + "libcephfs-devel-${cv}" "librados-devel-${cv}" "librbd-devel-${cv}" && \ yum clean all && \ true @@ -38,7 +38,6 @@ ENV PATH="${PATH}:/opt/go/bin" ENV GOROOT=/opt/go ENV GO111MODULE=on ENV GOPATH /go -ENV GODEBUG=cgocheck=2 ENV GOCACHE=/go/cache WORKDIR /go/src/github.com/ceph/go-ceph VOLUME /go/src/github.com/ceph/go-ceph