Skip to content

Update github actions to fix release build (#186) #559

Update github actions to fix release build (#186)

Update github actions to fix release build (#186) #559

Workflow file for this run

name: CI Build
on:
push:
branches:
- main
pull_request:
jobs:
build:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-build
cancel-in-progress: true
env:
EXASOL_VERSION: "8.32.0"
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
id: go
- name: Set up JDKs
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: |
11
17
cache: "maven"
- name: Get npm cache directory
id: npm-cache-dir
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
- name: Cache npm modules
uses: actions/cache@v4
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install Poetry
run: pipx install poetry
- uses: actions/setup-python@v5
with:
python-version: "3.8"
cache: "poetry"
cache-dependency-path: "pkg/extensionController/bfs/udf/poetry.lock"
- name: Calculate Python test coverage
run: |
cd pkg/extensionController/bfs/udf
poetry install
poetry run pytest --cov=list_files_udf --cov-report xml --cov-report term
echo "Fixing source references for sonar"
sed --in-place 's@<source></source>@<source>pkg/extensionController/bfs/udf/</source>@' coverage.xml
- name: Enable testcontainer reuse
run: echo 'testcontainers.reuse.enable=true' > "$HOME/.testcontainers.properties"
- name: Install dependencies
run: |
go get -t ./...
echo Revert go.sum modification by previous "go get"
go mod tidy
- name: Check generated code
run: |
go generate ./...
if [[ `git status --porcelain` ]]; then
echo "Project files did change:\n"
git --no-pager diff
exit 1
else
echo "Generated code is up-to-date"
fi
- name: Build
run: |
go build ./...
go build -o extension-manager cmd/main.go
- name: Unit tests
run: |
go test -v -p 1 -count 1 -short ./...
- name: Integration tests
run: |
# -p 1 tells go not to run the tests in parallel. See the developer guide.
go test -v -p 1 -count 1 -coverprofile=coverage.out ./...
- name: Prepare testing extension
run: cd ./extension-manager-integration-test-java/testing-extension && npm ci
- name: Build and test integration test framework
run: mvn --batch-mode clean verify -Dcom.exasol.dockerdb.image=$EXASOL_VERSION -DtrimStackTrace=false
env:
EXASOL_VERSION: ${{ env.EXASOL_VERSION }}
- name: Build and test registry infrastructure
run: |
cd registry
echo "export const CONFIG = { owner: '[email protected]' }" > lib/config.ts
npm ci
npm run test
- name: Build and test registry upload
run: |
cd registry-upload
npm ci
npm run build
npm run lint
- name: Prepare SonarCloud scan
# Without this step, Sonar will fail with this error:
# "Maven project detected. You should run the goal 'org.sonarsource.scanner.maven:sonar' during build rather than using this GitHub Action."
run: rm ./pom.xml
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Upload executable
uses: actions/upload-artifact@v4
with:
name: extension-manager binary
path: extension-manager
if-no-files-found: error
retention-days: 5
trace-requirements:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-trace-requirements
cancel-in-progress: true
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Cache OpenFastTrace
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: oft-${{ hashFiles('ci/trace-requirements.sh') }}
restore-keys: |
oft-${{ hashFiles('ci/trace-requirements.sh') }}
oft
- name: Run OpenFastTrace
run: ./ci/trace-requirements.sh
static-code-analysis-go:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-static-code-analysis-go
cancel-in-progress: true
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.62.0
args: --timeout=15m
build-python-udf:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-build-python-udf
cancel-in-progress: true
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install Poetry
run: pipx install poetry
- uses: actions/setup-python@v5
with:
python-version: "3.8"
cache: "poetry"
cache-dependency-path: "pkg/extensionController/bfs/udf/poetry.lock"
- name: Install dependencies
run: cd pkg/extensionController/bfs/udf && poetry install
- name: Run tests
run: cd pkg/extensionController/bfs/udf && poetry run pytest --cov=list_files_udf
- name: Run type check
run: cd pkg/extensionController/bfs/udf && poetry run mypy .
- name: Run linter
run: cd pkg/extensionController/bfs/udf && poetry run pylint *.py