diff --git a/.github/actions/codecov/action.yml b/.github/actions/codecov/action.yml new file mode 100644 index 000000000..07e2ed33c --- /dev/null +++ b/.github/actions/codecov/action.yml @@ -0,0 +1,26 @@ +name: "Create Codecov artifacts" +description: "Create Codecov artifacts for test results and coverage" +inputs: + arch: + description: "The NodeJS version to use" + required: true + artifact: + description: "The name of the artifact to upload" +runs: + using: "composite" + steps: + - name: "Upload test results" + if: ${{ !cancelled() }} + uses: codecov/codecov-action@v5 + with: + flags: ${{ inputs.arch }} + report_type: test_results + token: ${{ secrets.CODECOV_TOKEN }} + - name: "Upload coverage report for conformance tests" + uses: actions/upload-artifact@v6 + with: + name: ${{ inputs.artifact }} + path: | + ./coverage.xml + retention-days: 1 + if-no-files-found: error \ No newline at end of file diff --git a/.github/actions/setup/macos/action.yml b/.github/actions/setup/macos/action.yml new file mode 100644 index 000000000..682a7c780 --- /dev/null +++ b/.github/actions/setup/macos/action.yml @@ -0,0 +1,30 @@ +name: "Setup Environment" +description: "Installs dependencies and configures the execution environment for Mac OS runners" +inputs: + node: + description: "The NodeJS version to use" + required: true + python: + description: "The Python version to use" + required: true + uv: + description: "The uv version to use" + required: true +runs: + using: "composite" + steps: + - uses: astral-sh/setup-uv@v7 + with: + version: ${{ inputs.uv }} + - uses: actions/setup-python@v6 + with: + python-version: ${{ inputs.python }} + - uses: actions/setup-node@v6 + with: + node-version: ${{ inputs.node }} + - name: "Install Docker" + uses: docker/setup-docker-action@v4 + env: + LIMA_START_ARGS: '--vm-type=vz --mount-type=virtiofs --mount /private/var/folders:w' + - name: "Install Docker Compose" + uses: docker/setup-compose-action@v1 \ No newline at end of file diff --git a/.github/actions/setup/ubuntu/action.yml b/.github/actions/setup/ubuntu/action.yml new file mode 100644 index 000000000..22c8f913f --- /dev/null +++ b/.github/actions/setup/ubuntu/action.yml @@ -0,0 +1,40 @@ +name: "Setup Environment" +description: "Installs dependencies and configures the execution environment for Ubuntu runners" +inputs: + node: + description: "The NodeJS version to use" + required: true + python: + description: "The Python version to use" + required: true + uv: + description: "The uv version to use" + required: true +runs: + using: "composite" + steps: + - uses: astral-sh/setup-uv@v7 + with: + version: ${{ inputs.uv }} + - uses: actions/setup-python@v6 + with: + python-version: ${{ matrix.python }} + - uses: actions/setup-node@v6 + with: + node-version: ${{ inputs.node }} + - uses: docker/setup-qemu-action@v3 + - name: "Install Apptainer" + uses: eWaterCycle/setup-apptainer@v2 + with: + apptainer-version: 1.4.2 + - name: "Install KinD" + uses: helm/kind-action@v1.14.0 + with: + config: .github/kind/config.yaml + kubectl_version: v1.35.0 + version: v0.31.0 + - name: "Configure Calico on KinD" + shell: bash + run: | + kubectl apply -f https://docs.projectcalico.org/v3.25/manifests/calico.yaml + kubectl -n kube-system set env daemonset/calico-node FELIX_IGNORELOOSERPF=true diff --git a/.github/workflows/ci-tests.yaml b/.github/workflows/ci-tests.yml similarity index 77% rename from .github/workflows/ci-tests.yaml rename to .github/workflows/ci-tests.yml index c48d0254c..87663709b 100644 --- a/.github/workflows/ci-tests.yaml +++ b/.github/workflows/ci-tests.yml @@ -103,21 +103,11 @@ jobs: EXCLUDE: ${{ matrix.exclude }} DOCKER: ${{ matrix.docker }} run: ./cwl-conformance-test.sh - - name: "Upload test results" - if: ${{ !cancelled() }} - uses: codecov/codecov-action@v5 - with: - flags: ${{ startsWith(matrix.on, 'macos-') && 'macos' || 'ubuntu' }} - report_type: test_results - token: ${{ secrets.CODECOV_TOKEN }} - - name: "Upload coverage report for conformance tests" - uses: actions/upload-artifact@v6 + - name: "Create Codecov artifacts" + uses: ./.github/actions/codecov with: - name: ${{ format('{0}-py{1}-cwl{2}-{3}-conformance-tests', matrix.on, matrix.python, matrix.version, matrix.docker) }} - path: | - ./coverage.xml - retention-days: 1 - if-no-files-found: error + arch: ${{ startsWith(matrix.on, 'macos-') && 'macos' || 'ubuntu' }} + artifact: ${{ format('{0}-py{1}-cwl{2}-{3}-conformance-tests', matrix.on, matrix.python, matrix.version, matrix.docker) }} docker-image: name: "StreamFlow Docker image tests" runs-on: ubuntu-24.04 @@ -236,61 +226,29 @@ jobs: TOXENV: ${{ format('py{0}-unit', matrix.python) }} steps: - uses: actions/checkout@v6 - - uses: astral-sh/setup-uv@v7 - with: - version: "0.9.16" - - uses: actions/setup-python@v6 - with: - python-version: ${{ matrix.python }} - - uses: actions/setup-node@v6 + - name: "Setup environment (MacOS X)" + uses: ./.github/actions/setup/macos with: - node-version: "24" - - name: "Install Docker (MacOs X)" - uses: docker/setup-docker-action@v4 - env: - LIMA_START_ARGS: '--vm-type=vz --mount-type=virtiofs --mount /private/var/folders:w' + node: 24 + python: ${{ matrix.python }} + uv: 0.9.16 if: ${{ startsWith(matrix.on, 'macos-') }} - - name: "Install Docker Compose (MacOS X)" - uses: docker/setup-compose-action@v1 - if: ${{ startsWith(matrix.on, 'macos-') }} - - uses: docker/setup-qemu-action@v3 - if: ${{ startsWith(matrix.on, 'ubuntu-') }} - - name: "Install Apptainer" - uses: eWaterCycle/setup-apptainer@v2 - with: - apptainer-version: 1.4.2 - if: ${{ startsWith(matrix.on, 'ubuntu-') }} - - name: "Install KinD" - uses: helm/kind-action@v1.14.0 + - name: "Setup environment (Ubuntu)" + uses: ./.github/actions/setup/ubuntu with: - config: .github/kind/config.yaml - kubectl_version: v1.35.0 - version: v0.31.0 - if: ${{ startsWith(matrix.on, 'ubuntu-') }} - - name: "Configure Calico on KinD" - run: | - kubectl apply -f https://docs.projectcalico.org/v3.25/manifests/calico.yaml - kubectl -n kube-system set env daemonset/calico-node FELIX_IGNORELOOSERPF=true + node: 24 + python: ${{ matrix.python }} + uv: 0.9.16 if: ${{ startsWith(matrix.on, 'ubuntu-') }} - name: "Install Tox" run: uv tool install tox --with tox-uv - name: "Run StreamFlow tests via Tox" run: tox - - name: "Upload test results" - if: ${{ !cancelled() }} - uses: codecov/codecov-action@v5 - with: - flags: ${{ startsWith(matrix.on, 'macos-') && 'macos' || 'ubuntu' }} - report_type: test_results - token: ${{ secrets.CODECOV_TOKEN }} - - name: "Upload coverage report for unit tests" - uses: actions/upload-artifact@v6 + - name: "Create Codecov artifacts" + uses: ./.github/actions/codecov with: - name: ${{ format('{0}-py{1}-unit-tests', matrix.on, matrix.python) }} - path: | - ./coverage.xml - retention-days: 1 - if-no-files-found: error + arch: ${{ startsWith(matrix.on, 'macos-') && 'macos' || 'ubuntu' }} + artifact: ${{ format('{0}-py{1}-unit-tests', matrix.on, matrix.python) }} upload-to-codecov: name: "Codecov report upload" needs: ["cwl-conformance", "unit-tests"]