Feature/error repeated #115
Workflow file for this run
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: cql | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [opened, synchronize, reopened] | |
permissions: | |
id-token: write | |
contents: read | |
actions: read | |
checks: write | |
jobs: | |
branch-naming-rules: | |
name: Check branch name | |
runs-on: ubuntu-latest | |
steps: | |
- uses: deepakputhraya/action-branch-name@master | |
with: | |
regex: '(^(feature|bugfix|improvement|library|prerelease|release|hotfix|poc)\/[a-z0-9_.-]+$|^dependabot)' | |
allowed_prefixes: 'feature,bugfix,improvement,library,prerelease,release,hotfix,poc,dependabot' | |
ignore: main,dev | |
min_length: 5 | |
max_length: 50 | |
check-style: | |
name: Code style | |
needs: [branch-naming-rules] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: '^1.18' | |
cache: true | |
- name: lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
skip-cache: true | |
skip-pkg-cache: true | |
skip-build-cache: true | |
test: | |
name: test | |
needs: [check-style] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
db: [postgresql, cockroachdb, mysql, sqlite, sqlserver] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: '^1.18' | |
cache: true | |
- name: Install gotestsum | |
run: go install gotest.tools/gotestsum@latest | |
- name: Start containers | |
run: docker compose -f "docker/${{ matrix.db }}/docker-compose.yml" up -d | |
if: ${{ matrix.db != 'sqlite' }} | |
- uses: kanga333/variable-mapper@master | |
id: export | |
with: | |
key: ${{ matrix.db }} | |
map: | | |
{ | |
"postgresql": { | |
"dialector": "postgres" | |
}, | |
"cockroachdb": { | |
"dialector": "postgres" | |
}, | |
"mysql": { | |
"dialector": "mysql" | |
}, | |
"sqlite": { | |
"dialector": "sqlite" | |
}, | |
"sqlserver": { | |
"dialector": "sqlserver" | |
} | |
} | |
export_to: env | |
- name: Run test | |
run: DB=${{ env.dialector }} gotestsum --junitfile tests-${{ matrix.db }}.xml ./... -tags=${{ matrix.db }} -coverpkg=./... -coverprofile=coverage_${{ matrix.db }}.out | |
- name: Test Report | |
uses: dorny/test-reporter@v1 | |
if: always() # run this step even if previous steps failed | |
with: | |
name: ${{ matrix.db }} Tests Report # Name of the check run which will be created | |
path: tests-${{ matrix.db }}.xml # Path to test results | |
reporter: java-junit # Format of test results | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: coverage | |
path: coverage_${{ matrix.db }}.out | |
- name: Stop containers | |
if: ${{ matrix.db != 'sqlite' }} | |
run: docker stop cql-test-db | |
sonarcloud: | |
name: SonarCloud | |
needs: [test] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Download line coverage reports | |
uses: actions/download-artifact@v3 | |
with: | |
name: coverage | |
- name: Download gen line coverage report | |
id: download-gen-artifact | |
uses: dawidd6/action-download-artifact@v3 | |
with: | |
workflow: gen.yml | |
workflow_conclusion: success | |
name: coverage_gen | |
- name: Download lint line coverage report | |
id: download-lint-artifact | |
uses: dawidd6/action-download-artifact@v3 | |
with: | |
workflow: lint.yml | |
workflow_conclusion: success | |
name: coverage_lint | |
- name: SonarCloud Scan | |
uses: sonarsource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |