Skip to content

rename topology to info and update readme #328

rename topology to info and update readme

rename topology to info and update readme #328

Workflow file for this run

# .github/workflows/ci-cd.yml
---
on:
- push
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
PYTHONUNBUFFERED: 1
jobs:
test_nomad:
strategy:
max-parallel: 2
matrix:
include:
- nomad: 1.8.2
python: 3.12
- nomad: 1.6.8
python: 3.7
name: Test
runs-on: ubuntu-latest
timeout-minutes: 7
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: 'pip'
cache-dependency-path: ./requirements*.txt
- name: install editable package
run: pip install -e .
- name: install test requirements
run: pip install -r ./requirements-test.txt
- name: run pyright
uses: jakebailey/pyright-action@v2
- name: run unit tests
run: ./unit_tests.sh --durations=10 -n auto
- name: install cni
run: bash ./tests/provision.sh cni_install
- name: install nomad server
run: bash ./tests/provision.sh nomad_install ${{ matrix.nomad }}
- name: run nomad server
run: bash ./tests/provision.sh nomad_start
- name: run integration tests
run: ./integration_tests.sh --durations=10 --cov=nomad_tools -n 3
test_ssl:
runs-on: ubuntu-latest
timeout-minutes: 7
steps:
- name: checkout
uses: actions/checkout@v4
- name: upgrade pip
run: pip install --upgrade pip
- name: install editable package
run: pip install -e .
- name: install nomad server
run: bash ./tests/provision.sh nomad_install 1.8.0
- name: run nomad server tls
run: bash ./tests/provision.sh nomad_start_tls
- name: test tls connection
run: ./tests/tls_env.bash testall
test_docker:
# runs-on: [self-hosted, nomadtools]
runs-on: ubuntu-latest
timeout-minutes: 7
# Sets the permissions anted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- run: docker build --target test .
- run: docker build --target app .
tests:
# runs-on: [self-hosted, nomadtools]
runs-on: ubuntu-latest
timeout-minutes: 1
needs:
- test_nomad
- test_ssl
- test_docker
steps:
- run: echo hello world
build-and-push-docker:
needs:
- tests
if: github.event_name == 'push'
# runs-on: [self-hosted, nomadtools]
runs-on: ubuntu-latest
timeout-minutes: 5
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
context: .
push: true
target: app
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see "[AUTOTITLE](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds)."
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
pypi-publish:
name: Upload release to PyPI
needs:
- tests
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
# runs-on: [self-hosted, nomadtools]
runs-on: ubuntu-latest
timeout-minutes: 5
environment:
name: pypi
url: https://pypi.org/p/nomad-tools
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: checkout
uses: actions/checkout@v4
- name: install build python package
run: pip install --upgrade build
- name: build the package
run: python -m build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1