1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
name: snek
on:
push:
branches:
- main
pull_request:
branches:
- main
# When a PR is updated, cancel the jobs from the previous version. Merges
# do not define head_ref, so use run_id to never cancel those jobs.
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
IMAGE_FILE: dockerimg.tar.zst
IMAGE: snek
DOCKER_FILE: snek/.github/Dockerfile
jobs:
cache-maker:
runs-on: ubuntu-latest
steps:
- name: 'Clone snek'
uses: actions/checkout@v4
with:
path: snek
- name: Check for Docker Image
id: cache
uses: actions/cache@v4
with:
path: ${{ env.IMAGE_FILE }}
key: ${{ env.IMAGE_FILE }}-${{ hashFiles( env.DOCKER_FILE ) }}
lookup-only: true
- name: Set up Docker build
if: steps.cache.outputs.cache-hit != 'true'
uses: docker/setup-buildx-action@v3
- name: Build snek container
if: steps.cache.outputs.cache-hit != 'true'
uses: docker/build-push-action@v6
with:
platforms: linux/amd64
file: .github/Dockerfile
tags: ${{ env.IMAGE }}:latest
outputs: type=docker,force-compression=true,compression=zstd,compression-level=22,dest=${{ env.IMAGE_FILE }}
test-snek:
needs: cache-maker
runs-on: ubuntu-latest
steps:
- name: 'Clone snek'
uses: actions/checkout@v4
with:
path: snek
- name: Restore the Docker Image
uses: actions/cache@v4
with:
path: ${{ env.IMAGE_FILE }}
key: ${{ env.IMAGE_FILE }}-${{ hashFiles( env.DOCKER_FILE ) }}
fail-on-cache-miss: true
- name: Load Docker image
run: |
docker load -i $IMAGE_FILE
docker images -a $IMAGE
- name: 'Create install destination'
run: |
mkdir -p artifacts
- name: 'Build snek'
run: |
docker run \
-v $(readlink -f snek):/snek \
-v $(readlink -f artifacts):/artifacts \
-w /snek \
$IMAGE \
make DESTDIR=/artifacts PREFIX=/opt/snek SNEK_OTHEROS=1 \
SNEK_RISCV_TEST=1 -j$(nproc) \
black check install install-otheros
- name: 'Upload results'
uses: actions/upload-artifact@v4
with:
name: snek
path: artifacts
|