Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/actions/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# GitHub Reusable Actions for openDAQ Framework

This directory contains **reusable GitHub Actions** used to work with the **openDAQ framework**.
The actions support determining the latest or specific release, downloading it from S3, and installing it on Linux or Windows runners.

---

## Actions Overview

| Action | Description | Inputs | Outputs |
|--------|-------------|--------|---------|
| [framework-latest-release](./framework-latest-release/README.md) | Determines which openDAQ framework package to use (latest release or specific version). | `opendaq-framework-release-version`, `win32-force` | `version`, `platform`, `packaging`, `artefact`, `uri`, `scheme`, `authority`, `path` |
| [framework-download](./framework-download/README.md) | Downloads the resolved openDAQ framework package from AWS S3. | `src-opendaq-framework-dev`, `dst-opendaq-framework-dev`, `aws_access_key_id`, `aws_secret_access_key`, `aws_region` | None |
| [framework-install](./framework-install/README.md) | Installs the downloaded openDAQ framework package on the runner. | `opendaq-framework-package-filename`, `opendaq-framework-package-path` | None |

---

## Recommended Usage

A typical workflow combining all three actions:

```yaml
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Resolve openDAQ framework version
id: framework
uses: ./.github/actions/framework-latest-release
with:
opendaq-framework-release-version: latest

- name: Download openDAQ framework
uses: ./.github/actions/framework-download
with:
src-opendaq-framework-dev: ${{ steps.framework.outputs.uri }}
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: ${{ secrets.AWS_REGION }}

- name: Install openDAQ framework
uses: ./.github/actions/framework-install
with:
opendaq-framework-package-filename: ${{ steps.framework.outputs.artefact }}
```

## Notes

- Linux and Windows runners are supported.
- framework-latest-release requires GitHub CLI (gh) and jq.
- framework-download requires AWS CLI.
- framework-install installs differently depending on OS.
45 changes: 45 additions & 0 deletions .github/actions/framework-download/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# framework-download

This composite action downloads an **openDAQ framework package** from **AWS S3** to the runner.
It supports both Linux/macOS and Windows runners.

---

## Inputs

| Name | Required | Default | Description |
|-----------------------------|----------|---------------------|-------------|
| `src-opendaq-framework-dev` | yes | — | Full S3 URI to the package (e.g. `s3://bucket/releases/v3.20.4/SDK/opendaq-3.20.4-win64.exe`). |
| `dst-opendaq-framework-dev` | no | `${{ runner.temp }}`| Destination path for the downloaded package on the runner. |
| `aws_access_key_id` | yes | — | AWS Access Key ID used for authentication. |
| `aws_secret_access_key` | yes | — | AWS Secret Access Key used for authentication. |
| `aws_region` | yes | — | AWS Region where the bucket is located. |

---

## Example usage

```yaml
jobs:
download:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download openDAQ framework
uses: ./.github/actions/framework-download
with:
src-opendaq-framework-dev: "s3://bb-blueberry-sdk-releases/releases/v3.20.4/SDK/opendaq-3.20.4-ubuntu22.04-x86_64.deb"
dst-opendaq-framework-dev: "/tmp/opendaq-3.20.4-ubuntu22.04-x86_64.deb"
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: ${{ secrets.AWS_REGION }}
```

## Notes
- Uses aws-actions/configure-aws-credentials to set up credentials.
- Downloads via aws s3 cp, which must be available in the runner environment.
- On GitHub-hosted runners, the AWS CLI is pre-installed.
- Supports Linux/macOS (bash) and Windows (pwsh) runners.
- Destination path must be writable by the runner.
50 changes: 50 additions & 0 deletions .github/actions/framework-download/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Download openDAQ framework package
description: "Download a package from S3 for Linux or Windows"

inputs:
src-opendaq-framework-dev:
required: true
description: "S3 path to the package"
dst-opendaq-framework-dev:
required: false
default: ${{ runner.temp }}
description: "Destination path for downloaded package"

aws_access_key_id:
required: true
description: "AWS Access Key ID"
aws_secret_access_key:
required: true
description: "AWS Secret Access Key"
aws_region:
required: true
description: "AWS Region"

runs:
using: composite
steps:
- name: Configure AWS
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ inputs.aws_access_key_id }}
aws-secret-access-key: ${{ inputs.aws_secret_access_key }}
aws-region: ${{ inputs.aws_region }}

- name: Download package from S3 (Linux/macOS)
if: runner.os != 'Windows'
shell: bash
run: |
set -e
DST="${{ inputs.dst-opendaq-framework-dev }}"
SRC="${{ inputs.src-opendaq-framework-dev }}"
echo "Downloading $SRC to $DST"
aws s3 cp "$SRC" "$DST"

- name: Download package from S3 (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$dst = "${{ inputs.dst-opendaq-framework-dev }}"
$src = "${{ inputs.src-opendaq-framework-dev }}"
Write-Host "Downloading $src to $dst"
aws s3 cp "$src" "$dst"
60 changes: 60 additions & 0 deletions .github/actions/framework-install/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# framework-install

This composite action installs an **openDAQ framework package** on the runner.
It supports **Windows (installer executable)** and **Linux (Debian package)**.
Other operating systems are not supported.

---

## Inputs

| Name | Required | Default | Description |
|-----------------------------------|----------|---------------------|-------------|
| `opendaq-framework-package-filename` | yes | — | Name of the package file (e.g. `opendaq-3.20.4-win64.exe`, `opendaq-3.20.4-ubuntu22.04-x86_64.deb`). |
| `opendaq-framework-package-path` | no | `${{ runner.temp }}`| Directory where the package file is located. |

---

## Example usage

```yaml
jobs:
install:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install openDAQ framework
uses: ./.github/actions/framework-install
with:
opendaq-framework-package-filename: "opendaq-3.20.4-win64.exe"
opendaq-framework-package-path: "C:\\actions\\temp"
```
```yml
jobs:
install:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install openDAQ framework
uses: ./.github/actions/framework-install
with:
opendaq-framework-package-filename: "opendaq-3.20.4-ubuntu22.04-x86_64.deb"
opendaq-framework-package-path: "/tmp"
```

## Notes
- Windows:
- Runs the installer in silent mode (/S).
- After installation, updates the PATH environment variable to include:
```powershell
PATH=C:\Program Files\openDAQ\bin;$PATH
```
- Linux:
- Installs the package via dpkg -i.
- Requires sudo access on the runner.
- Unsupported OS:
- The action exits with an error for macOS or other platforms.
42 changes: 42 additions & 0 deletions .github/actions/framework-install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Install openDAQ framework package

inputs:
opendaq-framework-package-filename:
required: true

opendaq-framework-package-path:
required: false
default: ${{ runner.temp }}

runs:
using: composite

steps:
- name: Install openDAQ framework package (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$packagePath = Join-Path "${{ inputs.opendaq-framework-package-path }}" "${{ inputs.opendaq-framework-package-filename }}"
$process = Start-Process -FilePath $packagePath -ArgumentList "/S" -Wait -NoNewWindow -PassThru
if ($process.ExitCode -eq 0) {
Write-Host "OpenDAQ installed successfully, updating PATH..."
$openDAQBin = "C:\Program Files\openDAQ\bin"
Add-Content -Path $env:GITHUB_ENV -Value "PATH=$openDAQBin`;$env:PATH"
Write-Host $env:PATH
}
else {
Write-Host "OpenDAQ installation failed with exit code $($process.ExitCode)"
exit $process.ExitCode
}

- name: Install openDAQ framework package (Linux)
if: runner.os == 'Linux'
shell: bash
run: sudo dpkg -i "${{ inputs.opendaq-framework-package-path }}/${{ inputs.opendaq-framework-package-filename }}"

- name: Unsupported runner OS
if: runner.os != 'Windows' && runner.os != 'Linux'
shell: bash
run: |
echo "Install openDAQ is not supported for ${{ runner.os }}"
exit 1
61 changes: 61 additions & 0 deletions .github/actions/framework-latest-release/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# framework-latest-release

This composite action determines the **openDAQ framework package** to use.
It supports resolving either the **latest release** from GitHub or a **specific version** provided as input,
and outputs all required information to download and install the package.

---

## Inputs

| Name | Required | Default | Description |
|-------------------------------------|----------|---------|-------------|
| `opendaq-framework-release-version` | no | `latest`| openDAQ framework version. Use `latest` for the newest release, or provide a specific version (e.g. `3.20.4`). |
| `win32-force` | no | `false` | On Windows runners, forces `win32` instead of `win64` platform. |

---

## Outputs

| Name | Description |
|------------|-------------|
| `version` | Resolved openDAQ release version (e.g. `3.20.4`). |
| `platform` | Detected platform string (`ubuntu22.04-x86_64`, `ubuntu22.04-arm64`, `win32`, `win64`). |
| `packaging`| Package type (`deb` on Linux, `exe` on Windows). |
| `artefact` | Resolved artefact filename (e.g. `opendaq-3.20.4-win64.exe`). |
| `scheme` | URI scheme (currently `s3`). |
| `authority`| Storage authority (S3 bucket name). |
| `path` | Path inside the bucket (e.g. `releases/v3.20.4/SDK`). |
| `uri` | Full URI to the artefact (e.g. `s3://bucket/releases/v3.20.4/SDK/opendaq-3.20.4-win64.exe`). |

---

## Example usage

```yaml
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Determine openDAQ framework package
id: framework
uses: ./.github/actions/framework-latest-release
with:
opendaq-framework-release-version: latest

- name: Print resolved artefact info
run: |
echo "Version: ${{ steps.framework.outputs.version }}"
echo "Platform: ${{ steps.framework.outputs.platform }}"
echo "Artefact: ${{ steps.framework.outputs.artefact }}"
echo "URI: ${{ steps.framework.outputs.uri }}"
```

## Notes
- The action relies on GitHub CLI (gh) and jq.
- These are pre-installed on GitHub-hosted Ubuntu and Windows runners.
- On Windows, if you explicitly need a 32-bit package, set win32-force: true.
- If the latest release cannot be determined, the action fails.
Loading
Loading