From fc7d00c3d1eedc71e5bd0bd7ccfb5945c6c7c2bb Mon Sep 17 00:00:00 2001 From: "Drosdzoll, Thomas (DI FA CTR EE PO2)" Date: Mon, 28 Apr 2025 13:50:58 +0200 Subject: [PATCH 1/3] incorporate new actions and workflows --- .github/workflows/build-library.yml | 10 --- .github/workflows/lint-repo.yml | 4 - .../package-development-workflow.yml | 84 +++++++++++++++++ .../workflows/package-release-workflow.yml | 90 +++++++++++++++++++ .github/workflows/release-library.yml | 16 ---- .markdownlint.yml | 11 --- CODEOWNERS | 3 +- repolinter.json | 21 ----- 8 files changed, 175 insertions(+), 64 deletions(-) delete mode 100644 .github/workflows/build-library.yml delete mode 100644 .github/workflows/lint-repo.yml create mode 100644 .github/workflows/package-development-workflow.yml create mode 100644 .github/workflows/package-release-workflow.yml delete mode 100644 .github/workflows/release-library.yml delete mode 100644 .markdownlint.yml delete mode 100644 repolinter.json diff --git a/.github/workflows/build-library.yml b/.github/workflows/build-library.yml deleted file mode 100644 index e2c2e29..0000000 --- a/.github/workflows/build-library.yml +++ /dev/null @@ -1,10 +0,0 @@ -on: push - -jobs: - test-apax-lib: - uses: simatic-ax/actions/.github/workflows/apax-build-test.yml@stable - secrets: - APAX_TOKEN: ${{ secrets.APAX_TOKEN }} - SIMATIC_AX_TOKEN: ${{ secrets.DEPLOY_KEY }} - with: - LOGIN_SIMATIC_AX: true diff --git a/.github/workflows/lint-repo.yml b/.github/workflows/lint-repo.yml deleted file mode 100644 index 9863aa7..0000000 --- a/.github/workflows/lint-repo.yml +++ /dev/null @@ -1,4 +0,0 @@ -on: push -jobs: - lint-repo-and-markdown: - uses: simatic-ax/actions/.github/workflows/check-repository.yml@stable diff --git a/.github/workflows/package-development-workflow.yml b/.github/workflows/package-development-workflow.yml new file mode 100644 index 0000000..51047b2 --- /dev/null +++ b/.github/workflows/package-development-workflow.yml @@ -0,0 +1,84 @@ +# This workflow is going to be used during the development phase of the project +# The workflow builds and tests the the sources on the following triggers: +# - once a change is pushed to the main branch or any of its sub-branches +name: Library development workflow + +on: + push: + branches: + - 'main' # runs the workflow, once new changes have been integrated to main + - 'main/**' # runs the workflow, once new changes have been integrated to a sub-branch of main + pull_request: + branches: + - 'main' # run workflow in the scope of pull requests towards main + workflow_call: + secrets: + APAX_TOKEN: + required: true + inputs: + ref: + required: true + type: string + +permissions: + contents: read # required for checkout + packages: read # required for pulling the container + actions: write # required for artifact uploading + +jobs: + build-and-test: + name: Build and Test + runs-on: ubuntu-24.04 + container: + image: ghcr.io/simatic-ax/ci-images/apax-ci-image:3.4.2 + credentials: + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + # either check out a provided reference, or use the reference that triggered this workflow, e.g. a push, PR or a release + ref: ${{ inputs.ref != '' && inputs.ref || github.ref }} + + - name: Login to required registries + uses: simatic-ax/actions/apax-login@v3 + with: + apax-token: ${{ secrets.APAX_TOKEN }} + registries: | + https://npm.pkg.github.com/,${{ secrets.GITHUB_TOKEN }} + + - name: Install dependencies + uses: simatic-ax/actions/apax-install@v3 + + - name: Build source code + uses: simatic-ax/actions/apax-build@v3 + with: + apax-build-targets: | + llvm + 1500 + apax-build-args: | + --debug + --log Debug + + - name: Test source code + uses: simatic-ax/actions/apax-test@v3 + with: + coverage: true + loglevel: debug + + - name: Check links + uses: gaurav-nelson/github-action-markdown-link-check@v1 + with: + ignoreFiles: '["./actions-test/**"]' + check-modified-files-only: 'yes' + base-branch: 'main' + + - name: Upload build artifacts + if: ${{ github.event_name == 'workflow_call' || github.event_name == 'release'}} + uses: actions/upload-artifact@v4 + with: + name: build-artifacts + path: bin + retention-days: 90 + if-no-files-found: error \ No newline at end of file diff --git a/.github/workflows/package-release-workflow.yml b/.github/workflows/package-release-workflow.yml new file mode 100644 index 0000000..540b6be --- /dev/null +++ b/.github/workflows/package-release-workflow.yml @@ -0,0 +1,90 @@ +# This workflow is triggered when a release is published via the UI +# The workflow is only executed if the release is a tag and the target_commitish is a release branch +name: Release workflow + +# Start the workflow as soon as a release has been published via the UI +on: + release: + types: [published] + +permissions: + contents: write # required for checkout + packages: write # required for pulling the container + actions: write # required for artifact downloading + pull-requests: write # Für PR-Erstellung und Management + +jobs: + call-development: + name: Build the package + uses: ./.github/workflows/package-development-workflow.yml + secrets: + APAX_TOKEN: ${{ secrets.APAX_TOKEN }} + with: + # checks out the branch that has been selected during the release process + ref: ${{ github.event.release.target_commitish }} + + release: + name: Release the package + needs: call-development + runs-on: ubuntu-24.04 + container: + image: ghcr.io/simatic-ax/ci-images/apax-ci-image:3.4.2 + credentials: + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + ref: ${{ github.event.release.target_commitish }} + fetch-depth: 0 + + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + name: build-artifacts + path: bin + + - name: Version package + uses: simatic-ax/actions/apax-version@v3 + with: + version: ${{ github.event.release.tag_name }} + + - name: Package source code + uses: simatic-ax/actions/apax-pack@v3 + with: + key: ${{ secrets.APAX_SIGNKEY }} + + - name: Login to required registries + uses: simatic-ax/actions/apax-login@v3 + with: + apax-token: ${{ secrets.APAX_TOKEN }} + registries: | + https://npm.pkg.github.com/,${{ secrets.GITHUB_TOKEN }} + + - name: Publish apax package + uses: simatic-ax/actions/apax-publish@v3 + with: + registries: | + https://npm.pkg.github.com + + - name: Update major version tag + if: ${{ success() }} + run: | + git config --global --add safe.directory "$GITHUB_WORKSPACE" + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + + VERSION=${{ github.event.release.tag_name }} + if echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then + MAJOR_VERSION="v$(echo $VERSION | cut -d. -f1)" + echo "Updating major version tag: $MAJOR_VERSION" + git push origin :refs/tags/$MAJOR_VERSION || true + git tag -f $MAJOR_VERSION + git push origin $MAJOR_VERSION --force + echo "✅ Major version tag updated successfully" + else + echo "❌ Error: Invalid version format: '$VERSION'" + echo "Expected format: X.Y.Z (e.g., 1.2.3)" + exit 1 + fi \ No newline at end of file diff --git a/.github/workflows/release-library.yml b/.github/workflows/release-library.yml deleted file mode 100644 index af6befe..0000000 --- a/.github/workflows/release-library.yml +++ /dev/null @@ -1,16 +0,0 @@ -on: - push: - # Pattern matched against refs/tags - tags: - - '*' - -jobs: - release-apax-lib: - uses: simatic-ax/actions/.github/workflows/apax-publish.yml@stable - secrets: - APAX_TOKEN: ${{ secrets.APAX_TOKEN }} - DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} - APAX_SIGNKEY: ${{ secrets.APAX_SIGNKEY }} - - with: - VERSION: ${{ github.ref_name }} diff --git a/.markdownlint.yml b/.markdownlint.yml deleted file mode 100644 index 95479c5..0000000 --- a/.markdownlint.yml +++ /dev/null @@ -1,11 +0,0 @@ -# markdownlint YAML configuration ---- - -# Default state for all rules -default: true - -# ignored rules -line-length: false -no-inline-html: false -first-line-h1: false -no-emphasis-as-header: false \ No newline at end of file diff --git a/CODEOWNERS b/CODEOWNERS index 42c4730..420b82b 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1,5 +1,4 @@ # These owners will be the default owners for everything in the repo. # Unless a later match takes precedence, the listed user will be # requested for review when someone opens a pull request. -# * @global-user1 @global-user2 @global-user1 -@sjuergen \ No newline at end of file +* @sjuergen @ReinerSchinkoethe @theBadT @BeckerStS \ No newline at end of file diff --git a/repolinter.json b/repolinter.json deleted file mode 100644 index f662361..0000000 --- a/repolinter.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/todogroup/repolinter/master/rulesets/schema.json", - "version": 2, - "axioms": { - "linguist": "language", - "licensee": "license", - "packagers": "packager" - }, - "rules": { - "license-file-exists": { - "level": "off", - "rule": { - "type": "file-existence", - "options": { - "globsAny": ["LICENSE*", "COPYING*"], - "nocase": true - } - } - } - } -} \ No newline at end of file From eda23fda48f190ea88ecea63564076df28fe35ba Mon Sep 17 00:00:00 2001 From: "Drosdzoll, Thomas (DI FA CTR EE PO2)" Date: Mon, 28 Apr 2025 13:59:50 +0200 Subject: [PATCH 2/3] fix artifact handling --- .github/workflows/package-development-workflow.yml | 4 +++- .github/workflows/package-release-workflow.yml | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/package-development-workflow.yml b/.github/workflows/package-development-workflow.yml index 51047b2..6e2518d 100644 --- a/.github/workflows/package-development-workflow.yml +++ b/.github/workflows/package-development-workflow.yml @@ -79,6 +79,8 @@ jobs: uses: actions/upload-artifact@v4 with: name: build-artifacts - path: bin + path: | + bin/1500 + bin/llvm retention-days: 90 if-no-files-found: error \ No newline at end of file diff --git a/.github/workflows/package-release-workflow.yml b/.github/workflows/package-release-workflow.yml index 540b6be..418df77 100644 --- a/.github/workflows/package-release-workflow.yml +++ b/.github/workflows/package-release-workflow.yml @@ -39,6 +39,9 @@ jobs: ref: ${{ github.event.release.target_commitish }} fetch-depth: 0 + - name: Create bin folder + run: mkdir -p bin + - name: Download build artifacts uses: actions/download-artifact@v4 with: From c052836c2379faa73c7ab34d657581c4578616d2 Mon Sep 17 00:00:00 2001 From: "Drosdzoll, Thomas (DI FA CTR EE PO2)" Date: Mon, 28 Apr 2025 18:50:27 +0200 Subject: [PATCH 3/3] add immutable flag, remove release post-processing --- .../package-development-workflow.yml | 2 ++ .../workflows/package-release-workflow.yml | 23 +------------------ 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/.github/workflows/package-development-workflow.yml b/.github/workflows/package-development-workflow.yml index 6e2518d..9de985d 100644 --- a/.github/workflows/package-development-workflow.yml +++ b/.github/workflows/package-development-workflow.yml @@ -50,6 +50,8 @@ jobs: - name: Install dependencies uses: simatic-ax/actions/apax-install@v3 + with: + immutable: true - name: Build source code uses: simatic-ax/actions/apax-build@v3 diff --git a/.github/workflows/package-release-workflow.yml b/.github/workflows/package-release-workflow.yml index 418df77..44ce9c2 100644 --- a/.github/workflows/package-release-workflow.yml +++ b/.github/workflows/package-release-workflow.yml @@ -69,25 +69,4 @@ jobs: uses: simatic-ax/actions/apax-publish@v3 with: registries: | - https://npm.pkg.github.com - - - name: Update major version tag - if: ${{ success() }} - run: | - git config --global --add safe.directory "$GITHUB_WORKSPACE" - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - - VERSION=${{ github.event.release.tag_name }} - if echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then - MAJOR_VERSION="v$(echo $VERSION | cut -d. -f1)" - echo "Updating major version tag: $MAJOR_VERSION" - git push origin :refs/tags/$MAJOR_VERSION || true - git tag -f $MAJOR_VERSION - git push origin $MAJOR_VERSION --force - echo "✅ Major version tag updated successfully" - else - echo "❌ Error: Invalid version format: '$VERSION'" - echo "Expected format: X.Y.Z (e.g., 1.2.3)" - exit 1 - fi \ No newline at end of file + https://npm.pkg.github.com \ No newline at end of file