Log stdout
when exec errors
#3157
Workflow file for this run
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: CICD | |
on: | |
push: | |
branches: | |
- main | |
- docs-publish | |
tags: | |
- "v*" | |
pull_request: | |
workflow_dispatch: | |
env: | |
GOVER: 1.20.2 | |
CGO_ENABLED: 0 | |
MKDOCS_INS_VER: 9.1.4-insiders-4.32.4-hellt | |
GORELEASER_VER: v1.11.4 | |
PODMAN_VER: v4.4.2 | |
jobs: | |
file-changes: | |
runs-on: ubuntu-22.04 | |
outputs: | |
code: ${{ steps.filter.outputs.code }} | |
docs: ${{ steps.filter.outputs.docs }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dorny/paths-filter@v2 | |
id: filter | |
with: | |
filters: | | |
code: | |
- 'clab/**' | |
- 'runtime/**' | |
- 'cmd/**' | |
- 'tests/**' | |
- 'nodes/**' | |
- 'types/**' | |
- 'utils/**' | |
- 'netconf/**' | |
- 'labels/**' | |
- 'internal/**' | |
- 'errors/**' | |
- 'cert/**' | |
- 'border0_api/**' | |
- '.github/workflows/cicd.yml' | |
- 'go.mod' | |
- 'Makefile' | |
docs: | |
- "docs/**" | |
- "lab-examples/**" | |
- "mkdocs.yml" | |
- "README.md" | |
- '.github/workflows/cicd.yml' | |
build-containerlab: | |
runs-on: ubuntu-22.04 | |
needs: file-changes | |
if: needs.file-changes.outputs.code == 'true' || startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: WillAbides/[email protected] | |
with: | |
go-version: ${{ env.GOVER }} | |
- name: Cache go modules | |
uses: actions/cache@v3 | |
with: | |
# In order: | |
# * Module download cache | |
# * Build cache (Linux) | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Build containerlab | |
run: make build-with-podman BINARY=containerlab | |
# store clab binary as artifact | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: containerlab | |
path: containerlab | |
staticcheck: | |
runs-on: ubuntu-22.04 | |
needs: file-changes | |
if: needs.file-changes.outputs.code == 'true' || startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: WillAbides/[email protected] | |
with: | |
go-version: ${{ env.GOVER }} | |
- name: Staticcheck | |
run: | | |
go install honnef.co/go/tools/cmd/staticcheck@latest | |
staticcheck ./... | |
unit-test: | |
runs-on: ubuntu-22.04 | |
needs: file-changes | |
if: needs.file-changes.outputs.code == 'true' || startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: WillAbides/[email protected] | |
with: | |
go-version: ${{ env.GOVER }} | |
- name: Cache go modules | |
uses: actions/cache@v3 | |
with: | |
# In order: | |
# * Module download cache | |
# * Build cache (Linux) | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- run: CGO_ENABLED=1 go test -race ./... -coverprofile coverage.out -covermode atomic | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
build-podman-v4: | |
env: | |
CGO_ENABLED: 1 # CGO is required for podman | |
runs-on: ubuntu-22.04 | |
needs: file-changes | |
if: needs.file-changes.outputs.code == 'true' || startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Cache podman bin | |
id: cache-podman-bin | |
uses: actions/cache@v3 | |
with: | |
path: | | |
./bin | |
key: ${{ runner.os }}-podman-${{ env.PODMAN_VER }} | |
restore-keys: | | |
${{ runner.os }}-podman | |
- uses: actions/checkout@v3 | |
if: steps.cache-podman-bin.outputs.cache-hit != 'true' | |
with: | |
repository: containers/podman | |
ref: ${{ env.PODMAN_VER }} | |
- uses: WillAbides/[email protected] | |
if: steps.cache-podman-bin.outputs.cache-hit != 'true' | |
with: | |
go-version: ${{ env.GOVER }} | |
- name: Cache go modules | |
if: steps.cache-podman-bin.outputs.cache-hit != 'true' | |
uses: actions/cache@v3 | |
with: | |
# In order: | |
# * Module download cache | |
# * Build cache (Linux) | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-go-podman-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go-podman | |
- name: Add build packages | |
if: steps.cache-podman-bin.outputs.cache-hit != 'true' | |
run: sudo apt update && sudo apt install -y libsystemd-dev libseccomp-dev pkg-config golang-github-proglottis-gpgme-dev | |
- name: Build podman v4 | |
if: steps.cache-podman-bin.outputs.cache-hit != 'true' | |
run: make binaries | |
# store podman binary as artifact | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: podman-bins | |
path: bin | |
smoke-tests: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
runtime: | |
- "docker" | |
- "podman" | |
# - "containerd" | |
needs: | |
- unit-test | |
- staticcheck | |
- build-containerlab | |
- build-podman-v4 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: containerlab | |
- name: Move containerlab to usr/bin | |
run: sudo mv ./containerlab /usr/bin/containerlab && sudo chmod a+x /usr/bin/containerlab | |
- name: download podman bin artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: podman-bins | |
- name: Move podman to /usr/bin | |
run: sudo mv ./podman /usr/bin && sudo chmod a+x /usr/bin/podman | |
- name: Enable Podman API service | |
run: sudo systemctl start podman | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.8" | |
cache: pip | |
cache-dependency-path: "tests/requirements.txt" | |
- name: Install robotframework | |
run: | | |
pip install -r tests/requirements.txt | |
- name: Run smoke tests | |
run: | | |
bash ./tests/rf-run.sh ${{ matrix.runtime }} ./tests/01-smoke | |
# upload test reports as a zip file | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: 01-smoke-log | |
path: ./tests/out/*.html | |
ext-container-tests: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
runtime: | |
- "docker" | |
needs: | |
- unit-test | |
- staticcheck | |
- build-containerlab | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: containerlab | |
- name: Move containerlab to usr/bin | |
run: sudo mv ./containerlab /usr/bin/containerlab && sudo chmod a+x /usr/bin/containerlab | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.8" | |
cache: pip | |
cache-dependency-path: "tests/requirements.txt" | |
- name: Install robotframework | |
run: | | |
pip install -r tests/requirements.txt | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run tests | |
run: | | |
bash ./tests/rf-run.sh ${{ matrix.runtime }} ./tests/06-ext-container | |
# upload test reports as a zip file | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: 06-ext-container-log | |
path: ./tests/out/*.html | |
ceos-basic-tests: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
runtime: | |
- "docker" | |
# - "containerd" | |
needs: | |
- unit-test | |
- staticcheck | |
- build-containerlab | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: containerlab | |
- name: Move containerlab to usr/bin | |
run: sudo mv ./containerlab /usr/bin/containerlab && sudo chmod a+x /usr/bin/containerlab | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.8" | |
cache: pip | |
cache-dependency-path: "tests/requirements.txt" | |
- name: Install robotframework | |
run: | | |
pip install -r tests/requirements.txt | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Pull ceos image | |
run: docker pull ghcr.io/srl-labs/ceos:4.28.0F && docker tag ghcr.io/srl-labs/ceos:4.28.0F ceos:4.28.0F | |
- name: Run ceos tests | |
run: | | |
bash ./tests/rf-run.sh ${{ matrix.runtime }} ./tests/03-basic-ceos | |
# upload test reports as a zip file | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: 03-basic-ceos-log | |
path: ./tests/out/*.html | |
srlinux-basic-tests: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
runtime: | |
- "docker" | |
- "podman" | |
needs: | |
- unit-test | |
- staticcheck | |
- build-containerlab | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: containerlab | |
- name: Move containerlab to usr/bin | |
run: sudo mv ./containerlab /usr/bin/containerlab && sudo chmod a+x /usr/bin/containerlab | |
- name: download podman bin artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: podman-bins | |
- name: Move podman to /usr/bin | |
run: sudo mv ./podman /usr/bin && sudo chmod a+x /usr/bin/podman | |
- name: Enable Podman API service | |
run: sudo systemctl start podman | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.8" | |
cache: pip | |
cache-dependency-path: "tests/requirements.txt" | |
- name: Install robotframework | |
run: | | |
pip install -r tests/requirements.txt | |
- name: Run srlinux tests | |
run: | | |
bash ./tests/rf-run.sh ${{ matrix.runtime }} ./tests/02-basic-srl | |
# upload test reports as a zip file | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: 02-basic-srl-log | |
path: ./tests/out/*.html | |
ixiac-one-basic-tests: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
runtime: | |
- "docker" | |
needs: | |
- unit-test | |
- staticcheck | |
- build-containerlab | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: containerlab | |
- name: Move containerlab to usr/bin | |
run: sudo mv ./containerlab /usr/bin/containerlab && sudo chmod a+x /usr/bin/containerlab | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.8" | |
cache: pip | |
cache-dependency-path: "tests/requirements.txt" | |
- name: Install robotframework | |
run: | | |
pip install -r tests/requirements.txt | |
- name: Run keysight_ixia-c-one tests | |
run: | | |
bash ./tests/rf-run.sh ${{ matrix.runtime }} ./tests/04-basic-ixiacone | |
# upload test reports as a zip file | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: 04-basic-ixiacone-log | |
path: ./tests/out/*.html | |
docs-test: | |
runs-on: ubuntu-22.04 | |
needs: file-changes | |
if: needs.file-changes.outputs.docs == 'true' || startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/docs-publish' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- run: docker run -v $(pwd):/docs --user $(id -u):$(id -g) --entrypoint mkdocs ghcr.io/srl-labs/mkdocs-material-insiders:$MKDOCS_INS_VER build --clean --strict | |
- name: Cache htmltest external links | |
uses: actions/cache@v3 | |
with: | |
path: tmp/.htmltest | |
# key will contain hash of all md files to check if files have changed | |
# when files are changed, a new key name is formed, and thus a new cache will be saved | |
key: htmltest-${{ hashFiles('docs/**/*.md') }} | |
# the restore key will fetch any previously saved cache even if there is no match on key | |
# this allows to use cache from prev runs and update it | |
restore-keys: | | |
htmltest- | |
- name: htmltest | |
uses: wjdp/htmltest-action@master | |
with: | |
config: docs/htmltest.yml | |
build-and-release: | |
runs-on: ubuntu-22.04 | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: | |
- docs-test | |
- smoke-tests | |
- ceos-basic-tests | |
- srlinux-basic-tests | |
- ixiac-one-basic-tests | |
- ext-container-tests | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: WillAbides/[email protected] | |
with: | |
go-version: ${{ env.GOVER }} | |
- name: Cache go modules | |
uses: actions/cache@v3 | |
with: | |
# In order: | |
# * Module download cache | |
# * Build cache (Linux) | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v4 | |
with: | |
version: ${{ env.GORELEASER_VER }} | |
args: release --rm-dist --debug | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
FURY_TOKEN: ${{ secrets.FURYPUSHTOKEN }} | |
publish-docs: | |
runs-on: ubuntu-22.04 | |
if: startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '-') != true | |
needs: build-and-release | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- run: docker run -v $(pwd):/docs --user $(id -u):$(id -g) --entrypoint mkdocs ghcr.io/srl-labs/mkdocs-material-insiders:$MKDOCS_INS_VER gh-deploy --force --strict | |
# update docs allows to make the docs changes outside of the release cycle | |
# it skips the code build/release and proceeds with docs publishing | |
# the intended usage is to provide fixes/updates to docs, which do not require code changes | |
update-docs: | |
runs-on: ubuntu-22.04 | |
if: github.ref == 'refs/heads/docs-publish' | |
needs: docs-test | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- run: docker run -v $(pwd):/docs --user $(id -u):$(id -g) --entrypoint mkdocs ghcr.io/srl-labs/mkdocs-material-insiders:$MKDOCS_INS_VER gh-deploy --force --strict |