Merge pull request #407 from reubenmiller/fix-notifications2-connect-… #1055
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
branches: [ master, main, next, v2 ] | |
tags-ignore: | |
- 'v*' | |
paths-ignore: | |
- docs/* | |
- '**/*.md' | |
- test/*.go | |
pull_request: | |
branches: [ master, main, next, v2 ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go 1.22 | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.22" | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: install tooling | |
run: go install golang.org/x/tools/cmd/goimports@latest | |
- name: Install GoReleaser | |
uses: goreleaser/goreleaser-action@v5 | |
with: | |
version: '~> v1' | |
install-only: true | |
- name: Install Task | |
uses: arduino/setup-task@v2 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build cli | |
run: task build-powershell build-snapshot | |
shell: bash | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: c8y.windows.amd64 | |
path: dist/windows_windows_amd64_v1/bin/c8y* | |
if-no-files-found: error | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: c8y.linux.amd64 | |
path: dist/linux_linux_amd64_v1/bin/c8y* | |
if-no-files-found: error | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: c8y.macos.amd64 | |
path: dist/macOS_darwin_amd64_v1/bin/c8y* | |
if-no-files-found: error | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: PSc8y Module | |
path: output_pwsh/PSc8y/ | |
if-no-files-found: error | |
test-examples: | |
runs-on: ${{ matrix.os }} | |
needs: [build] | |
if: ${{ true }} | |
env: | |
C8Y_HOST: ${{ secrets.C8Y_HOST }} | |
C8Y_TENANT: ${{ secrets.C8Y_TENANT }} | |
C8Y_USER: ${{ secrets.C8Y_USER }} | |
C8Y_USERNAME: ${{ secrets.C8Y_USER }} | |
C8Y_PASSWORD: ${{ secrets.C8Y_PASSWORD }} | |
DEVICE_BOOTSTRAP_USER: ${{ secrets.DEVICE_BOOTSTRAP_USER }} | |
DEVICE_BOOTSTRAP_PASSWORD: ${{ secrets.DEVICE_BOOTSTRAP_PASSWORD }} | |
# Max timeout for each request (in milliseconds) | |
C8Y_SETTINGS_DEFAULTS_TIMEOUT: 30000 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go 1.22 | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.22" | |
- name: Install Task | |
uses: arduino/setup-task@v2 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/download-artifact@v4 | |
id: download | |
with: | |
name: c8y.linux.amd64 | |
path: /home/runner/.local/bin/ | |
- name: Test c8y examples | |
if: ${{ true }} | |
run: | | |
mv /home/runner/.local/bin/c8y* /home/runner/.local/bin/c8y || true | |
chmod +x /home/runner/.local/bin/c8y | |
echo "/home/runner/.local/bin" >> $GITHUB_PATH | |
c8y version | |
c8y currentuser get --select id | |
task test-cli | |
shell: bash | |
timeout-minutes: 20 | |
test-pwsh: | |
runs-on: ${{ matrix.os }} | |
needs: [build] | |
if: ${{ false }} | |
env: | |
C8Y_HOST: ${{ secrets.C8Y_HOST }} | |
C8Y_TENANT: ${{ secrets.C8Y_TENANT }} | |
C8Y_USER: ${{ secrets.C8Y_USER }} | |
C8Y_PASSWORD: ${{ secrets.C8Y_PASSWORD }} | |
DEVICE_BOOTSTRAP_USER: ${{ secrets.DEVICE_BOOTSTRAP_USER }} | |
DEVICE_BOOTSTRAP_PASSWORD: ${{ secrets.DEVICE_BOOTSTRAP_PASSWORD }} | |
# Max timeout for each request (in milliseconds) | |
C8Y_SETTINGS_DEFAULTS_TIMEOUT: 30000 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-latest, windows-latest, ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go 1.22 | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.22" | |
- name: Install Task | |
uses: arduino/setup-task@v2 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build powershell module | |
run: task build-powershell build-snapshot | |
shell: bash | |
- name: Test powershell module | |
if: ${{ true }} | |
run: task test-powershell | |
shell: bash | |
timeout-minutes: 30 | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: test-results-${{ matrix.os }} | |
path: tools/PSc8y/reports/*.xml | |
publish-test-results: | |
runs-on: ubuntu-latest | |
needs: [test-pwsh] | |
# Disabled as pester does not support junit reports (only nunit) | |
if: always() && false | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-latest, windows-latest, ubuntu-latest] | |
steps: | |
- name: Get test results | |
uses: actions/download-artifact@v4 | |
with: | |
name: test-results-${{ matrix.os }} | |
path: test-results-${{ matrix.os }} | |
- name: Publish results | |
uses: EnricoMi/[email protected] | |
if: always() | |
with: | |
check_name: Test Results | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
files: test-results-${{ matrix.os }}/*.xml | |
log_level: DEBUG |