Skip to content

Commit

Permalink
feat(build): Update build files to only build a language if something…
Browse files Browse the repository at this point in the history
… changes
  • Loading branch information
hutcheb committed Jan 1, 2023
1 parent 1f81060 commit 2a508d6
Show file tree
Hide file tree
Showing 4 changed files with 259 additions and 6 deletions.
Expand Up @@ -16,10 +16,15 @@
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
name: "Platform compatibility"
name: "Go Platform compatibility"

on:
push:
branches: [ "develop", "plc4c" ]
paths:
- code-generation/**
- protocols/**
- plc4c**
workflow_dispatch:
inputs:
forceUpdates:
Expand All @@ -32,7 +37,7 @@ jobs:
strategy:
matrix:
# 8 not anymore supported for building
java: [ 11, 17 ]
java: [ 17 ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
fail-fast: false
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -112,8 +117,8 @@ jobs:
# Note: due to github has no concept of recovering from a fail even if we have our fallback below we append a second un-parallel run behind this to be sure that it works with all checks. Only if that fails too we are ok with a "red" (which should be yellow) cross indicating a problem
- name: Run mvnw
run: |
./mvnw${{ steps.platform_suffix.outputs.platform_suffix }} ${{ steps.extra_options.outputs.extra_options }} -T 1C -B -P'with-sandbox,with-c,with-go,enable-all-checks' ${{ steps.platform_opts.outputs.platform_opts }} install || ./mvnw${{ steps.platform_suffix.outputs.platform_suffix }} ${{ steps.extra_options.outputs.extra_options }} -B -P'with-sandbox,with-c,with-go,enable-all-checks' ${{ steps.platform_opts.outputs.platform_opts }} install
./mvnw${{ steps.platform_suffix.outputs.platform_suffix }} ${{ steps.extra_options.outputs.extra_options }} -B -P'with-c,enable-all-checks' -pl :plc4c -am ${{ steps.platform_opts.outputs.platform_opts }} install
- name: Run mvnv unparallel
- name: Run mvnv without BacNet regression tests
if: ${{ failure() }}
run: ./mvnw${{ steps.platform_suffix.outputs.platform_suffix }} ${{ steps.extra_options.outputs.extra_options }} -B -P'with-sandbox,with-c,with-go,skip-bacnet-regression-test' ${{ steps.platform_opts.outputs.platform_opts }} install
run: ./mvnw${{ steps.platform_suffix.outputs.platform_suffix }} ${{ steps.extra_options.outputs.extra_options }} -B -P'with-c,skip-bacnet-regression-test' -pl :plc4c -am ${{ steps.platform_opts.outputs.platform_opts }} install
124 changes: 124 additions & 0 deletions .github/workflows/go-platform.yml
@@ -0,0 +1,124 @@
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
name: "Go Platform compatibility"

on:
push:
branches: [ "develop", "plc4go" ]
paths:
- code-generation/**
- protocols/**
- plc4go**
workflow_dispatch:
inputs:
forceUpdates:
description: "Forces a snapshot update"
required: false
default: 'false'

jobs:
test:
strategy:
matrix:
# 8 not anymore supported for building
java: [ 17 ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Install libpcap for Linux
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install libpcap-dev

- name: Install libpcap for macos
if: matrix.os == 'macos-latest'
run: brew install libpcap

- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-package: jdk
java-version: ${{ matrix.java }}

- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set Platform options
id: platform_opts
uses: actions/github-script@v6.3.3
env:
OS: ${{ matrix.os }}
with:
script: |
const { OS } = process.env
if (OS.includes("windows")) {
core.setOutput('platform_opts', ``)
} else if (OS.includes("macos")) {
core.setOutput('platform_opts', `-Djna.library.path="$(find /usr/local/Cellar/libpcap/ -name lib)"`)
} else if (OS.includes("ubuntu")) {
core.setOutput('platform_opts', ``)
} else {
core.setOutput('platform_opts', ``)
}
- name: Calculate platform suffix
id: platform_suffix
uses: actions/github-script@v6.3.3
env:
OS: ${{ matrix.os }}
with:
script: |
const { OS } = process.env
if (OS.includes("windows")) {
core.setOutput('platform_suffix', `.cmd`)
} else {
core.setOutput('platform_suffix', ``)
}
- name: Set extra options
id: extra_options
uses: actions/github-script@v6.3.3
env:
FORCE_UPDATE: ${{ github.event.inputs.forceUpdates }}
with:
script: |
const { FORCE_UPDATE } = process.env
if (FORCE_UPDATE.includes("true")) {
core.setOutput('extra_options', `-U`)
} else {
core.setOutput('extra_options', ``)
}
# Note: due to github has no concept of recovering from a fail even if we have our fallback below we append a second un-parallel run behind this to be sure that it works with all checks. Only if that fails too we are ok with a "red" (which should be yellow) cross indicating a problem
- name: Run mvnw
run: |
./mvnw${{ steps.platform_suffix.outputs.platform_suffix }} ${{ steps.extra_options.outputs.extra_options }} -B -P'with-go,enable-all-checks' -pl :plc4go -am ${{ steps.platform_opts.outputs.platform_opts }} install
- name: Run mvnv without BacNet regression tests
if: ${{ failure() }}
run: ./mvnw${{ steps.platform_suffix.outputs.platform_suffix }} ${{ steps.extra_options.outputs.extra_options }} -B -P'with-go,skip-bacnet-regression-test' -pl :plc4go -am ${{ steps.platform_opts.outputs.platform_opts }} install
124 changes: 124 additions & 0 deletions .github/workflows/java-platform.yml
@@ -0,0 +1,124 @@
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
name: "Go Platform compatibility"

on:
push:
branches: [ "develop", "plc4j" ]
paths:
- code-generation/**
- protocols/**
- plc4j**
workflow_dispatch:
inputs:
forceUpdates:
description: "Forces a snapshot update"
required: false
default: 'false'

jobs:
test:
strategy:
matrix:
# 8 not anymore supported for building
java: [ 11, 17 ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Install libpcap for Linux
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install libpcap-dev

- name: Install libpcap for macos
if: matrix.os == 'macos-latest'
run: brew install libpcap

- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-package: jdk
java-version: ${{ matrix.java }}

- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set Platform options
id: platform_opts
uses: actions/github-script@v6.3.3
env:
OS: ${{ matrix.os }}
with:
script: |
const { OS } = process.env
if (OS.includes("windows")) {
core.setOutput('platform_opts', ``)
} else if (OS.includes("macos")) {
core.setOutput('platform_opts', `-Djna.library.path="$(find /usr/local/Cellar/libpcap/ -name lib)"`)
} else if (OS.includes("ubuntu")) {
core.setOutput('platform_opts', ``)
} else {
core.setOutput('platform_opts', ``)
}
- name: Calculate platform suffix
id: platform_suffix
uses: actions/github-script@v6.3.3
env:
OS: ${{ matrix.os }}
with:
script: |
const { OS } = process.env
if (OS.includes("windows")) {
core.setOutput('platform_suffix', `.cmd`)
} else {
core.setOutput('platform_suffix', ``)
}
- name: Set extra options
id: extra_options
uses: actions/github-script@v6.3.3
env:
FORCE_UPDATE: ${{ github.event.inputs.forceUpdates }}
with:
script: |
const { FORCE_UPDATE } = process.env
if (FORCE_UPDATE.includes("true")) {
core.setOutput('extra_options', `-U`)
} else {
core.setOutput('extra_options', ``)
}
# Note: due to github has no concept of recovering from a fail even if we have our fallback below we append a second un-parallel run behind this to be sure that it works with all checks. Only if that fails too we are ok with a "red" (which should be yellow) cross indicating a problem
- name: Run mvnw
run: |
./mvnw${{ steps.platform_suffix.outputs.platform_suffix }} ${{ steps.extra_options.outputs.extra_options }} -B -P'enable-all-checks' ${{ steps.platform_opts.outputs.platform_opts }} install
- name: Run mvnv without BacNet regression tests
if: ${{ failure() }}
run: ./mvnw${{ steps.platform_suffix.outputs.platform_suffix }} ${{ steps.extra_options.outputs.extra_options }} -B -P'skip-bacnet-regression-test' ${{ steps.platform_opts.outputs.platform_opts }} install
2 changes: 1 addition & 1 deletion .github/workflows/python-build.yml
Expand Up @@ -133,6 +133,6 @@ jobs:
- name: Run mvnw
run: |
./mvnw${{ steps.platform_suffix.outputs.platform_suffix }} ${{ steps.extra_options.outputs.extra_options }} -T 1C -B -P'with-sandbox,with-python' -pl :plc4py -am ${{ steps.platform_opts.outputs.platform_opts }} install || ./mvnw${{ steps.platform_suffix.outputs.platform_suffix }} ${{ steps.extra_options.outputs.extra_options }} -B -P'with-sandbox,with-python' -pl :plc4py -am ${{ steps.platform_opts.outputs.platform_opts }} install
./mvnw${{ steps.platform_suffix.outputs.platform_suffix }} ${{ steps.extra_options.outputs.extra_options }} -B -P'with-sandbox,with-python,enable-all-checks' -pl :plc4py -am ${{ steps.platform_opts.outputs.platform_opts }} install

0 comments on commit 2a508d6

Please sign in to comment.