From 9b12fdff6272320653ded2bc7f4671ed21df8999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=CC=88zgu=CC=88r=20Akgu=CC=88n?= Date: Wed, 22 Nov 2023 09:50:54 +0000 Subject: [PATCH 01/10] using a matrix configuration for github actions, just edited one of the actions for now --- .github/workflows/oxide.yml | 71 ++++++------------------------------- 1 file changed, 11 insertions(+), 60 deletions(-) diff --git a/.github/workflows/oxide.yml b/.github/workflows/oxide.yml index 29e114baf..abad53f5b 100644 --- a/.github/workflows/oxide.yml +++ b/.github/workflows/oxide.yml @@ -19,86 +19,42 @@ env: rust_release: stable jobs: - ubuntu: - name: "Conjure Oxide: Ubuntu Build" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up cache - uses: actions/cache@v3 - with: - path: - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - solvers/minion/vendor - solvers/chuffed/vendor + Job: - key: ${{ runner.os }}-${{ env.rust_release }}-${{ github.event.repository.updated_at }} - restore-keys: ${{ runner.os }}-${{ env.rust_release }}- - - - working-directory: ./conjure_oxide - run: rustup update ${{ env.rust_release }} && rustup default ${{ env.rust_release }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest] - - working-directory: ./conjure_oxide - run: cargo build -vv + runs-on: ${{ matrix.os }} - mac: - name: "Conjure Oxide: Mac Build" - runs-on: macos-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - name: Set up cache - uses: actions/cache@v3 + - uses: actions/cache@v3 with: path: ~/.cargo/bin/ ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ - target/ + target solvers/minion/vendor solvers/chuffed/vendor - + key: ${{ runner.os }}-${{ env.rust_release }}-${{ github.event.repository.updated_at }} - restore-keys: ${{ runner.os }}-${{ env.rust_release }}- + restore-keys: ${{ runner.os }}-${{ env.rust_release }} - working-directory: ./conjure_oxide run: rustup update ${{ env.rust_release }} && rustup default ${{ env.rust_release }} - working-directory: ./conjure_oxide run: rustup target add aarch64-apple-darwin + if: runner.os == 'macOS' - working-directory: ./conjure_oxide run: cargo build -vv - tests: - name: "Conjure Oxide: Tests" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Set up cache - uses: actions/cache@v3 - with: - path: - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - solvers/minion/vendor - solvers/chuffed/vendor - key: ${{ runner.os }}-${{ env.rust_release }}-${{ github.event.repository.updated_at }} - restore-keys: ${{ runner.os }}-${{ env.rust_release }}- - - - working-directory: ./conjure_oxide - run: rustup update ${{ env.rust_release }} && rustup default ${{ env.rust_release }} - - working-directory: ./conjure_oxide run: | wget https://github.com/conjure-cp/conjure/releases/download/v2.5.1/conjure-v2.5.1-linux-with-solvers.zip @@ -107,8 +63,3 @@ jobs: - working-directory: ./conjure_oxide run: cargo test - - - - - From 77c7b1bf89b77610b0ea49b7ba8ffb4d223ba8b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=CC=88zgu=CC=88r=20Akgu=CC=88n?= Date: Wed, 22 Nov 2023 10:03:11 +0000 Subject: [PATCH 02/10] only run the tests on Linux, add rust_release nightly, and a few other small changes --- .github/workflows/oxide.yml | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/.github/workflows/oxide.yml b/.github/workflows/oxide.yml index abad53f5b..bdadadbf3 100644 --- a/.github/workflows/oxide.yml +++ b/.github/workflows/oxide.yml @@ -15,8 +15,6 @@ on: - .github/workflows/oxide.yml workflow_dispatch: -env: - rust_release: stable jobs: @@ -24,7 +22,19 @@ jobs: strategy: matrix: - os: [ubuntu-latest, macos-latest] + rust_release: + - stable + - nightly + conjure_version: + - v2.5.1 + os: + - ubuntu-latest + - macos-latest + include: + - os: ubuntu-latest + release_suffix: linux + - os: macos-latest + release_suffix: macos-intel runs-on: ${{ matrix.os }} @@ -42,11 +52,11 @@ jobs: solvers/minion/vendor solvers/chuffed/vendor - key: ${{ runner.os }}-${{ env.rust_release }}-${{ github.event.repository.updated_at }} - restore-keys: ${{ runner.os }}-${{ env.rust_release }} + key: ${{ runner.os }}-${{ matrix.rust_release }}-${{ github.event.repository.updated_at }} + restore-keys: ${{ runner.os }}-${{ matrix.rust_release }} - working-directory: ./conjure_oxide - run: rustup update ${{ env.rust_release }} && rustup default ${{ env.rust_release }} + run: rustup update ${{ matrix.rust_release }} && rustup default ${{ matrix.rust_release }} - working-directory: ./conjure_oxide run: rustup target add aarch64-apple-darwin @@ -57,9 +67,11 @@ jobs: - working-directory: ./conjure_oxide run: | - wget https://github.com/conjure-cp/conjure/releases/download/v2.5.1/conjure-v2.5.1-linux-with-solvers.zip - unzip conjure-v2.5.1-linux-with-solvers.zip - echo "$(pwd)/conjure-v2.5.1-linux-with-solvers" >> ${GITHUB_PATH} + wget https://github.com/conjure-cp/conjure/releases/download/${{ matrix.conjure_version }}/conjure-${{ matrix.conjure_version }}-${{ matrix.release_suffix }}-with-solvers.zip + unzip conjure-${{ matrix.conjure_version }}-linux-with-solvers.zip + echo "$(pwd)/conjure-${{ matrix.conjure_version }}-linux-with-solvers" >> ${GITHUB_PATH} + if: runner.os == 'Linux' - working-directory: ./conjure_oxide run: cargo test + if: runner.os == 'Linux' From 166206e716b2ecd13831461a7be0eef2f44e80a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=CC=88zgu=CC=88r=20Akgu=CC=88n?= Date: Wed, 22 Nov 2023 10:10:50 +0000 Subject: [PATCH 03/10] run tests on all configs --- .github/workflows/oxide.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/oxide.yml b/.github/workflows/oxide.yml index bdadadbf3..978d56ff0 100644 --- a/.github/workflows/oxide.yml +++ b/.github/workflows/oxide.yml @@ -3,7 +3,7 @@ name: "conjure-oxide" on: push: branches: - - main # run for pushes to the main branch + - main # run for pushes to the main branch. other branches need to create a PR if they want testing. paths: - conjure_oxide/** - Cargo.* @@ -58,10 +58,6 @@ jobs: - working-directory: ./conjure_oxide run: rustup update ${{ matrix.rust_release }} && rustup default ${{ matrix.rust_release }} - - working-directory: ./conjure_oxide - run: rustup target add aarch64-apple-darwin - if: runner.os == 'macOS' - - working-directory: ./conjure_oxide run: cargo build -vv @@ -70,8 +66,6 @@ jobs: wget https://github.com/conjure-cp/conjure/releases/download/${{ matrix.conjure_version }}/conjure-${{ matrix.conjure_version }}-${{ matrix.release_suffix }}-with-solvers.zip unzip conjure-${{ matrix.conjure_version }}-linux-with-solvers.zip echo "$(pwd)/conjure-${{ matrix.conjure_version }}-linux-with-solvers" >> ${GITHUB_PATH} - if: runner.os == 'Linux' - working-directory: ./conjure_oxide run: cargo test - if: runner.os == 'Linux' From d622a501fccf3000de2060120ed42040aa0361cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=CC=88zgu=CC=88r=20Akgu=CC=88n?= Date: Wed, 22 Nov 2023 10:24:59 +0000 Subject: [PATCH 04/10] is this why we were missing the cache? yaml!!! --- .github/workflows/oxide.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oxide.yml b/.github/workflows/oxide.yml index 978d56ff0..2b76e4a40 100644 --- a/.github/workflows/oxide.yml +++ b/.github/workflows/oxide.yml @@ -43,7 +43,7 @@ jobs: - uses: actions/cache@v3 with: - path: + path: | ~/.cargo/bin/ ~/.cargo/registry/index/ ~/.cargo/registry/cache/ From 296ec2f26f95f03f0b0fb64b3558d89edc5ac6df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=CC=88zgu=CC=88r=20Akgu=CC=88n?= Date: Wed, 22 Nov 2023 10:27:50 +0000 Subject: [PATCH 05/10] use ${{ matrix.release_suffix }} consistently --- .github/workflows/oxide.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/oxide.yml b/.github/workflows/oxide.yml index 2b76e4a40..781cbea0d 100644 --- a/.github/workflows/oxide.yml +++ b/.github/workflows/oxide.yml @@ -64,8 +64,8 @@ jobs: - working-directory: ./conjure_oxide run: | wget https://github.com/conjure-cp/conjure/releases/download/${{ matrix.conjure_version }}/conjure-${{ matrix.conjure_version }}-${{ matrix.release_suffix }}-with-solvers.zip - unzip conjure-${{ matrix.conjure_version }}-linux-with-solvers.zip - echo "$(pwd)/conjure-${{ matrix.conjure_version }}-linux-with-solvers" >> ${GITHUB_PATH} + unzip conjure-${{ matrix.conjure_version }}-${{ matrix.release_suffix }}-with-solvers.zip + echo "$(pwd)/conjure-${{ matrix.conjure_version }}-${{ matrix.release_suffix }}-with-solvers" >> ${GITHUB_PATH} - working-directory: ./conjure_oxide run: cargo test From b45b24f6be34f60027f17aaaf86622a01a751b8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=CC=88zgu=CC=88r=20Akgu=CC=88n?= Date: Wed, 22 Nov 2023 10:38:09 +0000 Subject: [PATCH 06/10] cache the conjure release too --- .github/workflows/oxide.yml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/oxide.yml b/.github/workflows/oxide.yml index 781cbea0d..aa2740cf0 100644 --- a/.github/workflows/oxide.yml +++ b/.github/workflows/oxide.yml @@ -26,7 +26,7 @@ jobs: - stable - nightly conjure_version: - - v2.5.1 + - 2.5.1 os: - ubuntu-latest - macos-latest @@ -51,6 +51,7 @@ jobs: target solvers/minion/vendor solvers/chuffed/vendor + conjure-v${{ matrix.conjure_version }}-${{ matrix.release_suffix }}-with-solvers key: ${{ runner.os }}-${{ matrix.rust_release }}-${{ github.event.repository.updated_at }} restore-keys: ${{ runner.os }}-${{ matrix.rust_release }} @@ -61,11 +62,19 @@ jobs: - working-directory: ./conjure_oxide run: cargo build -vv - - working-directory: ./conjure_oxide + - name: Add conjure to PATH + run: echo "$(pwd)/conjure-v${{ matrix.conjure_version }}-${{ matrix.release_suffix }}-with-solvers" >> ${GITHUB_PATH} + + - name: Install conjure run: | - wget https://github.com/conjure-cp/conjure/releases/download/${{ matrix.conjure_version }}/conjure-${{ matrix.conjure_version }}-${{ matrix.release_suffix }}-with-solvers.zip - unzip conjure-${{ matrix.conjure_version }}-${{ matrix.release_suffix }}-with-solvers.zip - echo "$(pwd)/conjure-${{ matrix.conjure_version }}-${{ matrix.release_suffix }}-with-solvers" >> ${GITHUB_PATH} + if [ "$(conjure --version | head -n2 | tail -n1)" == "Release version ${{ matrix.conjure_version }}" ]; then + echo "Found conjure, not fetching again." + else + echo "Did not find conjure, fetching." + wget https://github.com/conjure-cp/conjure/releases/download/v${{ matrix.conjure_version }}/conjure-v${{ matrix.conjure_version }}-${{ matrix.release_suffix }}-with-solvers.zip + unzip conjure-v${{ matrix.conjure_version }}-v${{ matrix.release_suffix }}-with-solvers.zip + fi + conjure --version - working-directory: ./conjure_oxide run: cargo test From 68f7a197818dfa7693fe25d9a7357c95c85c88d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=CC=88zgu=CC=88r=20Akgu=CC=88n?= Date: Wed, 22 Nov 2023 10:59:54 +0000 Subject: [PATCH 07/10] typo --- .github/workflows/oxide.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oxide.yml b/.github/workflows/oxide.yml index aa2740cf0..9dede2c8c 100644 --- a/.github/workflows/oxide.yml +++ b/.github/workflows/oxide.yml @@ -72,7 +72,7 @@ jobs: else echo "Did not find conjure, fetching." wget https://github.com/conjure-cp/conjure/releases/download/v${{ matrix.conjure_version }}/conjure-v${{ matrix.conjure_version }}-${{ matrix.release_suffix }}-with-solvers.zip - unzip conjure-v${{ matrix.conjure_version }}-v${{ matrix.release_suffix }}-with-solvers.zip + unzip conjure-v${{ matrix.conjure_version }}-${{ matrix.release_suffix }}-with-solvers.zip fi conjure --version From db2905bc202bc261270aa8ced7d9cc2bb46e1f40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=CC=88zgu=CC=88r=20Akgu=CC=88n?= Date: Wed, 22 Nov 2023 11:13:17 +0000 Subject: [PATCH 08/10] abusing ~/.cargo/bin for better cache behaviour - I don't want to change the list of paths between jobs --- .github/workflows/oxide.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/oxide.yml b/.github/workflows/oxide.yml index 9dede2c8c..8d2893085 100644 --- a/.github/workflows/oxide.yml +++ b/.github/workflows/oxide.yml @@ -44,14 +44,13 @@ jobs: - uses: actions/cache@v3 with: path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ + ~/.cargo/bin + ~/.cargo/registry/index + ~/.cargo/registry/cache + ~/.cargo/git/db target solvers/minion/vendor solvers/chuffed/vendor - conjure-v${{ matrix.conjure_version }}-${{ matrix.release_suffix }}-with-solvers key: ${{ runner.os }}-${{ matrix.rust_release }}-${{ github.event.repository.updated_at }} restore-keys: ${{ runner.os }}-${{ matrix.rust_release }} @@ -63,7 +62,7 @@ jobs: run: cargo build -vv - name: Add conjure to PATH - run: echo "$(pwd)/conjure-v${{ matrix.conjure_version }}-${{ matrix.release_suffix }}-with-solvers" >> ${GITHUB_PATH} + run: echo "~/.cargo/bin/conjure-v${{ matrix.conjure_version }}-${{ matrix.release_suffix }}-with-solvers" >> ${GITHUB_PATH} - name: Install conjure run: | @@ -71,8 +70,11 @@ jobs: echo "Found conjure, not fetching again." else echo "Did not find conjure, fetching." + pushd ~/.cargo/bin + rm -rf conjure-v${{ matrix.conjure_version }}-${{ matrix.release_suffix }}-with-solvers* wget https://github.com/conjure-cp/conjure/releases/download/v${{ matrix.conjure_version }}/conjure-v${{ matrix.conjure_version }}-${{ matrix.release_suffix }}-with-solvers.zip unzip conjure-v${{ matrix.conjure_version }}-${{ matrix.release_suffix }}-with-solvers.zip + popd fi conjure --version From f7755ed7ce5550c31a031b5689284e88d84f0d87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=CC=88zgu=CC=88r=20Akgu=CC=88n?= Date: Wed, 22 Nov 2023 11:22:55 +0000 Subject: [PATCH 09/10] print the stderr when test fails --- conjure_oxide/tests/generated_tests.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/conjure_oxide/tests/generated_tests.rs b/conjure_oxide/tests/generated_tests.rs index 03d86a8c8..07ee917cf 100644 --- a/conjure_oxide/tests/generated_tests.rs +++ b/conjure_oxide/tests/generated_tests.rs @@ -28,9 +28,11 @@ fn integration_test(path: &str, essence_base: &str) -> Result<(), Box .arg("--output-format=astjson") .arg(format!("{path}/{essence_base}.essence")) .output()?; + let stderr_string = String::from_utf8(output.stderr)?; assert!( - String::from_utf8(output.stderr)?.is_empty(), - "conjure's stderr is not empty" + stderr_string.is_empty(), + "conjure's stderr is not empty: {}", + stderr_string ); let astjson = String::from_utf8(output.stdout)?; From 9122c0b180f84146fcdd08ebd5feec981584841f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=CC=88zgu=CC=88r=20Akgu=CC=88n?= Date: Wed, 22 Nov 2023 11:27:33 +0000 Subject: [PATCH 10/10] use ${HOME} instead of ~ when adding conjure to the PATH --- .github/workflows/oxide.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oxide.yml b/.github/workflows/oxide.yml index 8d2893085..9067e8e34 100644 --- a/.github/workflows/oxide.yml +++ b/.github/workflows/oxide.yml @@ -62,7 +62,7 @@ jobs: run: cargo build -vv - name: Add conjure to PATH - run: echo "~/.cargo/bin/conjure-v${{ matrix.conjure_version }}-${{ matrix.release_suffix }}-with-solvers" >> ${GITHUB_PATH} + run: echo "${HOME}/.cargo/bin/conjure-v${{ matrix.conjure_version }}-${{ matrix.release_suffix }}-with-solvers" >> ${GITHUB_PATH} - name: Install conjure run: |