Skip to content

Commit 22bfa16

Browse files
committed
[CI] CI refactor duplicated CI
1 parent b87745a commit 22bfa16

File tree

9 files changed

+554
-2059
lines changed

9 files changed

+554
-2059
lines changed

.github/workflows/docker-base-image.yml

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@ on:
88

99
jobs:
1010
build:
11-
runs-on: self-hosted
11+
runs-on: ubuntu-latest
1212

1313
permissions:
1414
contents: read
1515
packages: write
16-
attestations: write
17-
id-token: write
1816

1917
steps:
2018
# Step 1: Checkout the repository
@@ -27,13 +25,44 @@ jobs:
2725
with:
2826
registry: ghcr.io
2927
username: ${{ github.actor }}
30-
password: ${{ secrets.GIT_ACCESS_TOKEN }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
3129

32-
# Step 4: Build and Push Docker Image
30+
# Step 2: Set environemnt
31+
- name: Set environment
32+
env:
33+
GIT_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
run: |
35+
echo "IMAGE_TAG=torchsim-ci:${GITHUB_SHA}" >> $GITHUB_ENV
36+
echo "GITHUB_SHA=${{github.event.pull_request.head.sha}}" >> $GITHUB_ENV
37+
echo "GITHUB_SHA=${{github.event.pull_request.head.sha}}"
38+
39+
gem5_response_file=/tmp/releases-gem5-latest.json
40+
curl -s https://api.github.com/repos/PSAL-POSTECH/GEM5/releases/latest > ${gem5_response_file}
41+
GEM5_ASSET_ID=$(jq ".assets[0].id" ${gem5_response_file})
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+
curl -s https://api.github.com/repos/PSAL-POSTECH/llvm-project/releases/latest > ${llvm_response_file}
47+
LLVM_ASSET_ID=$(jq ".assets[0].id" ${llvm_response_file})
48+
echo "LLVM_ASSET_ID=$LLVM_ASSET_ID"
49+
echo "LLVM_ASSET_ID=$LLVM_ASSET_ID" >> $GITHUB_ENV
50+
51+
spike_response_file=/tmp/releases-spike-latest.json
52+
curl -s https://api.github.com/repos/PSAL-POSTECH/riscv-isa-sim/releases/latest > ${spike_response_file}
53+
SPIKE_ASSET_ID=$(jq ".assets[0].id" ${spike_response_file})
54+
echo "SPIKE_ASSET_ID=$SPIKE_ASSET_ID"
55+
echo "SPIKE_ASSET_ID=$SPIKE_ASSET_ID" >> $GITHUB_ENV
56+
57+
# Step 3: Build and Push Docker Image
3358
- name: Build and Push Docker Image
3459
uses: docker/build-push-action@v4
3560
with:
3661
context: .
3762
file: ./Dockerfile.base
3863
push: true
64+
build-args: |
65+
GEM5_ASSET_ID=${{ env.GEM5_ASSET_ID }}
66+
LLVM_ASSET_ID=${{ env.LLVM_ASSET_ID }}
67+
SPIKE_ASSET_ID=${{ env.SPIKE_ASSET_ID }}
3968
tags: ghcr.io/psal-postech/torchsim_base:latest

0 commit comments

Comments
 (0)