Main CI workflow #2369
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: Main CI workflow | |
# Note: If the workflow name is changed, the CI badge URL in the README must also be updated | |
on: | |
push: # Push trigger runs on any pushed branch. | |
schedule: # Scheduled trigger runs on the latest commit on the default branch. | |
- cron: '0 22 * * *' | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
lfs: false | |
- name: Build and lint | |
# Linting job should be run on the latest Ubuntu release that we can support | |
run: | | |
docker run \ | |
--volume $PWD:/host \ | |
--workdir /host/continuous-integration/linux \ | |
--env "PYTHONDONTWRITEBYTECODE=1" \ | |
ubuntu:24.04 \ | |
bash -c "./setup.sh && ./install-sdk.sh && ./build.sh && ./lint.sh" | |
- name: Notify Teams | |
if: ${{ failure() && github.ref == 'refs/heads/master' }} | |
env: | |
CI_FAILURE_TEAMS_HOOK: ${{ secrets.CI_FAILURE_TEAMS_HOOK }} | |
run: python continuous-integration/notification/notify_teams.py --status ${{ job.status }} | |
create-source-distribution: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
lfs: false | |
- name: Create source distribution | |
run: | | |
docker run \ | |
--volume $PWD:/host \ | |
--workdir /host/continuous-integration/linux \ | |
--env "PYTHONDONTWRITEBYTECODE=1" \ | |
ubuntu:20.04 \ | |
bash -c "./setup.sh && ./create-source-distribution.sh" | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: source-distribution | |
path: dist/zivid*.tar.gz | |
retention-days: 1 | |
- name: Notify Teams | |
if: ${{ failure() && github.ref == 'refs/heads/master' }} | |
env: | |
CI_FAILURE_TEAMS_HOOK: ${{ secrets.CI_FAILURE_TEAMS_HOOK }} | |
run: python continuous-integration/notification/notify_teams.py --status ${{ job.status }} | |
create-windows-binary-distribution: | |
runs-on: windows-2019 | |
strategy: | |
matrix: | |
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
lfs: false | |
- name: Set up Python ${{matrix.python-version}} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{matrix.python-version}} | |
- name: Setup | |
run: python continuous-integration\windows\setup.py | |
- name: Create binary distribution | |
env: | |
Zivid_DIR: 'C:\Program Files\Zivid\CMake\Zivid' | |
CXX: 'cl.exe' | |
CC: 'cl.exe' | |
run: python continuous-integration\windows\create_binary_distribution.py | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: bdist-win-python${{matrix.python-version}} | |
path: dist/zivid*.whl | |
retention-days: 1 | |
- name: Notify Teams | |
if: ${{ failure() && github.ref == 'refs/heads/master' }} | |
env: | |
CI_FAILURE_TEAMS_HOOK: ${{ secrets.CI_FAILURE_TEAMS_HOOK }} | |
run: python continuous-integration/notification/notify_teams.py --status ${{ job.status }} | |
test-linux-source-distribution: | |
needs: create-source-distribution | |
runs-on: ubuntu-latest | |
# Build & test job should be run on: | |
# - All Ubuntu versions officially supported by Zivid SDK | |
# - All (not end-of-life) Ubuntu versions newer than the latest LTS | |
# - The three latest Fedora releases that we can support | |
strategy: | |
matrix: | |
os: | |
- ubuntu:20.04 | |
- ubuntu:22.04 | |
- ubuntu:23.10 | |
- ubuntu:24.04 | |
- fedora:39 | |
- fedora:40 | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: source-distribution | |
path: dist | |
- name: Install from source-distribution and test | |
run: | | |
docker run \ | |
--volume $PWD:/host \ | |
--workdir /host/continuous-integration/linux \ | |
--env "PYTHONDONTWRITEBYTECODE=1" \ | |
${{matrix.os}} \ | |
bash -c "./setup.sh && ./install-sdk.sh && ./build-and-install-source-distribution.sh && ./setup-opencl.sh && ./test.sh" | |
- name: Notify Teams | |
if: ${{ failure() && github.ref == 'refs/heads/master' }} | |
env: | |
CI_FAILURE_TEAMS_HOOK: ${{ secrets.CI_FAILURE_TEAMS_HOOK }} | |
run: python continuous-integration/notification/notify_teams.py --status ${{ job.status }} | |
test-windows-binary-distribution: | |
needs: create-windows-binary-distribution | |
runs-on: windows-2019 | |
strategy: | |
matrix: | |
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: bdist-win-python${{matrix.python-version}} | |
path: dist | |
- name: Set up Python ${{matrix.python-version}} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{matrix.python-version}} | |
- name: Setup | |
run: python continuous-integration\windows\setup.py | |
- name: Install from binary distribution | |
run: python continuous-integration\windows\install_binary_distribution.py | |
- name: Test | |
run: python continuous-integration\windows\test.py | |
- name: Notify Teams | |
if: ${{ failure() && github.ref == 'refs/heads/master' }} | |
env: | |
CI_FAILURE_TEAMS_HOOK: ${{ secrets.CI_FAILURE_TEAMS_HOOK }} | |
run: python continuous-integration/notification/notify_teams.py --status ${{ job.status }} | |
deploy: | |
needs: [lint, test-linux-source-distribution, test-windows-binary-distribution] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
lfs: false | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: Collect and check | |
run: | | |
docker run \ | |
--volume $PWD:/host \ | |
--workdir /host/continuous-integration/linux \ | |
--env "PYTHONDONTWRITEBYTECODE=1" \ | |
ubuntu:20.04 \ | |
bash -c "./collect-and-check-artifacts.sh" | |
- name: Upload all as single artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: distributions_all | |
path: distribution/ | |
- name: Notify Teams | |
if: ${{ failure() && github.ref == 'refs/heads/master' }} | |
env: | |
CI_FAILURE_TEAMS_HOOK: ${{ secrets.CI_FAILURE_TEAMS_HOOK }} | |
run: python continuous-integration/notification/notify_teams.py --status ${{ job.status }} |