Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: use buildjet instead of self-hosted runner #212

Merged
merged 31 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
00755a4
CI: use buildjet instead of self-hosted runner
sveitser Aug 28, 2024
27406d7
CI: use public runner / buildest for docker build
sveitser Aug 28, 2024
ff98738
CI: more disk space on public runner
sveitser Aug 28, 2024
2a86757
Fix yaml: add quotes
sveitser Aug 28, 2024
1395991
Maybe single quotes?
sveitser Aug 28, 2024
ee77ce9
CI: reserve more space on root for docker build
sveitser Aug 28, 2024
c9c70b0
Manually remove unused software
sveitser Aug 28, 2024
bece2ea
More quickly remove unused software
sveitser Aug 28, 2024
118f29f
Merge branch 'integration' into ma/ci-buildjet
sveitser Aug 28, 2024
64f414f
Don't install rmz if not needed
sveitser Aug 28, 2024
9f8f607
Try using public runners or CI test job
sveitser Aug 28, 2024
b46ad72
Always free disk space
sveitser Aug 28, 2024
f8ae648
Keep hostedtoolcache
sveitser Aug 28, 2024
05c1b99
Comment the madness
sveitser Aug 28, 2024
80ee641
Check disk space at end of runs
sveitser Aug 29, 2024
c6222cd
Try running CI tests from different directory
sveitser Aug 29, 2024
452c0f9
Set working directory for external actions
sveitser Aug 29, 2024
5911cb3
Make workspace dir a symlink to /tmp/gha-work
sveitser Aug 29, 2024
2dee25f
Fix yarn cache path: does not work with symlinks
sveitser Aug 29, 2024
c195440
Comment out setup nodejs version
sveitser Aug 29, 2024
42cea12
Use new caches
sveitser Aug 29, 2024
bc72ef0
Fix upload log action
sveitser Aug 29, 2024
b533188
Maybe fix cache ref
sveitser Aug 29, 2024
ad2311f
Fix typo
sveitser Aug 29, 2024
496ecf5
Remove non-working docker cache
sveitser Aug 29, 2024
3690a9c
Revert "Remove non-working docker cache"
sveitser Aug 29, 2024
9a9dde1
Remove comments
sveitser Aug 29, 2024
795cc0a
Keep azure tools (maybe fix redis tests)
sveitser Aug 29, 2024
c34946a
Revert "Keep azure tools (maybe fix redis tests)"
sveitser Aug 30, 2024
19f1edb
Fix redis URL
sveitser Aug 30, 2024
8c5f5a9
Move redis tests to own workflow
sveitser Aug 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/actions/docker-image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ runs:
target: ${{ inputs.target }}
labels: ${{ steps.metadata.outputs.labels }}
platforms: ${{ inputs.platforms }}
cache-from: type=gha
cache-to: type=gha,mode=max
cache-from: type=registry,ref=user/app:latest
sveitser marked this conversation as resolved.
Show resolved Hide resolved
cache-to: type=inline
outputs: type=image,name=${{ inputs.images }},push-by-digest=true,name-canonical=true,push=true

# This will upload the digest for each architecture to the same artifact,
Expand Down
66 changes: 51 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ concurrency:
jobs:
test:
name: Go Tests
container:
image: ghcr.io/catthehacker/ubuntu:js-22.04
runs-on: [self-hosted, X64]
runs-on: ubuntu-latest

# Creates a redis container for redis tests
services:
Expand All @@ -35,22 +33,55 @@ jobs:
test-mode: [defaults, race, challenge, stylus, long]

steps:
- name: Move repo to avoid too long file paths
run: |
mkdir /tmp/gha-work
cd /tmp/gha-work
rm -rf $GITHUB_WORKSPACE
# Link the original workspace to the new workspace directory
ln -sv /tmp/gha-work $GITHUB_WORKSPACE

- name: Checkout
uses: actions/checkout@v4
with:
submodules: true

- uses: cargo-bins/cargo-binstall@main
- name: Make more disk space available on public runner
run: |
# rmz seems to be faster at deleting files than rm
cargo binstall -y rmz
sudo mv /home/runner/.cargo/bin/rmz /usr/local/bin/rmz

echo "Available storage before:"
sudo df -h
echo
sudo rmz -f /usr/share/dotnet
sudo rmz -f /usr/share/swift
sudo rmz -f /usr/share/gradle-*
sudo rmz -f /usr/share/az_*
sudo rmz -f /usr/local/lib/android
sudo rmz -f /opt/ghc
sudo rmz -f /opt/az
sudo rmz -f /opt/pipx
sudo rmz -f /opt/google
sudo rmz -f /opt/microsoft
echo "Available storage after:"
sudo df -h
echo


- name: Install dependencies
run: >
sudo apt update && sudo apt install -y wabt gotestsum
cmake build-essential bison golang clang make wabt

- name: Setup nodejs
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'
# - name: Setup nodejs
sveitser marked this conversation as resolved.
Show resolved Hide resolved
# uses: actions/setup-node@v3
# with:
# node-version: '18'
# cache: 'yarn'
# cache-dependency-path: '/tmp/gha-work/**/yarn.lock'

- name: Install go
uses: actions/setup-go@v4
Expand Down Expand Up @@ -96,8 +127,8 @@ jobs:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}-${{ matrix.test-mode }}
restore-keys: ${{ runner.os }}-go-
key: v1-${{ runner.os }}-go-${{ hashFiles('go.sum') }}-${{ matrix.test-mode }}
restore-keys: v1-${{ runner.os }}-go-

- name: Cache Rust Build Products
uses: actions/cache@v3
Expand All @@ -109,8 +140,8 @@ jobs:
arbitrator/wasm-libraries/target/
arbitrator/wasm-libraries/soft-float/SoftFloat/build
target/etc/initial-machine-cache/
key: ${{ runner.os }}-cargo-${{ steps.install-rust.outputs.rustc_hash }}-min-${{ hashFiles('arbitrator/Cargo.lock') }}-${{ matrix.test-mode }}
restore-keys: ${{ runner.os }}-cargo-${{ steps.install-rust.outputs.rustc_hash }}-
key: v1-${{ runner.os }}-cargo-${{ steps.install-rust.outputs.rustc_hash }}-min-${{ hashFiles('arbitrator/Cargo.lock') }}-${{ matrix.test-mode }}
restore-keys: v1-${{ runner.os }}-cargo-${{ steps.install-rust.outputs.rustc_hash }}-

- name: Cache cbrotli
uses: actions/cache@v3
Expand All @@ -122,8 +153,8 @@ jobs:
target/lib/libbrotlicommon-static.a
target/lib/libbrotlienc-static.a
target/lib/libbrotlidec-static.a
key: ${{ runner.os }}-brotli-${{ hashFiles('scripts/build-brotli.sh') }}-${{ hashFiles('.github/workflows/arbitrator-ci.yaml') }}-${{ matrix.test-mode }}
restore-keys: ${{ runner.os }}-brotli-
key: v1-${{ runner.os }}-brotli-${{ hashFiles('scripts/build-brotli.sh') }}-${{ hashFiles('.github/workflows/arbitrator-ci.yaml') }}-${{ matrix.test-mode }}
restore-keys: v1-${{ runner.os }}-brotli-

- name: Build cbrotli-local
if: steps.cache-cbrotli.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -217,3 +248,8 @@ jobs:
files: ./coverage.txt,./coverage-redis.txt
verbose: false
token: ${{ secrets.CODECOV_TOKEN }}

- name: Check available space after CI run
if: '!cancelled()'
run: |
sudo df -h
47 changes: 37 additions & 10 deletions .github/workflows/espresso-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,43 @@ jobs:
platform: [linux/amd64, linux/arm64]
include:
- platform: linux/amd64
runs-on: X64
runs-on: ubuntu-latest
- platform: linux/arm64
runs-on: ARM64
runs-on: buildjet-4vcpu-ubuntu-2204-arm

runs-on: [self-hosted, "${{ matrix.runs-on }}"]
runs-on: ${{ matrix.runs-on }}

steps:
# TODO We should be able to remove this but currently it's needed to avoid
# permission errors during checkout.
- name: Fix submodule permissions check

- uses: cargo-bins/cargo-binstall@main
if: matrix.runs-on == 'ubuntu-latest'

- name: Make more disk space available on public runner
if: matrix.runs-on == 'ubuntu-latest'
run: |
sudo chown -R runner:runner .
# Remove potentially leftover files from last run, it's unclear why
# this only works with `sudo` despite the chown command above.
sudo rm -rfv ./target
# rmz seems to be faster at deleting files than rm
cargo binstall -y rmz
sudo mv /home/runner/.cargo/bin/rmz /usr/local/bin/rmz

echo "Available storage before:"
sudo df -h
echo
sudo rmz -f /usr/share/dotnet
sudo rmz -f /usr/share/swift
sudo rmz -f /usr/share/gradle-*
sudo rmz -f /usr/share/az_*
sudo rmz -f /usr/local/lib/android
sudo rmz -f /usr/local/lib/node_modules
sudo rmz -f /opt/ghc
sudo rmz -f /opt/az
sudo rmz -f /opt/pipx
sudo rmz -f /opt/google
sudo rmz -f /opt/microsoft
sudo rmz -f /opt/hostedtoolcache
echo "Available storage after:"
sudo df -h
echo

- name: Fix submodule permissions check
run: |
git config --global --add safe.directory '*'
Expand Down Expand Up @@ -118,6 +140,11 @@ jobs:
with:
files: target/machines/latest/*

- name: Check available space after CI run
if: '!cancelled()'
run: |
sudo df -h

# Merge the AMD64 and ARM64 images into the final (multiplatform) image.
#
# For documentation refer to
Expand Down
Loading