Add trigger #41
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
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions | |
# See also: https://github.com/marketplace/actions/bazel-action | |
name: XLS Modules | |
on: | |
# Avoid triggering on pushes to /all/ open PR branches. | |
push: | |
branches: | |
- main | |
- mczyz/test-dslx-dma-rebase-axi | |
paths-ignore: | |
# Do not trigger action when docs are updated. | |
- 'docs/**' | |
pull_request: | |
branches: | |
- main | |
# This lets us trigger manually from the UI. | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
env: | |
XLS_MODULE: //xls/modules/dma | |
XLS_MODULE_NAME: dma | |
# Intensive runs can cause the runner to starve and crash | |
BAZEL_RESOURCES_OPT: "--local_cpu_resources=HOST_CPUS-1 --local_ram_resources=HOST_RAM*.9" | |
CACHE_KEY: bazel-cache-dma-${{ github.sha }} | |
CACHE_RESTORE_KEY: bazel-cache-dma | |
jobs: | |
build: | |
name: BUILD | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 600 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Bazel Cache | |
uses: actions/cache@v4 | |
with: | |
path: "~/.cache/bazel" | |
key: ${{ env.CACHE_KEY }} | |
restore-keys: ${{ env.CACHE_RESTORE_KEY }} | |
- name: Increase build space | |
run: | | |
echo "Before cleanup" | |
df -H | |
sudo rm -rf /usr/share/dotnet/* | |
sudo rm -rf /usr/local/lib/android/* | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /opt/ghc | |
sudo rm -rf "/usr/local/share/boost" | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
echo "After cleanup" | |
df -H | |
- name: Install dependencies via apt | |
run: sudo apt-get -qy --no-install-recommends install \ | |
build-essential \ | |
gfortran \ | |
libblas-dev \ | |
liblapack-dev \ | |
libtinfo5 \ | |
python-is-python3 \ | |
python3-dev \ | |
python3-distutils | |
- name: Bazel Build Tools (opt) | |
run: | | |
bazel build -c opt --test_output=errors -- \ | |
//xls/dslx:interpreter_main \ | |
//xls/dslx/ir_convert:ir_converter_main \ | |
//xls/tools:opt_main \ | |
//xls/tools:codegen_main \ | |
//xls/dslx:dslx_fmt | |
config-matrix: | |
needs: build | |
name: Matrix configuration | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 60 | |
outputs: | |
json_config: ${{ env.json_config }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Read json file | |
id: read-json | |
run: | | |
sudo apt install jq | |
echo "json_config=$(jq -c . .github/workflows/xls-modules.json)" | tee -a "$GITHUB_ENV" | |
- name: Validate json | |
id: validate-json | |
run: | | |
python .github/scripts/validate_json.py | |
implement: | |
needs: config-matrix | |
name: Implementation | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 600 | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson( needs.config-matrix.outputs.json_config ) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Increase build space | |
run: | | |
echo "Before cleanup" | |
df -H | |
sudo rm -rf /usr/share/dotnet/* | |
sudo rm -rf /usr/local/lib/android/* | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /opt/ghc | |
sudo rm -rf "/usr/local/share/boost" | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
echo "After cleanup" | |
df -H | |
- name: Bazel Cache | |
uses: actions/cache@v4 | |
with: | |
path: "~/.cache/bazel" | |
key: ${{env.CACHE_KEY}} | |
restore-keys: ${{env.CACHE_RESTORE_KEY}} | |
# - name: Implement CSR | |
# id: implementation | |
# uses: ./.github/actions/implementation | |
# with: | |
# xls_module: ${{ matrix.module.xls_module }} | |
# rule_ir: ${{ matrix.module.rule_ir }} | |
# rule_verilog: ${{ matrix.module.rule_verilog }} | |
# rule_synthesis: ${{ matrix.module.rule_synthesis }} | |
# rule_pnr: ${{ matrix.module.rule_pnr }} | |
test: | |
needs: build | |
name: Test | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 600 | |
strategy: | |
fail-fast: false | |
matrix: | |
dslx_test: ["test_common", | |
"test_csr", | |
"test_axi_csr", | |
"test_address_generator", | |
"test_frontend_writer", | |
"test_frontend_reader", | |
"test_main_controller" | |
] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Bazel Cache | |
uses: actions/cache@v4 | |
with: | |
path: "~/.cache/bazel" | |
key: ${{env.CACHE_KEY}} | |
restore-keys: ${{env.CACHE_RESTORE_KEY}} | |
- name: Test | |
run: | | |
bazel run -c opt --test_output=errors -- ${{env.XLS_MODULE}}:${{ matrix.dslx_test }} | |
format: | |
name: Format | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 600 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Bazel Cache | |
uses: actions/cache@v4 | |
with: | |
path: "~/.cache/bazel" | |
key: ${{env.CACHE_KEY}} | |
restore-keys: ${{env.CACHE_RESTORE_KEY}} | |
# Once https://github.com/google/xls/issues/1285 is implemented, | |
# we could replace these with a single rule | |
- name: Test formatting | |
run: | | |
bazel run -c opt --test_output=errors -- \ | |
//xls/modules/dma:fmt_address_generator \ | |
//xls/modules/dma:fmt_axi_csr \ | |
//xls/modules/dma:fmt_common \ | |
//xls/modules/dma:fmt_config \ | |
//xls/modules/dma:fmt_csr \ | |
//xls/modules/dma:fmt_fifo \ | |
//xls/modules/dma:fmt_frontend_reader \ | |
//xls/modules/dma:fmt_frontend_writer \ | |
//xls/modules/dma:fmt_gpf \ | |
//xls/modules/dma:fmt_main_controller \ | |
//xls/modules/dma:fmt_bus_axi_pkg \ | |
//xls/modules/dma:fmt_bus_axi_st_pkg \ |