Skip to content

Commit 3b8a533

Browse files
authored
Add basic tox test workflow (#22)
* Remove various legacy files * Remove unused code * Fix up unit tests and linter * Add tox workflow * Slight update to the readme * Always run the tox job * Update container build
1 parent 7bcc2d0 commit 3b8a533

31 files changed

+152
-2144
lines changed

.github/workflows/docker.yaml

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,54 +3,43 @@ name: Docker image
33
on: push
44
jobs:
55
build_push_api:
6-
name: Build and push execution environment
6+
name: Build and push image
77
runs-on: ubuntu-latest
8+
permissions:
9+
contents: read
10+
id-token: write # needed for signing the images with GitHub OIDC Token
11+
packages: write # required for pushing container images
12+
security-events: write # required for pushing SARIF files
13+
814
steps:
915
- name: Check out the repository
10-
uses: actions/checkout@v2
11-
12-
- name: Set up Docker Buildx
13-
uses: docker/setup-buildx-action@v1
16+
uses: actions/checkout@v4
1417

15-
- name: Set up Docker layer caching
16-
uses: actions/cache@v2
17-
with:
18-
path: /tmp/.buildx-cache
19-
key: ${{ runner.os }}-buildx-${{ github.sha }}
20-
restore-keys: |
21-
${{ runner.os }}-buildx-
2218
- name: Login to GitHub Container Registry
23-
uses: docker/login-action@v1
19+
uses: docker/login-action@v3
2420
with:
2521
registry: ghcr.io
2622
username: ${{ github.actor }}
2723
password: ${{ secrets.GITHUB_TOKEN }}
2824

2925
- name: Calculate metadata for image
3026
id: image-meta
31-
uses: docker/metadata-action@v3
27+
uses: docker/metadata-action@v5
3228
with:
3329
images: ghcr.io/stackhpc/os-capacity
3430
# Produce the branch name or tag and the SHA as tags
3531
tags: |
3632
type=ref,event=branch
3733
type=ref,event=tag
3834
type=sha,prefix=
35+
3936
- name: Build and push image
40-
uses: docker/build-push-action@v2
37+
uses: azimuth-cloud/github-actions/docker-multiarch-build-push@master
4138
with:
39+
cache-key: os-capacity
4240
context: .
41+
platforms: linux/amd64,linux/arm64
4342
push: true
4443
tags: ${{ steps.image-meta.outputs.tags }}
4544
labels: ${{ steps.image-meta.outputs.labels }}
46-
cache-from: type=local,src=/tmp/.buildx-cache
47-
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
48-
49-
# Temp fix
50-
# https://github.com/docker/build-push-action/issues/252
51-
# https://github.com/moby/buildkit/issues/1896
52-
# https://github.com/docker/buildx/pull/535
53-
- name: Move cache
54-
run: |
55-
rm -rf /tmp/.buildx-cache
56-
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
45+
github-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/tox.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Tox unit tests
2+
3+
on: push
4+
5+
jobs:
6+
build:
7+
name: Tox unit tests and linting
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python-version: ['3.10']
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up Python ${{ matrix.python-version }}
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: ${{ matrix.python-version }}
20+
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
python -m pip install tox
25+
26+
- name: Test with tox
27+
run: tox

README.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
os-capacity
22
===========
33

4-
This is a prototype tool to extract capacity information.
4+
This is a prototype prometheus exporter
5+
to extract capacity information from OpenStack Placement.
6+
7+
It includes support for both baremetal flavors
8+
and flavors with PCPU resources implied.
59

610
Install
711
-------

cron/example.sh

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)