Update actions for kurobako benchmarks #67
Workflow file for this run
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: Run Ackley benchmark | |
on: | |
pull_request: | |
paths: | |
- '.github/workflows/benchmark-ackley.yml' | |
- '_benchmarks/runner.sh' | |
- 'cmaes/**.go' | |
- 'tpe/**.go' | |
jobs: | |
benchmarks-ackley: | |
name: Run kurobako benchmark | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
cache: true | |
id: go | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
architecture: 'x64' | |
- run: python -V | |
- run: pip install -U pip | |
- run: pip install kurobako optuna cma | |
- name: Cache kurobako CLI | |
id: cache-kurobako | |
uses: actions/cache@v3 | |
with: | |
path: ./kurobako | |
key: kurobako-0-2-10 | |
- name: Download kurobako CLI | |
if: steps.cache-kurobako.outputs.cache-hit != 'true' | |
run: | | |
curl -L https://github.com/sile/kurobako/releases/download/0.2.10/kurobako-0.2.10.linux-amd64 -o kurobako | |
chmod +x kurobako | |
./kurobako -h | |
- run: go get github.com/sile/kurobako-go | |
- name: Run benchmarks of Ackley function | |
env: | |
KUROBAKO: ./kurobako | |
REPEATS: 10 | |
BUDGET: 100 | |
SOLVERS: all | |
run: ./_benchmarks/runner.sh ackley ./kurobako-report.json | |
- name: Plot kurobako result | |
uses: c-bata/github-actions-kurobako/plot@v3 | |
id: kurobako-plot | |
with: | |
report-json-path: './kurobako-report.json' | |
error-bar: 'true' | |
- name: Generate kurobako markdown report | |
run: cat ./kurobako-report.json | ./kurobako report > ./kurobako-report.md | |
- name: Set HAS_SECRET flag | |
env: | |
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} | |
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }} | |
run: | | |
if [ ! -z $GCP_PROJECT_ID ] && [ ! -z $GCP_SA_KEY ]; then | |
echo "HAS_SECRET=1" >> $GITHUB_ENV | |
else | |
echo "HAS_SECRET=0" >> $GITHUB_ENV | |
fi | |
- run: echo $HAS_SECRET | |
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master | |
if: ${{ env.HAS_SECRET == 1 }} | |
with: | |
version: '275.0.0' | |
service_account_key: ${{ secrets.GCP_SA_KEY }} | |
- run: gcloud info | |
if: ${{ env.HAS_SECRET == 1 }} | |
- run: gcloud config set project ${{ secrets.GCP_PROJECT_ID }} | |
if: ${{ env.HAS_SECRET == 1 }} | |
- name: Upload an image to google cloud storage | |
run: gsutil cp ${{ steps.kurobako-plot.outputs.image-path }} gs://kurobako-reports/${{ github.repository }}/ackley-${{ github.sha }}.png | |
if: ${{ env.HAS_SECRET == 1 }} | |
- name: Comment to a pull request | |
if: ${{ env.HAS_SECRET == 1 }} | |
uses: c-bata/github-actions-kurobako@v2 | |
with: | |
report-md-path: './kurobako-report.md' | |
public-image-url: https://storage.googleapis.com/kurobako-reports/${{ github.repository }}/ackley-${{ github.sha }}.png | |
title: 'Benchmark result of Ackley function' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- run: mv ./kurobako-report.json ./kurobako-report-ackley.json | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: kurobako-report | |
path: kurobako-report-ackley.json | |
- run: mv ${{ steps.kurobako-plot.outputs.image-path }} ackley.png | |
if: ${{ env.HAS_SECRET == 0 }} | |
- run: mv ./kurobako-report.md ./kurobako-report-ackley.md | |
if: ${{ env.HAS_SECRET == 0 }} | |
- uses: actions/upload-artifact@v2 | |
if: ${{ env.HAS_SECRET == 0 }} | |
with: | |
name: kurobako-report | |
path: ackley.png | |
- uses: actions/upload-artifact@v2 | |
if: ${{ env.HAS_SECRET == 0 }} | |
with: | |
name: kurobako-report | |
path: kurobako-report-ackley.md |