CI #4122
This file contains 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 | |
# Run tests on pull requests and when changes are directly | |
# commited to master. | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: | |
- master | |
# run the CI also on PRs that are based on branches starting with pr/... | |
- 'pr/**' | |
schedule: | |
- cron: 1 1 * * * | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
type: boolean | |
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' | |
required: false | |
default: false | |
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/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ needs.go-versions.outputs.latest }} | |
- name: Install revive | |
run: go install github.com/mgechev/revive@latest | |
- name: Run checks | |
run: make check | |
# 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 | |
matrix: | |
ceph_version: | |
- "octopus" | |
- "pacific" | |
- "quincy" | |
- "reef" | |
- "squid" | |
- "pre-quincy" | |
- "pre-reef" | |
- "pre-squid" | |
- "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@v4 | |
- name: Set cores to get stored as "core" | |
run: sudo bash -c 'echo "core" > /proc/sys/kernel/core_pattern' | |
- name: Run tests | |
run: make test-containers-test "CEPH_VERSION=${{ matrix.ceph_version }}" "GO_VERSION=${{ matrix.go_version }}" "RESULTS_DIR=$PWD/_results" | |
# Enable tmate debugging of manually-triggered workflows if the input option was provided | |
- name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |
- name: Clean up test containers | |
if: always() | |
run: make test-containers-clean "CEPH_VERSION=${{ matrix.ceph_version }}" | |
- name: Archive test results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "go-ceph-results-${{ matrix.ceph_version }}-${{ matrix.go_version }}" | |
path: | | |
_results/ | |
retention-days: 30 | |
- name: Check API Versions and Aging | |
if: always() | |
run: | | |
if [ -f _results/implements.json ]; then | |
./contrib/apiage.py | |
else | |
echo "Skipping apiage check" | |
fi |