Switch code change check to a script

This commit is contained in:
Ashton Snelgrove 2021-01-20 12:40:18 -07:00
parent effe86fb9e
commit 5f613c46f7
2 changed files with 50 additions and 51 deletions

View File

@ -1,16 +1,9 @@
name: linux_build name: linux_build
# Run CI on # Run CI on push, PR, and weekly.
# - each push if no code has changed
on: on:
push: push:
paths: pull_request:
- '**.c'
- '**.cc'
- '**.c\+\+'
- '**.cpp'
- '**.h'
- '**.hh'
schedule: schedule:
- cron: '0 0 * * 0 ' # weekly - cron: '0 0 * * 0 ' # weekly
@ -22,8 +15,27 @@ env:
# Multiple job to tests # Multiple job to tests
jobs: jobs:
change_detect:
name: "Detect code changes"
runs-on: ubuntu-18.04
outputs:
source_modified: ${{ steps.changes.outputs.status_code != '0'}}
steps:
- name: Checkout OpenFPGA repo
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: true
- name: Check for source code changes
id: changes
run: |
if ! git diff origin/master HEAD --name-status --exit-code -- . ':!openfpga_flow' ':!docs'; then
echo "::set-output name=status_code::$?"
fi
# Test the compilation compatibility # Test the compilation compatibility
linux_build: linux_build:
needs: change_detect
if: ${{needs.change_detect.outputs.source_modified || github.ref == 'refs/heads/master' }}
name: ${{ matrix.config.name }} name: ${{ matrix.config.name }}
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
container: ghcr.io/lnis-uofu/openfpga-buildenv-${{ matrix.config.cc}} container: ghcr.io/lnis-uofu/openfpga-buildenv-${{ matrix.config.cc}}
@ -141,7 +153,7 @@ jobs:
yosys/yosys-smtbmc yosys/yosys-smtbmc
docker_distribution: docker_distribution:
name: Build docker image for distribution name: Build docker image for distribution
if: ${{ github.ref == 'refs/heads/master'}} if: ${{ github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: linux_build needs: linux_build
steps: steps:
@ -175,8 +187,8 @@ jobs:
file: ./docker/Dockerfile.test file: ./docker/Dockerfile.test
push: true push: true
tags: ghcr.io/lnis-uofu/openfpga-regression-tests:latest tags: ghcr.io/lnis-uofu/openfpga-regression-tests:latest
regression_tests: artifact_regression_tests:
name: Regression tests name: Regression tests on code changes
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
container: ghcr.io/lnis-uofu/openfpga-buildenv-test container: ghcr.io/lnis-uofu/openfpga-buildenv-test
needs: linux_build needs: linux_build
@ -215,3 +227,29 @@ jobs:
- name: ${{matrix.config.name}} - name: ${{matrix.config.name}}
shell: bash shell: bash
run: source .github/workflows/${{matrix.config.script}} run: source .github/workflows/${{matrix.config.script}}
docker_regression_tests:
needs: change_detect
if: ${{ !needs.change_detect.outputs.source_modified }}
name: Regression tests against master artifacts
runs-on: ubuntu-18.04
container: ghcr.io/lnis-uofu/openfpga-regression-tests:latest
strategy:
fail-fast: false
matrix:
config:
- name: "Basic Regression Tests: GCC-8 (Ubuntu 18.04)"
script: basic_reg_test.sh
- name: "FPGA-Verilog Regression Tests: GCC-8 (Ubuntu 18.04)"
script: fpga_verilog_reg_test.sh
- name: "FPGA-Bitstream Regression Tests: GCC-8 (Ubuntu 18.04)"
script: fpga_bitstream_reg_test.sh
- name: "FPGA-SDC Regression Tests: GCC-8 (Ubuntu 18.04)"
script: fpga_sdc_reg_test.sh
- name: "FPGA-SPICE Regression Tests: GCC-8 (Ubuntu 18.04)"
script: fpga_spice_reg_test.sh
steps:
- name: Checkout OpenFPGA repo
uses: actions/checkout@v2
- name: ${{matrix.config.name}}
shell: bash
run: source .github/workflows/${{matrix.config.script}}

View File

@ -1,39 +0,0 @@
name: regression_tests
# Run regressions on each push if no code has changed
on:
push:
paths-ignore:
- '**.c'
- '**.cc'
- '**.c\+\+'
- '**.cpp'
- '**.h'
- '**.hh'
# Multiple job to tests
jobs:
regression_tests:
name: Regression tests
runs-on: ubuntu-18.04
container: ghcr.io/lnis-uofu/openfpga-regression-tests:latest
strategy:
fail-fast: false
matrix:
config:
- name: "Basic Regression Tests: GCC-8 (Ubuntu 18.04)"
script: basic_reg_test.sh
- name: "FPGA-Verilog Regression Tests: GCC-8 (Ubuntu 18.04)"
script: fpga_verilog_reg_test.sh
- name: "FPGA-Bitstream Regression Tests: GCC-8 (Ubuntu 18.04)"
script: fpga_bitstream_reg_test.sh
- name: "FPGA-SDC Regression Tests: GCC-8 (Ubuntu 18.04)"
script: fpga_sdc_reg_test.sh
- name: "FPGA-SPICE Regression Tests: GCC-8 (Ubuntu 18.04)"
script: fpga_spice_reg_test.sh
steps:
- name: Checkout OpenFPGA repo
uses: actions/checkout@v2
- name: ${{matrix.config.name}}
shell: bash
run: source .github/workflows/${{matrix.config.script}}