Skip to content

Commit 63eaab0

Browse files
committed
[CI] Add tag release workflow
1 parent 3e427db commit 63eaab0

2 files changed

Lines changed: 68 additions & 1 deletion

File tree

.github/workflows/tag_release.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Build & Push Docker Image on Tag
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
build:
10+
runs-on: self-hosted
11+
12+
permissions:
13+
contents: read
14+
packages: write
15+
id-token: write
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Log in to GitHub Container Registry
22+
uses: docker/login-action@v3
23+
with:
24+
registry: ghcr.io
25+
username: ${{ github.actor }}
26+
password: ${{ secrets.GITHUB_TOKEN }}
27+
28+
- name: Set Tag Environment
29+
run: |
30+
echo "IMAGE_TAG=torchsim-ci:${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
31+
echo "GITHUB_SHA=$GITHUB_SHA" >> $GITHUB_ENV
32+
echo "GITHUB_SHA=$GITHUB_SHA"
33+
34+
- name: Pull Cached Image & Set environment
35+
env:
36+
GIT_ACCESS_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }}
37+
run: |
38+
docker pull ghcr.io/psal-postech/torchsim_base:latest || echo "No cache available"
39+
gem5_response_file=/tmp/releases-gem5-latest.json
40+
response=$(curl -sH "Authorization: Bearer ${GIT_ACCESS_TOKEN}" https://api.github.com/repos/PSAL-POSTECH/GEM5/releases/latest > ${gem5_response_file} )
41+
GEM5_ASSET_ID=$(cat ${gem5_response_file} | jq ".assets[0]."id"")
42+
echo "GEM5_ASSET_ID=$GEM5_ASSET_ID"
43+
echo "GEM5_ASSET_ID=$GEM5_ASSET_ID" >> $GITHUB_ENV
44+
45+
llvm_response_file=/tmp/releases-gem5-latest.json
46+
response=$(curl -sH "Authorization: Bearer ${GIT_ACCESS_TOKEN}" https://api.github.com/repos/PSAL-POSTECH/llvm-project/releases/latest > ${llvm_response_file} )
47+
LLVM_ASSET_ID=$(cat ${llvm_response_file} | jq ".assets[0]."id"")
48+
echo "LLVM_ASSET_ID=$LLVM_ASSET_ID"
49+
echo "LLVM_ASSET_ID=$LLVM_ASSET_ID" >> $GITHUB_ENV
50+
51+
mkdir -p /tmp/torchsim-ci/${GITHUB_SHA}
52+
echo "DUMP_PATH=/tmp/torchsim-ci/${GITHUB_SHA}"
53+
54+
- name: Build and Push Docker Image
55+
uses: docker/build-push-action@v4
56+
env:
57+
GIT_ACCESS_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }}
58+
with:
59+
context: .
60+
file: ./Dockerfile
61+
push: true
62+
build-args: |
63+
GEM5_ASSET_ID=${{ env.GEM5_ASSET_ID }}
64+
LLVM_ASSET_ID=${{ env.LLVM_ASSET_ID }}
65+
GIT_ACCESS_TOKEN=${{ env.GIT_ACCESS_TOKEN }}
66+
TORCHSIM_SHA=${{ env.GITHUB_SHA }}
67+
tags: ghcr.io/psal-postech/${{ env.IMAGE_TAG}}

experiments/artifact/speedup/scripts/ils_parser.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ while IFS= read -r line; do
1919
gem5_time=$(grep "Simulation time:" "$sto_log_path" | \
2020
sed -E 's/^Simulation time: ([0-9.]+) seconds$/\1/')
2121
echo "GEM5: $gem5_time"
22-
total_gem5=$(echo "$total_gem5 + $gem5_time" | bc)
22+
total_gem5=$(awk -v a="$total_gem5" -v b="$gem5_time" 'BEGIN {printf "%.6f", a+b}')
2323
fi
2424
fi
2525
if [[ "$line" == *"Simulation time:"* ]]; then

0 commit comments

Comments
 (0)