simplify docs #5457
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: 'Tools CI Tests' | |
on: | |
# Runs on pushes to test/ branches and main | |
push: | |
branches: | |
- 'main' | |
- 'test/**' | |
# Runs on all PRs | |
pull_request: | |
# Manual Dispatch | |
workflow_dispatch: | |
# Releases of SC | |
release: | |
types: | |
- published | |
defaults: | |
run: | |
shell: bash | |
env: | |
REGISTRY: ghcr.io | |
jobs: | |
build_tool_builder: | |
name: 'Build base tool builder image' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
outputs: | |
tools_matrix: ${{ steps.docker.outputs.tools_matrix }} | |
tools_with_deps_matrix: ${{ steps.docker.outputs.tools_with_deps_matrix }} | |
sc_tools: ${{ steps.docker.outputs.sc_tools }} | |
sc_runner: ${{ steps.docker.outputs.sc_runner }} | |
has_sc_tools: ${{ steps.docker.outputs.has_sc_tools }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Read-only credentials, can be accessed by external contributors | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
- name: Generate tool docker files | |
id: docker | |
run: | | |
pip install .[docker] | |
builder_name=$(python3 setup/docker/builder.py --tool builder --registry ${{ env.REGISTRY }}) | |
sc_tools_name=$(python3 setup/docker/builder.py --tool tools --registry ${{ env.REGISTRY }}) | |
sc_runner_name=$(python3 setup/docker/builder.py --tool runner --registry ${{ env.REGISTRY }}) | |
echo "builder=${builder_name}" >> $GITHUB_OUTPUT | |
echo "has_builder=$(python3 setup/docker/builder.py --check_image ${builder_name})" >> $GITHUB_OUTPUT | |
echo "sc_tools=${sc_tools_name}" >> $GITHUB_OUTPUT | |
echo "sc_runner=${sc_runner_name}" >> $GITHUB_OUTPUT | |
echo "has_sc_tools=$(python3 setup/docker/builder.py --check_image ${sc_tools_name})" >> $GITHUB_OUTPUT | |
echo "tools_matrix=$(python3 setup/docker/builder.py --json_tools --registry ${{ env.REGISTRY }})" >> $GITHUB_OUTPUT | |
echo "tools_with_deps_matrix=$(python3 setup/docker/builder.py --json_tools --with_dependencies --registry ${{ env.REGISTRY }})" >> $GITHUB_OUTPUT | |
python3 setup/docker/builder.py --generate_files --registry ${{ env.REGISTRY }} --output_dir docker | |
- name: Upload docker artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: tools | |
path: docker/ | |
retention-days: 1 | |
# Read/write credentials, can only be accessed by repo members | |
- name: Log in to the Container registry | |
if: steps.docker.outputs.has_builder != 'true' | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ secrets.PACKAGES_ACTOR }} | |
password: ${{ secrets.PACKAGES_TOKEN }} | |
- name: Build and Push SiliconCompiler Builder Docker image | |
if: steps.docker.outputs.has_builder != 'true' | |
uses: docker/build-push-action@v5 | |
with: | |
context: docker/sc_tool_builder | |
push: true | |
tags: ${{ steps.docker.outputs.builder }} | |
build_tool: | |
if: ${{ needs.build_tool_builder.outputs.tools_matrix != '{}' }} | |
name: Build ${{ matrix.tool }} tool | |
runs-on: ubuntu-latest | |
needs: build_tool_builder | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.build_tool_builder.outputs.tools_matrix) }} | |
steps: | |
- name: Download docker artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: tools | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ secrets.PACKAGES_ACTOR }} | |
password: ${{ secrets.PACKAGES_TOKEN }} | |
- name: Build and Push Tool Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./sc_${{ matrix.tool }}/ | |
push: true | |
tags: | | |
${{ matrix.name }} | |
${{ matrix.check_name }} | |
build_tool_with_deps: | |
if: ${{ always() && needs.build_tool_builder.outputs.tools_with_deps_matrix != '{}' }} | |
name: Build ${{ matrix.tool }} tool | |
runs-on: ubuntu-latest | |
needs: [build_tool_builder, build_tool] | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.build_tool_builder.outputs.tools_with_deps_matrix) }} | |
steps: | |
- name: Download docker artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: tools | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ secrets.PACKAGES_ACTOR }} | |
password: ${{ secrets.PACKAGES_TOKEN }} | |
- name: Build and Push Tool Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./sc_${{ matrix.tool }}/ | |
push: true | |
tags: | | |
${{ matrix.name }} | |
${{ matrix.check_name }} | |
build_sc_tools: | |
if: always() && needs.build_tool_builder.outputs.has_sc_tools != 'true' | |
name: Build SC Tools | |
runs-on: ubuntu-latest | |
needs: [build_tool_builder, build_tool, build_tool_with_deps] | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Download docker artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: tools | |
- name: Free Disk Space (Ubuntu) | |
uses: jlumbroso/free-disk-space@v1.3.1 | |
with: | |
tool-cache: false | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: false | |
swap-storage: true | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ secrets.PACKAGES_ACTOR }} | |
password: ${{ secrets.PACKAGES_TOKEN }} | |
- name: Build and Push Tool Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./sc_tools/ | |
push: true | |
tags: ${{ needs.build_tool_builder.outputs.sc_tools }} | |
runner_image: | |
if: always() && github.event_name == 'release' | |
needs: [build_tool_builder, build_sc_tools] | |
name: Build SC runner image | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Download docker artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: tools | |
- name: Free Disk Space (Ubuntu) | |
uses: jlumbroso/free-disk-space@v1.3.1 | |
with: | |
tool-cache: false | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: false | |
swap-storage: true | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ secrets.PACKAGES_ACTOR }} | |
password: ${{ secrets.PACKAGES_TOKEN }} | |
- name: Retag primary image | |
run: | | |
docker pull ${{ needs.build_tool_builder.outputs.sc_tools }} | |
base_tag=$(echo ${{ needs.build_tool_builder.outputs.sc_tools }} | sed s/:.*//g) | |
latest_tag=${base_tag}:latest | |
docker tag ${{ needs.build_tool_builder.outputs.sc_tools }} $latest_tag | |
docker push $latest_tag | |
version_tag=${base_tag}:${{ github.ref_name }} | |
docker tag ${{ needs.build_tool_builder.outputs.sc_tools }} $version_tag | |
docker push $version_tag | |
runner_latest_tag=$(echo ${{ needs.build_tool_builder.outputs.sc_runner }} | sed s/:.*/:latest/g) | |
echo "RUNNER_TAG=${runner_latest_tag}" >> $GITHUB_ENV | |
- name: Build and Push Tool Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./sc_runner/ | |
push: true | |
tags: | | |
${{ needs.build_tool_builder.outputs.sc_runner }} | |
${{ env.RUNNER_TAG }} | |
tool_based_tests: | |
if: always() | |
needs: [build_tool_builder, build_sc_tools] | |
runs-on: ubuntu-latest | |
container: | |
image: ${{ needs.build_tool_builder.outputs.sc_tools }} | |
credentials: | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
timeout-minutes: 45 | |
name: 'Tool-based tests' | |
steps: | |
- name: Checkout current SiliconCompiler | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Run tests | |
run: | | |
/start_slurm.sh | |
python3 -m venv clean_env | |
source clean_env/bin/activate | |
cd $GITHUB_WORKSPACE | |
python3 -m pip install --upgrade pip | |
python3 -m pip install -e .[test,examples] | |
pytest -n auto -m "eda and quick" --cov --cov-report=xml --durations=0 | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: coverage.xml | |
name: codecov-tools | |
verbose: true | |
trigger_daily: | |
if: always() | |
needs: build_sc_tools | |
runs-on: ubuntu-latest | |
name: Trigger daily, if tools changed | |
steps: | |
- name: Checkout current SiliconCompiler | |
uses: actions/checkout@v4 | |
- name: Check tool updates | |
uses: dorny/paths-filter@v3 | |
id: changes | |
with: | |
filters: | | |
tools: | |
- 'setup/_tools.json' | |
- name: Trigger | |
if: ( steps.changes.outputs.tools == 'true' && github.event_name == 'pull_request' ) | |
uses: convictional/trigger-workflow-and-wait@v1.6.5 | |
with: | |
github_token: ${{ github.token }} | |
ref: ${{ github.event.pull_request.head.ref }} | |
owner: ${{ github.repository_owner }} | |
repo: siliconcompiler | |
workflow_file_name: daily_ci.yml | |
wait_interval: 60 | |
server_tests: | |
if: always() | |
needs: build_sc_tools | |
name: Test server | |
timeout-minutes: 90 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Server action dispatch | |
uses: convictional/trigger-workflow-and-wait@v1.6.5 | |
with: | |
github_token: ${{ secrets.ZA_TOKEN }} | |
owner: ${{ secrets.SERVER_OWNER }} | |
repo: ${{ secrets.SERVER_REPO }} | |
workflow_file_name: containers.yml | |
client_payload: '{"sc-ref": "${{ github.event.pull_request.head.ref || github.sha }}"}' | |
wait_interval: 60 |