diff --git a/.github/workflows/build_and_test_host_gcc12.yml b/.github/workflows/check.yml similarity index 59% rename from .github/workflows/build_and_test_host_gcc12.yml rename to .github/workflows/check.yml index 29c0a119..95ded0a9 100644 --- a/.github/workflows/build_and_test_host_gcc12.yml +++ b/.github/workflows/check.yml @@ -20,19 +20,10 @@ on: types: [opened, reopened, synchronize] merge_group: types: [checks_requested] + workflow_dispatch: + jobs: - build_and_test_gcc_host_gcc12: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4.2.2 - - name: Setup Bazel - uses: bazel-contrib/setup-bazel@0.9.1 - - name: Bazel build baselibs targets - run: | - bazel build --config bl-x86_64-linux -- //score/... - - name: Bazel test baselibs targets - run: | - bazel test --config bl-x86_64-linux -- //score/... \ - -//score/language/safecpp/aborts_upon_exception:abortsuponexception_toolchain_test \ - -//score/containers:dynamic_array_test + call_jobs: + uses: ./.github/workflows/jobs.yml + with: + build_type: check diff --git a/.github/workflows/release_verification.yml b/.github/workflows/jobs.yml similarity index 64% rename from .github/workflows/release_verification.yml rename to .github/workflows/jobs.yml index a25c30c0..17283b07 100644 --- a/.github/workflows/release_verification.yml +++ b/.github/workflows/jobs.yml @@ -11,44 +11,47 @@ # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* -# Workflow configuration for S-CORE CI - Release Check -# This workflow runs Bazel build and test when triggered by tag creation. +# Workflow configuration for S-CORE CI - Build & Test jobs +# This is common jobs workflow called by other workflows. -name: Bazel Build & Test baselibs (with host toolchain GCC12.2) on: - push: - tags: - - 'v*' # Triggers on version tags like v1.0.0 - - 'release-*' # Triggers on release tags like release-1.0.0 - -permissions: - contents: write + workflow_call: + inputs: + build_type: + required: true + type: string jobs: build_host: runs-on: ubuntu-latest steps: - - name: Checkout repository + - name: "Checkout repository (workflow: ${{ inputs.build_type }})" uses: actions/checkout@v4.2.2 - - name: Setup Bazel + - name: "Setup Bazel (workflow: ${{ inputs.build_type }})" uses: bazel-contrib/setup-bazel@0.9.1 - - name: Bazel build baselibs targets + - name: "Bazel build baselibs targets (workflow: ${{ inputs.build_type }})" run: | bazel build --config bl-x86_64-linux -- //score/... build_target: runs-on: ubuntu-latest steps: - - name: Checkout repository + - name: "Check if forked repo (workflow: ${{ inputs.build_type }})" + run: | + if [ "${{ github.event.repository.fork }}" = "true" ]; then + echo "❌ Forked repositories are not allowed to run target workflow." + exit 1 + fi + - name: "Checkout repository (workflow: ${{ inputs.build_type }})" uses: actions/checkout@v4.2.2 - - name: Setup Bazel + - name: "Setup Bazel (workflow: ${{ inputs.build_type }})" uses: bazel-contrib/setup-bazel@0.9.1 - - name: Setup QNX License + - name: "Setup QNX License (workflow: ${{ inputs.build_type }})" env: SCORE_QNX_LICENSE: ${{ secrets.SCORE_QNX_LICENSE }} run: | mkdir -p /opt/score_qnx/license echo "${SCORE_QNX_LICENSE}" | base64 --decode > /opt/score_qnx/license/licenses - - name: Bazel build baselibs targets + - name: "Bazel build baselibs targets (workflow: ${{ inputs.build_type }})" # Currently, only a subset of targets are building with QNX toolchain # due to various issues such as https://github.com/eclipse-score/baselibs/issues/28 env: @@ -57,7 +60,6 @@ jobs: run: | bazel build --config bl-x86_64-qnx --credential_helper=*.qnx.com=${{ github.workspace }}/.github/tools/qnx_credential_helper.py -- \ //score/bitmanipulation/... \ - //score/datetime_converter/... \ //score/json/... \ //score/mw/... \ //score/filesystem/... \ @@ -70,22 +72,12 @@ jobs: test_host: runs-on: ubuntu-latest steps: - - name: Checkout repository + - name: "Checkout repository (workflow: ${{ inputs.build_type }})" uses: actions/checkout@v4.2.2 - - name: Setup Bazel + - name: "Setup Bazel (workflow: ${{ inputs.build_type }})" uses: bazel-contrib/setup-bazel@0.9.1 - - name: Bazel test baselibs targets + - name: "Bazel test baselibs targets (workflow: ${{ inputs.build_type }})" run: | bazel test --config bl-x86_64-linux //score/... -- \ -//score/language/safecpp/aborts_upon_exception:abortsuponexception_toolchain_test \ - -//score/containers:dynamic_array_test - release_verification: - runs-on: ubuntu-latest - needs: [build_host, build_target, test_host] - if: always() && (needs.build_host.result == 'failure' || needs.build_target.result == 'failure' || needs.test_host.result == 'failure') - steps: - - name: Remove release and tag (if exists) - uses: nikhilbadyal/ghaction-rm-releases@v0.7.0 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - RELEASE_PATTERN: ${{ github.ref_name }} + -//score/containers:dynamic_array_test \ No newline at end of file diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 00000000..456704d4 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,27 @@ +# ******************************************************************************* +# Copyright (c) 2025 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* + +# Workflow configuration for S-CORE CI - Nightly Build & Test baselibs +# This workflow runs Bazel build and test every 24 hours at 01:00h. + +name: Nightly Build & Test (baselibs components) +on: + schedule: + - cron: '0 1 * * *' # Runs at 01:00h every day + workflow_dispatch: + +jobs: + call_jobs: + uses: ./.github/workflows/jobs.yml + with: + build_type: nightly \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..f6184415 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,52 @@ +# ******************************************************************************* +# Copyright (c) 2025 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* + +# Workflow configuration for S-CORE CI - Release Build & Test baselibs +# This workflow runs Bazel build and when triggered by tag creation. + +name: Release verification (baselibs components) +on: + push: + tags: + - 'v*' # Triggers on version tags like v1.0.0 + - 'release-*' # Triggers on release tags like release-1.0.0 + workflow_dispatch: + +permissions: + contents: write + +jobs: + call_jobs: + uses: ./.github/workflows/jobs.yml + with: + build_type: release_verification + release_verification: + runs-on: ubuntu-latest + needs: call_jobs + if: ${{ always() }} + steps: + - name: Check common workflow result + id: check + run: | + echo "Common workflow result: ${{ needs.common.result }}" + if [ "${{ needs.common.result }}" != "success" ]; then + echo "failed=true" >> $GITHUB_OUTPUT + else + echo "failed=false" >> $GITHUB_OUTPUT + fi + - name: Delete release & tag on failure + if: ${{ steps.check.outputs.failed == 'true' }} + uses: nikhilbadyal/ghaction-rm-releases@v0.7.0 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + RELEASE_PATTERN: ${{ github.ref_name }} \ No newline at end of file