Skip to content

GitHub Actions workflows for CLI #19

GitHub Actions workflows for CLI

GitHub Actions workflows for CLI #19

Workflow file for this run

name: PR build
on:
pull_request:
branches: [main]
env:
REGISTRY: ghcr.io
NAMESPACE: galasa-dev
IMAGE_TAG: main
jobs:
build-cli:
name: Build the Galasa CLI
runs-on: ubuntu-latest
steps:
- name: Checkout CLI
uses: actions/checkout@v4
- name: Checkout Framework
uses: actions/checkout@v4
with:
repository: ${{env.NAMESPACE}}/framework
path: framework
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 6.9.2
# Pull down dependencies with Gradle and put them in the right places.
- name: Gather dependencies using Gradle
run : |
gradle -b build.gradle installJarsIntoTemplates --info \
-PsourceMaven=https://development.galasa.dev/gh/maven-repo/maven \
-PcentralMaven=https://repo.maven.apache.org/maven2/ \
-PtargetMaven=${{ github.workspace }}/repo \
# Generate client code so galasactl can communicate with the API server.
- name: Generate Go client code using openapi.yaml
run : |
docker run --rm -v ${{ github.workspace }}:/var/workspace ghcr.io/galasa-dev/openapi:main java -jar /opt/openapi/openapi-generator-cli.jar generate -i /var/workspace/build/dependencies/openapi.yaml -g go -o /var/workspace/pkg/galasaapi --additional-properties=packageName=galasaapi --global-property=apiTests=false
# The go.mod and go.sum are out of date, as they do not include the generated code so they are deleted here. They get re-generated when we compile.
# Due to permissions, deleting the go.mod and go.sum must be done by the openapi image as the image generated those files.
- name: Clear go.mod
run : |
docker run --rm -v ${{ github.workspace }}:/var/workspace ghcr.io/galasa-dev/openapi:main rm /var/workspace/pkg/galasaapi/go.mod
- name: Clear go.sum
run : |
docker run --rm -v ${{ github.workspace }}:/var/workspace ghcr.io/galasa-dev/openapi:main rm /var/workspace/pkg/galasaapi/go.sum
# The go code needs to know which version of Galasa it is part of, so substitute an eye-catcher with the correct value.
- name: Update version
run : |
version=$(cat VERSION) &&
cat pkg/cmd/root.go | sed "s/unknowncliversion-unknowngithash/${version}/1" > temp.txt &&
mv -f temp.txt pkg/cmd/root.go &&
cat pkg/cmd/root.go
# Invoke the make command to build the go code, run unit tests and gather code coverage stats.
- name: Build Go code with the Makefile
run : |
make all
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'semeru'
cache: maven
- name: Chmod local test script
run: |
chmod +x cli/test-galasactl-local.sh
- name: Run local test script with maven
run : |
./cli/test-galasactl-local.sh --buildTool maven
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 6.9.2
- name: Chmod local test script
run: |
chmod +x cli/test-galasactl-local.sh
- name: Run local test script with maven
run : |
./cli/test-galasactl-local.sh --buildTool gradle
# test-galasactl-ecosystem:
# name: Run the galasactl ecosystem test script
# runs-on: ubuntu-latest
# steps:
# build-cli-docker-images:
# name: Build Docker images with the executable and for the development Maven registry
# runs-on: ubuntu-latest
# steps: