split up jobs in ci #26
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: Do the thing in CI | ||
on: | ||
push: | ||
branches: ['master'] | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
jobs: | ||
run: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
build: | ||
- gcc | ||
- clang | ||
- rust | ||
- fortran | ||
- java | ||
- scala | ||
- kotlin | ||
- ruby | ||
- python3 | ||
- node | ||
- deno | ||
- bun | ||
steps: | ||
# clone | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
# cache | ||
- uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
~/.cargo/.crates.toml | ||
~/.cargo/.crates2.json | ||
target/ | ||
key: ${{ runner.os }}-cargo | ||
- uses: actions/cache@v3 | ||
with: | ||
path: scripts/node_modules | ||
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }} | ||
# install dependencies | ||
- uses: extractions/setup-just@v1 | ||
- uses: oven-sh/setup-bun@v1 | ||
- uses: denoland/setup-deno@v1 | ||
with: | ||
deno-version: "~1" | ||
- run: just setup | ||
# build | ||
- if: ${{ matrix.build == "gcc" }} | ||
Check failure on line 57 in .github/workflows/ci.yml GitHub Actions / Do the thing in CIInvalid workflow file
|
||
run: | | ||
gcc -O3 ./count.c | ||
echo './a.out' > CMD | ||
- if: ${{ matrix.build == "clang" }} | ||
run: | | ||
clang -O3 ./count.c | ||
echo './a.out' > CMD | ||
- if: ${{ matrix.build == "rust" }} | ||
run: | | ||
rustc -C opt-level=3 ./count.rs | ||
echo './count' > CMD | ||
- if: ${{ matrix.build == "fortran" }} | ||
run: | | ||
gfortran -O3 ./count.f90 | ||
echo './a.out' > CMD | ||
- if: ${{ matrix.build == "java" }} | ||
run: | | ||
javac count.java | ||
echo 'java Count' > CMD | ||
- if: ${{ matrix.build == "scala" }} | ||
run: | | ||
scalac count.scala | ||
echo 'scala Count' > CMD | ||
- if: ${{ matrix.build == "kotlin" }} | ||
run: | | ||
kotlinc count.kt -include-runtime -d count.jar | ||
echo 'java -jar count.jar' > CMD | ||
- if: ${{ matrix.build == "ruby" }} | ||
run: echo 'ruby count.rb' > CMD | ||
- if: ${{ matrix.build == "python3" }} | ||
run: echo 'python3 count.py' > CMD | ||
- if: ${{ matrix.build == "node" }} | ||
run: echo 'node count.js' > CMD | ||
- if: ${{ matrix.build == "deno" }} | ||
run: echo 'deno run count.js' > CMD | ||
- if: ${{ matrix.build == "bun" }} | ||
run: echo 'bun run count.js' > CMD | ||
# bench | ||
- run: | | ||
case "$name" in | ||
*"python"*|*"ruby"*) | ||
args="--runs 1" | ||
;; | ||
*) | ||
args="--warmup 3" | ||
;; | ||
esac | ||
out="${{ matrix.build }}.json" | ||
hyperfine $args --shell=none --export-json "$out" "$(cat CMD)" | ||
jq '.results[0] | del(.exit_codes)' "$out" | sponge "$out" | ||
timers "$f" >/dev/null 2> >(jq '. += {"max_rss":'$(rg -oP '(?:max_rss:\s*)(\d+)' -r '$1')'}' "$out" | sponge "$out") | ||
# report | ||
- run: ls -lah . | ||
- run: ls -lah results | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: "${{ matrix.build }}.json" | ||
path: "results/${{ matrix.build }}" | ||
report: | ||
needs: ['run'] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: oven-sh/setup-bun@v1 | ||
- name: Download Results | ||
uses: actions/download-artifact@v2 | ||
with: | ||
path: results | ||
- run: ls -lah . | ||
- run: ls -lah results | ||
# TODO: create report |