CI: use go 1.21 #450
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: Pipeline | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- "**.md" | |
- "Jenkinsfile" | |
jobs: | |
testing: | |
name: Short Tests with Race Detector | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["ubuntu-latest", "macos-latest", "windows-latest"] | |
go: ["1.21"] | |
env: | |
OS: ${{ matrix.os }} | |
steps: | |
- name: Checkout repository code | |
uses: actions/checkout@v3 | |
- name: Install Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ matrix.go }} | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Quick Test with Race Detector | |
run: go test -v -short -race -timeout 120s ./... | |
integration: | |
name: Run Integration Tests | |
runs-on: "ubuntu-latest" | |
services: | |
dind: | |
image: docker:23.0.6-dind-rootless | |
ports: | |
- 2375:2375 | |
needs: [testing] | |
steps: | |
- name: Checkout repository code | |
uses: actions/checkout@v3 | |
- name: Install Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: "1.21" | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Run Integration Tests with Race Detector | |
run: make integration_test | |
coverage: | |
name: Update Code Coverage | |
runs-on: ubuntu-latest | |
services: | |
dind: | |
image: docker:23.0.6-dind-rootless | |
ports: | |
- 2375:2375 | |
needs: [testing] | |
steps: | |
- name: Checkout repository code | |
uses: actions/checkout@v3 | |
- name: Install Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: "1.21" | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Generate Test Coverage Using Full Test Suite | |
run: make coverage TIMEOUT=600s | |
- name: Calculate Coverage | |
run: | | |
set -x | |
total=`go tool cover -func=cover.out | grep total | grep -Eo '[0-9]+\.[0-9]+'` | |
if (( $(echo "$total <= 60" | bc -l) )) ; then | |
COLOR=red | |
elif (( $(echo "$total > 75" | bc -l) )); then | |
COLOR=green | |
else | |
COLOR=orange | |
fi | |
echo "COLOR=$COLOR" >> $GITHUB_ENV | |
echo "COVERAGE=$total" >> $GITHUB_ENV | |
- name: Update coverage on gist | |
uses: schneegans/dynamic-badges-action@v1.6.0 | |
with: | |
auth: ${{ secrets.GIST_SECRET }} | |
gistID: 49efb3a7978bf0df7d91bfad39da7092 | |
filename: specter.json | |
label: Coverage | |
message: ${{ env.COVERAGE }} | |
color: ${{ env.COLOR }} | |
full: | |
name: Run Full Test Suite | |
runs-on: ubuntu-latest | |
services: | |
dind: | |
image: docker:23.0.6-dind-rootless | |
ports: | |
- 2375:2375 | |
needs: [testing, integration] | |
steps: | |
- name: Checkout repository code | |
uses: actions/checkout@v3 | |
- name: Install Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: "1.21" | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Test short, long, extended, and concurrency validation | |
run: make full_test TIMEOUT=600s | |
rolling: | |
name: Rolling release | |
runs-on: ubuntu-latest | |
needs: [testing, integration] | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout repository code | |
uses: actions/checkout@v3 | |
- name: Install Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: "1.21" | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Build release binaries with WAL helper | |
run: make -j$(nproc) release wal=1 | |
- name: Build compatability binaries | |
run: make -j$(nproc) compat | |
- name: Rolling release on main | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: "Automatic Build on main branch" | |
body: "This is a rolling release with the latest build artifacts on main branch. The release is updated every time commit(s) is pushed to main." | |
prerelease: true | |
tag_name: edge | |
files: bin/** |