Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 34 additions & 5 deletions .github/workflows/docker-base-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ on:

jobs:
build:
runs-on: self-hosted
runs-on: ubuntu-latest

permissions:
contents: read
packages: write
attestations: write
id-token: write

steps:
# Step 1: Checkout the repository
Expand All @@ -27,13 +25,44 @@ jobs:
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GIT_ACCESS_TOKEN }}
password: ${{ secrets.GITHUB_TOKEN }}

# Step 4: Build and Push Docker Image
# Step 2: Set environemnt
- name: Set environment
env:
GIT_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "IMAGE_TAG=torchsim-ci:${GITHUB_SHA}" >> $GITHUB_ENV
echo "GITHUB_SHA=${{github.event.pull_request.head.sha}}" >> $GITHUB_ENV
echo "GITHUB_SHA=${{github.event.pull_request.head.sha}}"

gem5_response_file=/tmp/releases-gem5-latest.json
curl -s https://api.github.com/repos/PSAL-POSTECH/GEM5/releases/latest > ${gem5_response_file}
GEM5_ASSET_ID=$(jq ".assets[0].id" ${gem5_response_file})
echo "GEM5_ASSET_ID=$GEM5_ASSET_ID"
echo "GEM5_ASSET_ID=$GEM5_ASSET_ID" >> $GITHUB_ENV

llvm_response_file=/tmp/releases-gem5-latest.json
curl -s https://api.github.com/repos/PSAL-POSTECH/llvm-project/releases/latest > ${llvm_response_file}
LLVM_ASSET_ID=$(jq ".assets[0].id" ${llvm_response_file})
echo "LLVM_ASSET_ID=$LLVM_ASSET_ID"
echo "LLVM_ASSET_ID=$LLVM_ASSET_ID" >> $GITHUB_ENV

spike_response_file=/tmp/releases-spike-latest.json
curl -s https://api.github.com/repos/PSAL-POSTECH/riscv-isa-sim/releases/latest > ${spike_response_file}
SPIKE_ASSET_ID=$(jq ".assets[0].id" ${spike_response_file})
echo "SPIKE_ASSET_ID=$SPIKE_ASSET_ID"
echo "SPIKE_ASSET_ID=$SPIKE_ASSET_ID" >> $GITHUB_ENV

# Step 3: Build and Push Docker Image
- name: Build and Push Docker Image
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile.base
push: true
build-args: |
GEM5_ASSET_ID=${{ env.GEM5_ASSET_ID }}
LLVM_ASSET_ID=${{ env.LLVM_ASSET_ID }}
SPIKE_ASSET_ID=${{ env.SPIKE_ASSET_ID }}
tags: ghcr.io/psal-postech/torchsim_base:latest
Loading