Script updates #1757
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build_linux: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: imresamu/postgis:17-3.5 | |
| env: | |
| # must specify password for PG Docker container image, see: https://registry.hub.docker.com/_/postgres?tab=description&page=1&name=10 | |
| POSTGRES_USER: noisemodelling | |
| POSTGRES_PASSWORD: noisemodelling | |
| POSTGRES_DB: noisemodelling_db | |
| ports: | |
| - 5432:5432 | |
| # needed because the postgres container does not provide a healthcheck | |
| options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
| steps: | |
| - name: Cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| $HOME/.m2/ | |
| key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} | |
| # Checkout the source code of the project | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # Setup the jdk using version 11 of Adoptium Temurin | |
| - name: Setup java 25 using Adoptium Temurin | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '25' | |
| server-id: central | |
| server-username: MAVEN_USERNAME | |
| server-password: MAVEN_PASSWORD | |
| gpg-private-key: ${{ secrets.GPG_SECRET_KEY }} | |
| gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
| - name: Building | |
| run: mvn test install javadoc:jar package -B | |
| env: | |
| POSTGRES_HOST: localhost | |
| POSTGRES_PORT: 5432 | |
| POSTGRES_DB: noisemodelling_db | |
| POSTGRES_USER: noisemodelling | |
| POSTGRES_PASSWORD: noisemodelling | |
| - name: Unzip production artifacts | |
| run: | | |
| # 1. Unzip into a temporary directory | |
| unzip -q noisemodelling-scripts/target/*.zip -d tmp_extract | |
| # 2. Create target directory | |
| mkdir NoiseModelling | |
| # 3. Move contents from the subfolder to the target | |
| # The asterisk-slash-asterisk moves everything inside the first subfolder | |
| mv tmp_extract/*/* NoiseModelling/ | |
| # 4. Cleanup | |
| rm -rf tmp_extract | |
| - name: Integration test, use ScriptRunner with H2GIS | |
| run: | | |
| bin/ScriptRunner -w /tmp/h2gis_ws -s get_started_tutorial_complex.groovy | |
| working-directory: NoiseModelling | |
| - name: Integration test, use ScriptRunner with PostGIS | |
| run: | | |
| bin/ScriptRunner -w /tmp/postgis_ws -s get_started_tutorial_complex.groovy --host localhost --user noisemodelling --password noisemodelling --port 5432 --database noisemodelling_db | |
| working-directory: NoiseModelling | |
| - name: Maven Deploy snapshot | |
| env: | |
| MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
| MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} | |
| MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| if: ${{ (env.MAVEN_USERNAME != null) && (github.ref == 'refs/heads/main') }} | |
| run: mvn clean -DskipTests deploy -B | |
| - name: Generate Sanitized Artifact Name | |
| id: sanitize | |
| run: | | |
| # Determine the raw value (Ref name if not default branch, otherwise SHA) | |
| if [ "${{ github.ref_name }}" != "${{ github.event.repository.default_branch }}" ]; then | |
| RAW_VAL="${{ github.ref_name }}" | |
| else | |
| RAW_VAL="${{ github.sha }}" | |
| fi | |
| # Use sed to perform replacements: | |
| # 1. / and \ become _ | |
| # 2. : is removed | |
| # 3. * becomes x | |
| CLEAN_VAL=$(echo "$RAW_VAL" | sed 's/[\/\\]/_/g; s/://g; s/\*/x/g') | |
| # Set it as an environment variable for the next step | |
| echo "ARTIFACT_NAME=NoiseModelling-$CLEAN_VAL" >> $GITHUB_ENV | |
| - name: Upload distribution file | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.ARTIFACT_NAME }} | |
| path: NoiseModelling/ | |
| build_windows: | |
| uses: ./.github/workflows/build_windows.yml | |
| with: | |
| git_ref: ${{ github.ref }} | |