Skip to content

Reduce default build time sizes for use in CI #120

Reduce default build time sizes for use in CI

Reduce default build time sizes for use in CI #120

Workflow file for this run

name: CI tests
on:
pull_request:
push:
branches:
- main
- 'push-action/**'
permissions:
contents: read
packages: write
env:
LINTING_PY_VERSION: "3.11" # The version of Python to use for linting (typically the minimum supported)
# Cancel running workflows when additional changes are pushed
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-a-fallback-value
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python ${{ env.LINTING_PY_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.LINTING_PY_VERSION }}
- name: Set up uv
uses: astral-sh/setup-uv@v3
with:
version: "0.5.x"
enable-cache: true
- name: Install latest compatible versions of immediate dependencies
run: uv sync --all-extras --extra-index-url https://pip.ccdc.cam.ac.uk
- name: Run pre-commit
run: uv run pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
pytest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 2
- uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Maximise disk space
run: |
df -h
sudo swapoff -a
sudo apt clean
sudo apt autoremove -y
sudo apt autoclean -y
sudo rm -rf /swapfile /usr/share/dotnet /usr/local/lib/android /opt/ghc
df -h
- name: Build latest changes
uses: docker/bake-action@v6
env:
CSD_ACTIVATION_KEY: '${{ secrets.CSD_ACTIVATION_KEY }}'
with:
source: "."
targets: "csd-ingester-test"
push: false
load: true
set: |
*.output=type=docker,compression=zstd
- name: Clear buildx cache
run: |
df -h
docker system df
docker buildx prune --force
docker system df
df -h
- name: Run test container
env:
CSD_ACTIVATION_KEY: ${{ secrets.CSD_ACTIVATION_KEY }}
run: |
docker run \
-e CSD_ACTIVATION_KEY \
ghcr.io/datalab-industries/csd-optimade-test:latest