From 6cef569155b5934893109d4ae509c94bdd1dc16a Mon Sep 17 00:00:00 2001
From: gatecat <gatecat@ds0.me>
Date: Sat, 15 May 2021 15:49:02 +0100
Subject: ci: Use GH only for Mistral and fpga-interchange

Signed-off-by: gatecat <gatecat@ds0.me>
---
 .cirrus.yml                      |  3 +--
 .github/ci/build_mistral.sh      | 24 ++++++++++++++++++++++++
 .github/workflows/mistral_ci.yml | 33 +++++++++++++++++++++++++++++++++
 3 files changed, 58 insertions(+), 2 deletions(-)
 create mode 100644 .github/ci/build_mistral.sh
 create mode 100644 .github/workflows/mistral_ci.yml

diff --git a/.cirrus.yml b/.cirrus.yml
index 99c70ffd..86edee59 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -6,13 +6,12 @@ task:
     dockerfile: .cirrus/Dockerfile.ubuntu20.04
 
   submodule_script: git submodule sync --recursive && git submodule update --init --recursive
-  build_script: mkdir build && cd build && cmake .. -DARCH=all+alpha -DOXIDE_INSTALL_PREFIX=$HOME/.cargo -DBUILD_TESTS=on -DBUILD_GUI=on -DWERROR=on && make -j3
+  build_script: mkdir build && cd build && cmake .. -DARCH='ecp5;generic;gowin;ice40;machxo2;nexus' -DOXIDE_INSTALL_PREFIX=$HOME/.cargo -DBUILD_TESTS=on -DBUILD_GUI=on -DWERROR=on && make -j3
   test_generic_script: cd build && ./nextpnr-generic-test
   flow_test_generic_script: export NPNR=$(pwd)/build/nextpnr-generic && cd tests/generic/flow && ./run.sh
   test_ice40_script: cd build && ./nextpnr-ice40-test
   smoketest_ice40_script: export NEXTPNR=$(pwd)/build/nextpnr-ice40 && cd ice40/smoketest/attosoc && ./smoketest.sh
   test_ecp5_script: cd build && ./nextpnr-ecp5-test
-  test_fpga_interchange_script: cd build && ./nextpnr-fpga_interchange-test
   smoketest_generic_script: export NEXTPNR=$(pwd)/build/nextpnr-generic && cd generic/examples && ./simple.sh && ./simtest.sh
   regressiontest_ice40_script: make -j $(nproc) -C tests/ice40/regressions NPNR=$(pwd)/build/nextpnr-ice40
   regressiontest_ecp5_script: make -j $(nproc) -C tests/ecp5/regressions NPNR=$(pwd)/build/nextpnr-ecp5
diff --git a/.github/ci/build_mistral.sh b/.github/ci/build_mistral.sh
new file mode 100644
index 00000000..7046462f
--- /dev/null
+++ b/.github/ci/build_mistral.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+function get_dependencies {
+    # Fetch mistral
+    mkdir -p ${MISTRAL_PATH}
+    git clone --recursive https://github.com/Ravenslofty/mistral.git ${MISTRAL_PATH}
+    pushd ${MISTRAL_PATH}
+    git reset --hard ${MISTRAL_REVISION}
+    popd
+}
+
+function build_nextpnr {
+    mkdir build
+    pushd build
+    cmake .. -DARCH=mistral -DMISTRAL_ROOT=${MISTRAL_PATH}
+    make nextpnr-mistral -j`nproc`
+    popd
+}
+
+function run_archcheck {
+    pushd build
+    ./nextpnr-mistral --mistral ${MISTRAL_PATH} --device 5CEBA2F17A7 --test
+    popd
+}
diff --git a/.github/workflows/mistral_ci.yml b/.github/workflows/mistral_ci.yml
new file mode 100644
index 00000000..877e374d
--- /dev/null
+++ b/.github/workflows/mistral_ci.yml
@@ -0,0 +1,33 @@
+name: Mistral CI tests
+
+on: [push, pull_request]
+
+jobs:
+  Build-nextpnr:
+    runs-on: ubuntu-latest
+    steps:
+
+    - uses: actions/checkout@v2
+      with:
+        submodules: recursive
+
+    - uses: actions/setup-python@v2
+
+    - name: Install
+      run: |
+        sudo apt-get update
+        sudo apt-get install git make cmake libboost-all-dev python3-dev libeigen3-dev tcl-dev lzma-dev clang bison flex swig
+
+    - name: ccache
+      uses: hendrikmuhs/ccache-action@v1
+
+    - name: Execute build nextpnr
+      env:
+        MISTRAL_PATH: ${{ github.workspace }}/deps/mistral
+        MISTRAL_REVISION: 7d4e6d2cca1ec05de3be0c9fef6acaed8089d329
+      run: |
+        export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
+        source ./.github/ci/build_mistral.sh
+        get_dependencies
+        build_nextpnr
+        run_archcheck
-- 
cgit v1.2.3