Skip to content

CI

CI #694

Workflow file for this run

name: CI
on:
# Runs on all pushes to branches
push:
# Runs on all PRs
pull_request:
# Runs every day at midnight UTC
schedule:
- cron: "0 0 * * *"
# Manual Dispatch
workflow_dispatch:
jobs:
pdk_build:
name: Fetch or Build PDK
runs-on: ubuntu-20.04
outputs:
design_matrix: ${{ steps.set-matrix.outputs.design_matrix }}
issue_regression_matrix: ${{ steps.set-matrix.outputs.issue_regression_matrix }}
steps:
- uses: actions/checkout@v2
- name: Set up environment variables
uses: ./.github/actions/set_env_variables
- name: Build (or Get) PDK
run: |
sudo mkdir -p ${{ env.PDK_ROOT }}
sudo chown -R $USER:$USER ${{ env.PDK_ROOT }}
go get -u github.com/tcnksm/ghr
export PATH=$PATH:$(go env GOPATH)/bin
python3 -m pip install --upgrade --no-cache-dir volare
export OPDKS_VER="$(python3 ./dependencies/tool.py open_pdks -f commit)"
if [ "${{ secrets.VOLARE_REPO }}" != "" ]; then
volare enable_or_build\
--also-push\
--token ${{ secrets.MY_TOKEN }}\
--owner ${{ secrets.VOLARE_OWNER }}\
--repository ${{ secrets.VOLARE_REPO }}\
-j$(nproc)\
$OPDKS_VER
else
volare enable_or_build\
--token ${{ secrets.MY_TOKEN }}\
-j$(nproc)\
$OPDKS_VER
fi
- name: Tarball PDK
run: |
tar -cf /tmp/sky130A.tar -C $PDK_ROOT/sky130A .
- name: Upload PDK Tarball
uses: actions/upload-artifact@v2
with:
name: pdk-tarball
path: /tmp/sky130A.tar
- name: Determine If Running Extended Test Set
run: |
export EVENT_NAME=${{ github.event_name }};
python3 ./.github/scripts/determine_test_set.py
- name: Prepare Test Matrices
id: set-matrix
run: |
if [[ "$USE_ETS" = "1" ]]; then
echo "::set-output name=design_matrix::$(python3 ./.github/test_sets/get_test_matrix.py fastest_test_set extended_test_set)"
else
echo "::set-output name=design_matrix::$(python3 ./.github/test_sets/get_test_matrix.py fastest_test_set)"
fi
echo "::set-output name=issue_regression_matrix::$(python3 ./run_issue_regressions.py get_matrix)"
docker_build_amd64:
name: Docker Build (amd64)
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Build
uses: ./.github/actions/docker_build
with:
arch: amd64
dockerhub_user: ${{ secrets.DOCKERHUB_USER }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
docker_build_arm64v8:
name: Docker Build (arm64v8)
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Build
uses: ./.github/actions/docker_build
with:
arch: arm64v8
dockerhub_user: ${{ secrets.DOCKERHUB_USER }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
issue_regression_test:
name: Regression Test (Issue ${{ matrix.design }})
needs: [docker_build_amd64, pdk_build]
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.pdk_build.outputs.issue_regression_matrix) }}
steps:
- uses: actions/checkout@v2
- name: Set up environment variables
uses: ./.github/actions/set_env_variables
- name: Download Docker Image
uses: actions/download-artifact@v2
with:
name: docker-image-amd64
path: /tmp
- name: Import Docker Image
run: docker load --input /tmp/image-amd64.tar
- name: Download PDK Tarball
uses: actions/download-artifact@v2
with:
name: pdk-tarball
path: /tmp
- name: Unpack PDK Tarball
run: |
sudo mkdir -p ${{ env.PDK_ROOT }}/sky130A
sudo chown -R $USER:$USER ${{ env.PDK_ROOT }}
tar -xf /tmp/sky130A.tar -C $PDK_ROOT/sky130A .
- name: Get Pyyaml
run: python3 -m pip install pyyaml
- name: Run Issue Regression Test
run: cd ${GITHUB_WORKSPACE}/ && make run_issue_regression ISSUE_REGRESSION_DESIGN=${{ matrix.design }}
# Each test has two components: a fast test set and an extended test set.
# The fast test set is run on all PRs, etc. The extended test set runs on schedule.
test:
name: Test Design ${{ matrix.design }}
needs: [docker_build_amd64, pdk_build]
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.pdk_build.outputs.design_matrix) }}
steps:
- uses: actions/checkout@v2
- name: Set up environment variables
uses: ./.github/actions/set_env_variables
- name: Download Docker Image (amd64)
uses: actions/download-artifact@v2
with:
name: docker-image-amd64
path: /tmp
- name: Import Docker Image
run: docker load --input /tmp/image-amd64.tar
- name: Download PDK Tarball
uses: actions/download-artifact@v2
with:
name: pdk-tarball
path: /tmp
- name: Unpack PDK Tarball
run: |
sudo mkdir -p ${{ env.PDK_ROOT }}/sky130A
sudo chown -R $USER:$USER ${{ env.PDK_ROOT }}
tar -xf /tmp/sky130A.tar -C $PDK_ROOT/sky130A .
- name: Get Pyyaml
run: python3 -m pip install pyyaml
- name: Run Test
run: |
OPENLANE_IMAGE_NAME=$OPENLANE_IMAGE_NAME-amd64\
python3 ${GITHUB_WORKSPACE}/.github/scripts/run_tests.py ${{ matrix.design }}
- name: Upload Run Tarball
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.design }}
path: ./reproducible.tar.gz
cleanup_and_deploy:
name: Cleanup (and Possibly Deployment)
needs:
[docker_build_amd64, docker_build_arm64v8, test, issue_regression_test]
if: always()
runs-on: ubuntu-20.04
steps:
- name: Check If Going To Push An Image To Docker
# # Uncomment the next line if you want to only build & push a container if entire test set succeeds
# if: needs.test.result == 'success'
# Ruby snippet to print 0 if this is a PR or if there is no DOCKERHUB_USER secret set, otherwise, 1
run: |
export PUSHING=$(ruby -e 'if ("${{ github.event_name }}" != "pull_request" && "${{ secrets.DOCKERHUB_USER }}" != ""); print(1) else print(0) end')
echo "PUSHING=$PUSHING" >> $GITHUB_ENV
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up environment variables
uses: ./.github/actions/set_env_variables
- name: Download Docker Image (amd64)
uses: actions/download-artifact@v2
with:
name: docker-image-amd64
path: /tmp
- name: Download Docker Image (arm64v8)
uses: actions/download-artifact@v2
with:
name: docker-image-arm64v8
path: /tmp
- name: Delete Docker Image (amd64)
uses: geekyeggo/delete-artifact@v1
with:
name: docker-image-amd64
- name: Delete Docker Image (arm64v8)
uses: geekyeggo/delete-artifact@v1
with:
name: docker-image-arm64v8
- name: Delete PDK
uses: geekyeggo/delete-artifact@v1
with:
name: pdk-tarball
- name: Write Main Branch
run: |
echo "MAIN_BRANCH=${{ secrets.MAIN_BRANCH }}" >> $GITHUB_ENV
- name: Write Hash
run: |
echo "GIT_COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: Import Docker Images
if: ${{ env.PUSHING == '1' }}
run: |
for arch in amd64 arm64v8; do
docker load --input /tmp/image-$arch.tar
done
- name: Create Tag (If scheduled or dispatched)
if: ${{ env.PUSHING == '1' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && env.BRANCH_NAME == env.MAIN_BRANCH }}
run: cd ${GITHUB_WORKSPACE}/ && python3 ${GITHUB_WORKSPACE}/.github/scripts/generate_tag.py
- name: Tag Commit (If scheduled or dispatched)
if: ${{ env.PUSHING == '1' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && env.NEW_TAG != 'NO_NEW_TAG' }}
uses: tvdias/[email protected]
with:
tag: "${{ env.NEW_TAG }}"
repo-token: "${{ secrets.MY_TOKEN }}"
- name: Login to DockerHub
if: ${{ env.PUSHING == '1' }}
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Start Tag List
if: ${{ env.PUSHING == '1' }}
run: |
echo "TAG_LIST=" >> $GITHUB_ENV
- name: Docker Tag (Main Branch Hashes)
if: ${{ env.PUSHING == '1' && github.event_name == 'push' && env.BRANCH_NAME == env.MAIN_BRANCH }}
run: |
echo "TAG_LIST=$TAG_LIST ${{ env.GIT_COMMIT_HASH }}" >> $GITHUB_ENV
- name: Docker Tag (Branches)
if: ${{ env.PUSHING == '1' && github.event_name == 'push' }}
run: |
echo "TAG_LIST=$TAG_LIST ${{ env.BRANCH_NAME }}" >> $GITHUB_ENV
- name: Docker Push (Version Tag/Latest)
if: ${{ env.PUSHING == '1' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && env.NEW_TAG != 'NO_NEW_TAG' }}
run: |
echo "TAG_LIST=$TAG_LIST ${{ env.NEW_TAG }} latest" >> $GITHUB_ENV
- name: Docker Pushes
if: ${{ env.PUSHING == '1' }}
run: |
for tag in $TAG_LIST; do
for arch in amd64 arm64v8; do
docker image tag ${{ env.OPENLANE_IMAGE_NAME }}-$arch ${{ secrets.DOCKER_IMAGE }}:$tag-$arch
docker push ${{ secrets.DOCKER_IMAGE }}:$tag-$arch
done
docker manifest create ${{ secrets.DOCKER_IMAGE }}:$tag\
--amend ${{ secrets.DOCKER_IMAGE }}:$tag-amd64\
--amend ${{ secrets.DOCKER_IMAGE }}:$tag-arm64v8
docker manifest push ${{ secrets.DOCKER_IMAGE }}:$tag
done