-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
591 additions
and
224 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Decision | ||
description: Decision | ||
outputs: | ||
data: | ||
description: Decision data | ||
value: ${{ steps.decision.outputs.data }} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Decision | ||
id: decision | ||
shell: bash | ||
run: | | ||
python3 CI/run.py --decision | tee -a $GITHUB_OUTPUT | ||
- run: | | ||
cat<<'EOF' | ||
${{ toJSON(steps.decision.outputs) }} | ||
EOF | ||
shell: bash | ||
- 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: Check dependencies | ||
if: ${{ steps.dependencies.outputs.data }} | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
const cache = require('@actions/cache'); | ||
const data = ${{ toJSON(fromJSON(steps.decision.outputs.data)) }}; | ||
for (const mount of data) { | ||
if (await cache.restoreCache([path.basename(mount.artifact)], mount.key, [], { lookupOnly: true }, true)) { | ||
console.log(`Cache restored from key: ${mount.key}`); | ||
} else { | ||
core.setFailed(`Failed to restore cache from key: ${mount.key}`); | ||
} | ||
} |
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
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}`); | ||
} | ||
} |
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
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 }}" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,261 @@ | ||
# 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: | ||
decision: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
data: ${{ steps.decision.outputs.data }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/decision | ||
id: decision | ||
|
||
docker-base: | ||
if: ${{ github.sha == '1' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/task | ||
with: | ||
name: "docker image: base" | ||
|
||
docker: | ||
if: ${{ !cancelled() }} | ||
needs: [decision, docker-base] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: ${{ fromJSON(needs.decision.outputs.data)[github.job] }} | ||
runs-on: ${{ matrix.runner }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/task | ||
with: | ||
name: "${{ matrix.task }}" | ||
|
||
# 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: ${{ github.sha == '1' }} | ||
# 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 }} | ||
# | ||
# graft-tests: | ||
# 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, git-cinnabar, mercurial, clone, hg-clone] | ||
# steps: | ||
# - uses: actions/checkout@v4 | ||
# - uses: ./.github/actions/task | ||
# with: | ||
# name: graft tests w/ ${{ matrix.type }} | ||
# | ||
# tests: | ||
# if: ${{ !cancelled() }} | ||
# strategy: | ||
# fail-fast: false | ||
# matrix: | ||
# type: | ||
# - git-2.47.1 hg-6.8 | ||
# - git-2.47.1 hg-6.8 asan | ||
# - git-2.47.1 hg-3.4.2 | ||
# - git-2.47.1 hg-2.5.4 | ||
# - git-2.47.1 hg-1.9.3 | ||
# - git-2.7.4 hg-6.8 asan | ||
# - git-1.8.5 hg-6.8 | ||
# 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 | ||
# - type: git-2.47.1 hg-6.8 windows x86_64 | ||
# runner: windows-latest | ||
# runs-on: ${{ matrix.runner }} | ||
# needs: [docker, git, git-cinnabar, mercurial, clone, hg-clone] | ||
# steps: | ||
# - uses: actions/checkout@v4 | ||
# - uses: ./.github/actions/task | ||
# with: | ||
# name: test w/ ${{ matrix.type }} | ||
# | ||
# env: | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - shell: bash | ||
# run: | | ||
# env | ||
# cat<<'EOF' | ||
# ${{ toJSON(github) }} | ||
# EOF |
Oops, something went wrong.