Skip to content

[TT-11566][TT-11953] upgraded go to 1.22 #10468

[TT-11566][TT-11953] upgraded go to 1.22

[TT-11566][TT-11953] upgraded go to 1.22 #10468

Workflow file for this run

name: CI tests
on:
pull_request:
branches:
- master
- release-**
types:
- opened
- reopened
- synchronize
- ready_for_review
push:
branches:
- master
- release-**
env:
TYK_DB_REDISHOST: localhost
TYK_GW_STORAGE_HOST: localhost
PYTHON_VERSION: "3.11"
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python
jobs:
test:
name: Go ${{ matrix.go-version }} Redis ${{ matrix.redis-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
redis-version: [5, 7]
python-version: ["3.11"]
go-version: [1.22.x]
steps:
- name: Checkout Tyk
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Setup Golang
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies and basic hygiene test
id: hygiene
run: |
sudo apt-get install libluajit-5.1-dev
python -m pip install --upgrade pip
pip install setuptools
pip install google
pip install 'protobuf==4.24.4'
make lint
git add --all
git diff HEAD > git-state.log
git_state_count=$(wc -l < git-state.log)
if [[ $git_state_count -ne 0 ]]
then
echo "git-state<<EOF" >> $GITHUB_OUTPUT
cat git-state.log >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "make lint made git state dirty, please run make lint locally and update PR"
exit 1
fi
- name: Fetch base branch
if: ${{ github.event_name == 'pull_request' }}
run: git fetch origin ${{ github.base_ref }}
- name: Start Redis
uses: supercharge/redis-github-action@1.2.0
with:
redis-version: ${{ matrix.redis-version }}
- name: Cache
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run Gateway Tests
id: ci-tests
run: |
./bin/ci-tests.sh 2>&1
- name: Notify status
if: ${{ failure() && github.event.pull_request.number && !github.event.pull_request.draft }}
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
# :boom: CI tests failed :see_no_evil:
## git-state
```shellsession
${{ steps.hygiene.outputs.git-state || 'all ok' }}
```
Please look at [the run](https://github.com/TykTechnologies/tyk/pull/${{ github.event.pull_request.number }}/checks?check_run_id=${{ github.run_id }}) or in the _Checks_ tab.
- name: Download golangci-lint
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin
- name: golangci-lint
if: ${{ github.event_name == 'pull_request' }}
run: |
$(go env GOPATH)/bin/golangci-lint run --out-format checkstyle --issues-exit-code=0 --new-from-rev=origin/${{ github.base_ref }} ./... > golanglint.xml
- name: golangci-lint-on-push
if: ${{ github.event_name == 'push' }}
run: |
$(go env GOPATH)/bin/golangci-lint run --out-format checkstyle --issues-exit-code=0 ./... > golanglint.xml
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
with:
args: >
-Dsonar.organization=tyktechnologies
-Dsonar.projectKey=TykTechnologies_tyk
-Dsonar.sources=.
-Dsonar.exclusions=**/testdata/*,coprocess/**/*,ci/**,smoke-tests/**,apidef/oas/schema/schema.gen.go
-Dsonar.coverage.exclusions=**/*_test.go,**/mock/*
-Dsonar.test.inclusions=**/*_test.go
-Dsonar.tests=.
-Dsonar.go.coverage.reportPaths=*.cov
-Dsonar.go.golangci-lint.reportPaths=golanglint.xml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}