Skip to content

Commit

Permalink
[#20] Update GitHub actions to support both extension and runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
Mi-La committed Sep 20, 2024
1 parent e29b1bc commit c8fd7f3
Show file tree
Hide file tree
Showing 4 changed files with 146 additions and 5 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/build_linux_extension.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Linux C++17 extension

on:
push:
branches: [ master, '*-ci' ]
pull_request:
branches: [ master, '*-ci' ]
workflow_dispatch:

jobs:
zserio:
strategy:
fail-fast: false
matrix:
include:
- { os: "ubuntu-20.04", java-version: 8 }
- { os: "ubuntu-20.04", java-version: 11 }
- { os: "ubuntu-22.04", java-version: 17 }

runs-on: ${{matrix.os}}
name: ${{matrix.os}}-java${{matrix.java-version}}

steps:
- name: "Set up environment"
run: |
if [[ "${{matrix.os}}" == "ubuntu-22.04" ]] ; then
echo "CLANG_FORMAT_BIN=clang-format-14" >> ${GITHUB_ENV}
fi
echo "SPOTBUGS_HOME=${RUNNER_WORKSPACE}/spotbugs-4.8.2" >> ${GITHUB_ENV}
- name: Apt update # with workaround for 'Unable to connect to ppa.launchpad.net' failure
run: sudo apt-get update --option Acquire::Retries=100 --option Acquire::http::Timeout="300"

- name: Set up Java ${{matrix.java-version}}
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{matrix.java-version}}

- name: Install clang-format-14 tool
if: ${{ env.CLANG_FORMAT_BIN != '' }}
run: |
sudo apt-get install clang-format-14
- name: Install specific version of Java static code analysis tool (spotbugs)
run: |
wget https://repo.maven.apache.org/maven2/com/github/spotbugs/spotbugs/4.8.2/spotbugs-4.8.2.zip \
-P "${RUNNER_WORKSPACE}"
unzip "${RUNNER_WORKSPACE}"/spotbugs-4.8.2.zip -d "${RUNNER_WORKSPACE}"
- name: "Checkout"
uses: actions/checkout@v4
with:
submodules: recursive

- name: Build Zserio C++17 extension
run: |
scripts/build.sh cpp
- name: Upload Zserio C++17 extension artifact
# update when https://github.com/actions/upload-artifact/issues/543 is fixed
uses: actions/upload-artifact@v3
with:
name: "zserio-cpp17-java${{matrix.java-version}}"
path: distr/zserio_cpp17*.jar
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Linux
name: Linux C++17 runtime

on:
push:
Expand Down Expand Up @@ -99,11 +99,11 @@ jobs:
with:
submodules: recursive

- name: Build Zserio C++ runtime
- name: Build Zserio C++17 runtime
run: |
scripts/build.sh cpp_rt-${PACKAGE}
- name: Upload Zserio C++ runtime artifacts
- name: Upload Zserio C++17 runtime artifacts
# update when https://github.com/actions/upload-artifact/issues/543 is fixed
uses: actions/upload-artifact@v3
# we need to collect this artifact from a build which has both clang coverage and clang-tidy reports
Expand All @@ -113,7 +113,7 @@ jobs:
name: "zserio-runtime-cpp"
path: distr/runtime_lib

- name: Upload Zserio C++ build artifacts
- name: Upload Zserio C++17 build artifacts
# update when https://github.com/actions/upload-artifact/issues/543 is fixed
uses: actions/upload-artifact@v3
with:
Expand Down
76 changes: 76 additions & 0 deletions .github/workflows/build_windows_extension.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Windows C++17 extension

on:
push:
branches: [ master, '*-ci' ]
pull_request:
branches: [ master, '*-ci' ]
workflow_dispatch:

jobs:
zserio:
strategy:
fail-fast: false
matrix:
include:
- { os: "windows-2022", java-version: "8" }
- { os: "windows-2022", java-version: "11" }
- { os: "windows-2022", java-version: "17" }

runs-on: ${{matrix.os}}
name: ${{matrix.os}}-java${{matrix.java-version}}

steps:
- name: "Set up environment"
shell: bash
run: |
echo "CLANG_FORMAT_BIN=clang-format" >> ${GITHUB_ENV}
echo "SPOTBUGS_HOME=${RUNNER_WORKSPACE}/spotbugs-4.8.2" >> ${GITHUB_ENV}
- name: Install dependencies
shell: bash
run: |
choco install wget
choco install zip
- name: Set up Java ${{matrix.java-version}}
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{matrix.java-version}}

- name: Install clang format
shell: bash
run: |
choco install llvm --version=14.0.0 --allow-downgrade
- name: Install specific version of Java static code analysis tool (spotbugs)
shell: bash
run: |
wget -P "${RUNNER_WORKSPACE}" \
https://repo.maven.apache.org/maven2/com/github/spotbugs/spotbugs/4.8.2/spotbugs-4.8.2.zip
unzip "${RUNNER_WORKSPACE}\spotbugs-4.8.2.zip" -d "${RUNNER_WORKSPACE}"
- name: "Convert environment variables to POSIX paths"
shell: bash
run: |
echo "ANT=/${ANT_HOME}/bin/ant" | sed -e 's/\\/\//g' -e 's/://' >> ${GITHUB_ENV}
echo "JAVA_HOME=/${JAVA_HOME}" | sed -e 's/\\/\//g' -e 's/://' >> ${GITHUB_ENV}
echo "SPOTBUGS_HOME=/${SPOTBUGS_HOME}" | sed -e 's/\\/\//g' -e 's/://' >> ${GITHUB_ENV}
- name: "Checkout"
uses: actions/checkout@v4
with:
submodules: recursive

- name: Build Zserio C++17 extension
shell: bash
run: |
scripts/build.sh cpp
- name: Upload C++17 extension artifact
# update when https://github.com/actions/upload-artifact/issues/543 is fixed
uses: actions/upload-artifact@v3
with:
name: "zserio-cpp17-java${{matrix.java-version}}"
path: distr/zserio_cpp17*.jar
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Windows
name: Windows C++17 runtime

on:
push:
Expand Down

0 comments on commit c8fd7f3

Please sign in to comment.