-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* wip: two workflow files * feat: first check diffed file * chore: build and deploy ci on push to main * chore: build test ci on pr * chore: finalize build script * chore: finalize check * chore: check all supported languages * chore: add label
- Loading branch information
1 parent
59d7448
commit 447a2bd
Showing
2 changed files
with
126 additions
and
0 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,67 @@ | ||
name: Build benchmark images | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
||
jobs: | ||
find-targets: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 2 | ||
- id: find-targets | ||
run: | | ||
projects=$(git diff --name-only HEAD^ HEAD | grep -e "^OCaml/" -e "^Java/" -e "^C/" -e "^Solidity/" | cut -d '/' -f 1-2 | sort | uniq | xargs -I{prj} echo \"{prj}\" | tr '\n' ',' | sed 's/,*$//') | ||
echo "targets=[$projects]" >> ${GITHUB_OUTPUT} | ||
outputs: | ||
targets: ${{ steps.find-targets.outputs.targets }} | ||
|
||
build-and-deploy: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
needs: | ||
- find-targets | ||
|
||
if: always() && needs.find-targets.outputs.targets != '[]' | ||
|
||
strategy: | ||
matrix: | ||
target: ${{ fromJSON(needs.find-targets.outputs.targets) }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Read metadata | ||
id: read-metadata | ||
run: | | ||
content=$(cat ${{ matrix.target }}/metadata.json) | ||
content="${content//$'\n'/''}" | ||
echo "language=$(echo $content | jq -r .language)" >> ${GITHUB_OUTPUT} | ||
echo "id=$(echo $content | jq -r .id)" >> ${GITHUB_OUTPUT} | ||
- run: | | ||
echo "${{steps.read-metadata.outputs.metadata}}" | ||
- uses: docker/setup-buildx-action@v3 | ||
- uses: docker/build-push-action@v5 | ||
with: | ||
context: ${{ matrix.target }} | ||
file: ${{ matrix.target }}/Dockerfile | ||
platforms: linux/amd64 | ||
push: true | ||
tags: ${{ env.REGISTRY }}/kupl/starlab-benchmarks/${{ steps.read-metadata.outputs.language }}:${{ steps.read-metadata.outputs.id }} | ||
labels: | | ||
org.opencontainers.image.source="https://github.com/kupl/starlab-benchmarks" |
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,59 @@ | ||
name: Build benchmark images | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
find-targets: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- id: find-targets | ||
run: | | ||
projects=$(git diff --name-only origin/${{ github.base_ref }} origin/${{ github.head_ref }} | grep -e "^OCaml/" -e "^Java/" -e "^C/" -e "^Solidity/" | cut -d '/' -f 1-2 | sort | uniq | xargs -I{prj} echo \"{prj}\" | tr '\n' ',' | sed 's/,*$//') | ||
echo "targets=[$projects]" >> ${GITHUB_OUTPUT} | ||
outputs: | ||
targets: ${{ steps.find-targets.outputs.targets }} | ||
|
||
|
||
build-test: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
|
||
needs: | ||
- find-targets | ||
|
||
if: always() && needs.find-targets.outputs.targets != '[]' | ||
|
||
strategy: | ||
matrix: | ||
target: ${{ fromJSON(needs.find-targets.outputs.targets) }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Read metadata | ||
id: read-metadata | ||
run: | | ||
content=$(cat ${{ matrix.target }}/metadata.json) | ||
content="${content//$'\n'/''}" | ||
echo "buildCommand=$(echo $content | jq -r .buildCommand)" >> ${GITHUB_OUTPUT} | ||
- uses: docker/setup-buildx-action@v3 | ||
- uses: docker/build-push-action@v5 | ||
with: | ||
context: ${{ matrix.target }} | ||
file: ${{ matrix.target }}/Dockerfile | ||
platforms: linux/amd64 | ||
push: false | ||
tags: benchmark:latest | ||
- name: Smoke test | ||
run: | | ||
docker run --rm benchmark:latest ${{ steps.read-metadata.outputs.buildCommand }} |