Share prngs across all devices #222
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: 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 destinationn' | |
run: | | |
mkdir `pwd`/artifacts | |
- name: 'Build snek' | |
run: | | |
docker run --rm \ | |
--mount type=bind,source=`pwd`/artifacts,destination=/artifacts \ | |
snek \ | |
make DESTDIR=/artifacts PREFIX=/opt/snek SNEK_OTHEROS=1 SNEK_RISCV_TEST=1 black check install install-otheros | |
- name: 'Upload results' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: snek | |
path: artifacts |