Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
glandium committed Jan 26, 2025
1 parent fd79776 commit 7d61449
Show file tree
Hide file tree
Showing 9 changed files with 456 additions and 223 deletions.
43 changes: 43 additions & 0 deletions .github/actions/mounts/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Mount dependencies
description: Mount dependencies
inputs:
name:
description: task name
required: true
runs:
using: "composite"
steps:
- name: Compute dependencies
id: dependencies
shell: bash
run: |
python3 CI/run.py --mounts "${{ inputs.name }}" >> $GITHUB_OUTPUT
- uses: actions/setup-node@v3
if: ${{ steps.dependencies.outputs.data }}
with:
node-version: '20.x'
- shell: bash
if: ${{ steps.dependencies.outputs.data }}
run: npm install @actions/cache
- name: Mount dependencies
if: ${{ steps.dependencies.outputs.data }}
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const path = require('path');
const cache = require('@actions/cache');
const data = ${{ toJSON(fromJSON(steps.dependencies.outputs.data)) }};
const pwd = process.cwd();
// Make actions/cache's getWorkingDirectory() return process.cwd.
delete process.env.GITHUB_WORKSPACE;
for (const mount of data) {
const dir = path.join(pwd, 'cache', mount.key, path.dirname(mount.artifact));
fs.mkdirSync(dir, { recursive: true });
process.chdir(dir);
if (await cache.restoreCache([path.basename(mount.artifact)], mount.key, [], {}, true)) {
console.log(`Cache restored from key: ${mount.key}`);
} else {
core.setFailed(`Failed to restore cache from key: ${mount.key}`);
}
}
39 changes: 39 additions & 0 deletions .github/actions/task/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Task
description: Run task
inputs:
name:
description: task name
required: true
runs:
using: "composite"
steps:
- uses: actions/setup-python@v5
if: ${{ runner.os == 'macOS' }}
with:
python-version: ${{ runner.arch == 'ARM64' && '3.11.7' || '3.9.14' }}
- name: Finish python setup
if: ${{ runner.os == 'macOS' }}
shell: bash
run: |
python3 -m pip install pip==20.3.4 wheel==0.37.0 --upgrade
- name: Artifact
id: artifacts
shell: bash
run: |
python3 CI/run.py --artifacts "${{ inputs.name }}" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
if: ${{ steps.artifacts.outputs.key }}
id: cache
with:
path: ${{ join(fromJSON(steps.artifacts.outputs.path), '\n') }}
key: ${{ steps.artifacts.outputs.key }}
enableCrossOsArchive: true
- uses: ./.github/actions/mounts
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
with:
name: ${{ inputs.name }}
- name: ${{ inputs.name }}
shell: bash
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: |
python3 CI/run.py --cache cache --no-recurse --out . "${{ inputs.name }}"
207 changes: 207 additions & 0 deletions .github/workflows/env-tools.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
# TODO: https://stackoverflow.com/questions/59180385/using-an-array-of-values-to-repeat-a-step-in-github-actions-workflow
name: environment and tools
on: [push]
jobs:
docker-base:
if: ${{ github.sha == '1' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
cat <<'EOF'
${{ toJSON(github) }}
EOF
- uses: ./.github/actions/task
with:
name: "docker image: base"

docker:
if: ${{ github.sha == '1' }}
needs: docker-base
strategy:
fail-fast: false
matrix:
image:
- build
- build-tools
- test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/task
with:
name: "docker image: ${{ matrix.image }}"

msys-base:
if: ${{ github.sha == '1' }}
runs-on: ubuntu-latest
needs: docker-base
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/task
with:
name: "msys2 image: base x86_64"

msys:
if: ${{ github.sha == '1' }}
strategy:
fail-fast: false
matrix:
image:
- build
- test
runs-on: windows-latest
needs: msys-base
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/task
with:
name: "msys2 image: ${{ matrix.image }} x86_64"

git:
if: ${{ github.sha == '1' }}
strategy:
fail-fast: false
matrix:
version:
- 1.8.5
- 2.7.4
- 2.47.1
- 2.47.1.windows.1 windows x86_64
runner: [ubuntu-latest]
include:
- version: 2.47.1 macos x86_64
runner: macos-13
- version: 2.47.1 macos arm64
runner: macos-14
runs-on: ${{ matrix.runner }}
needs: docker
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/task
with:
name: git v${{ matrix.version }}

mercurial:
if: ${{ github.sha == '1' }}
strategy:
fail-fast: false
matrix:
version:
- 1.9.3
- 2.5.4
- 3.4.2
- 6.8
runner: [ubuntu-latest]
include:
- version: 6.8 windows x86_64
runner: windows-latest
- version: 6.8 macos x86_64
runner: macos-13
- version: 6.8 macos arm64
runner: macos-14
runs-on: ${{ matrix.runner }}
needs: [docker, msys]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/task
with:
name: hg v${{ matrix.version }}

git-cinnabar:
if: ${{ !cancelled() }}
strategy:
fail-fast: false
matrix:
type:
- linux arm64
- linux x86_64
- linux x86_64 asan
- linux x86_64 coverage
- windows x86_64
runner: [ubuntu-latest]
include:
- type: macos x86_64
runner: macos-13
- type: macos arm64
runner: macos-14
runs-on: ${{ matrix.runner }}
needs: docker
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/task
with:
name: build ${{ matrix.type }}

cram:
if: ${{ !cancelled() }}
strategy:
fail-fast: false
matrix:
type:
- git-2.47.1 hg-6.8
- git-2.47.1 hg-6.8 asan
runner: [ubuntu-latest]
include:
- type: git-2.47.1 hg-6.8 macos x86_64
runner: macos-13
- type: git-2.47.1 hg-6.8 macos arm64
runner: macos-14
runs-on: ${{ matrix.runner }}
needs: [docker, git, mercurial, git-cinnabar]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/task
with:
name: cram w/ ${{ matrix.type }}

download:
if: ${{ !cancelled() }}
strategy:
fail-fast: false
matrix:
include:
- type: linux x86_64
runner: ubuntu-latest
- type: macos x86_64
runner: macos-13
- type: macos arm64
runner: macos-14
- type: windows x86_64
runner: windows-latest
runs-on: ${{ matrix.runner }}
needs: [docker, git, git-cinnabar, msys]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/task
with:
name: download build ${{ matrix.type }}

hg-clone:
if: ${{ !cancelled() }}
needs: [docker, mercurial]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/task
with:
name: hg clone w/ 6.8

clone:
if: ${{ !cancelled() }}
needs: [git, git-cinnabar, hg-clone]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/task
with:
name: clone w/ ${{ github.sha }}

env:
runs-on: ubuntu-latest
steps:
- shell: bash
run: |
cat<<'EOF'
${{ toJSON(github) }}
EOF
106 changes: 0 additions & 106 deletions .github/workflows/rust.yml

This file was deleted.

Loading

0 comments on commit 7d61449

Please sign in to comment.