CICD #64
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
# Copyright 2023 Nokia | |
# Licensed under the BSD 3-Clause License. | |
# SPDX-License-Identifier: BSD-3-Clause | |
--- | |
name: CICD | |
"on": | |
workflow_dispatch: | |
inputs: | |
srlinux-version: | |
description: "SR Linux version" | |
required: true | |
default: "23.3.2" | |
start-tmate: | |
description: "start tmate before running tests" | |
type: boolean | |
required: false | |
default: false | |
pull_request: | |
push: | |
tags: | |
- "v*" | |
jobs: | |
prepare-matrix: | |
runs-on: ubuntu-22.04 | |
outputs: | |
matrix: ${{ steps.matrix.outputs.output }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: fabasoad/data-format-converter-action@main | |
id: matrix | |
with: | |
input: ".github/matrix.yml" | |
from: "yaml" | |
to: "json" | |
test: | |
runs-on: ${{ matrix.runs-on }} | |
needs: [prepare-matrix] | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.prepare-matrix.outputs.matrix) }} | |
steps: | |
# setting env vars for the test based in user input | |
- name: Set Env vars | |
run: | | |
echo "SRLINUX_VERSION=${{ inputs.srlinux-version }}" >> $GITHUB_ENV | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install ansible core | |
run: pip install ansible-core==${{ matrix.ansible-core-version }} | |
# Uncomment this section to use private images | |
# - name: ghcr.io login | |
# uses: docker/login-action@v2 | |
# with: | |
# registry: ghcr.io | |
# username: ${{ github.actor }} | |
# password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Test | |
run: ./run.sh ci-test | |
- name: start tmate session | |
uses: mxschmitt/action-tmate@v3 | |
if: ${{ inputs.start-tmate }} | |
ansible-sanity-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Install ansible core | |
run: pip install ansible-core==2.13.8 | |
- name: Ansible sanity test | |
run: ./run.sh sanity-test |