diff --git a/.github/actions/install-conjure/action.yml b/.github/actions/install-conjure/action.yml new file mode 100644 index 0000000000..4c7f73432a --- /dev/null +++ b/.github/actions/install-conjure/action.yml @@ -0,0 +1,41 @@ +name: 'Install Conjure' +description: 'Install Conjure' +inputs: + version: + description: 'The version of conjure to install.' + required: false + default: "2.5.1" + os_arch: + description: 'The OS / Architecture to use. Supported values are ["linux","macos-arm","macos-intel"]' + required: true + +runs: + using: composite + steps: + - run: | + if [ "$(conjure --version | head -n2 | tail -n1)" == "Release version ${{ inputs.version }}" ]; then + echo "Found conjure, not fetching again." + else + mkdir -p "${HOME}/conjure" + cd "${HOME}/conjure" + + echo "Downloading conjure." + rm -rf conjure-v${{ inputs.version }}-${{ inputs.os_arch }}-with-solvers* + wget https://github.com/conjure-cp/conjure/releases/download/v${{ inputs.version }}/conjure-v${{ inputs.version }}-${{ inputs.os_arch }}-with-solvers.zip + unzip conjure-v${{ inputs.version }}-${{ inputs.os_arch }}-with-solvers.zip + + echo "Adding conjure to path." + # this prepends to path (so imagemagick doesnt interfere!), and does not take effect until the next step runs. + echo "${HOME}/conjure/conjure-v${{ inputs.version }}-${{ inputs.os_arch }}-with-solvers/" >> ${GITHUB_PATH} + fi + shell: bash + + - name: Check that conjure is installed correctly + run: | + if [ "$(conjure --version | head -n2 | tail -n1)" != "Release version ${{ inputs.version }}" ]; then + echo "Correct conjure not found in path." + conjure --version + exit 1 + fi + shell: bash + diff --git a/.github/workflows/code-coverage-main.yml b/.github/workflows/code-coverage-main.yml index 1f84cad9bf..1db5a56a49 100644 --- a/.github/workflows/code-coverage-main.yml +++ b/.github/workflows/code-coverage-main.yml @@ -8,9 +8,6 @@ on: env: rust_release: nightly - conjure_version: - - 2.5.1 - release_suffix: linux jobs: coverage: @@ -39,22 +36,10 @@ jobs: working-directory: ./solvers/minion run: rustup update ${{ env.rust_release }} && rustup default ${{ env.rust_release }} - - name: Add conjure to PATH - run: echo "${HOME}/.cargo/bin/conjure-v${{ env.conjure_version }}-${{ env.release_suffix }}-with-solvers" >> ${GITHUB_PATH} - - - name: Install conjure - run: | - if [ "$(conjure --version | head -n2 | tail -n1)" == "Release version ${{ env.conjure_version }}" ]; then - echo "Found conjure, not fetching again." - else - echo "Did not find conjure, fetching." - pushd ~/.cargo/bin - rm -rf conjure-v${{ env.conjure_version }}-${{ env.release_suffix }}-with-solvers* - wget https://github.com/conjure-cp/conjure/releases/download/v${{ env.conjure_version }}/conjure-v${{ env.conjure_version }}-${{ env.release_suffix }}-with-solvers.zip - unzip conjure-v${{ env.conjure_version }}-${{ env.release_suffix }}-with-solvers.zip - popd - fi - conjure --version + - uses: ./.github/actions/install-conjure + with: + os_arch: linux + version: 2.5.1 - name: Generate coverage reports working-directory: . diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml index 903d492e8b..02adeda09d 100644 --- a/.github/workflows/code-coverage.yml +++ b/.github/workflows/code-coverage.yml @@ -3,7 +3,7 @@ name: "Code Coverage (Generate)" on: pull_request: paths: - - conjure-oxide/** + - conjure_oxide/** - solvers/** - crates/** - .github/actions/code-coverage.yml @@ -11,9 +11,6 @@ on: env: rust_release: nightly - conjure_version: - - 2.5.1 - release_suffix: linux jobs: coverage: @@ -58,19 +55,10 @@ jobs: - name: Add conjure to PATH run: echo "${HOME}/.cargo/bin/conjure-v${{ env.conjure_version }}-${{ env.release_suffix }}-with-solvers" >> ${GITHUB_PATH} - - name: Install conjure - run: | - if [ "$(conjure --version | head -n2 | tail -n1)" == "Release version ${{ env.conjure_version }}" ]; then - echo "Found conjure, not fetching again." - else - echo "Did not find conjure, fetching." - pushd ~/.cargo/bin - rm -rf conjure-v${{ env.conjure_version }}-${{ env.release_suffix }}-with-solvers* - wget https://github.com/conjure-cp/conjure/releases/download/v${{ env.conjure_version }}/conjure-v${{ env.conjure_version }}-${{ env.release_suffix }}-with-solvers.zip - unzip conjure-v${{ env.conjure_version }}-${{ env.release_suffix }}-with-solvers.zip - popd - fi - conjure --version + - uses: ./.github/actions/install-conjure + with: + os_arch: linux + version: 2.5.1 - name: Generate coverage reports working-directory: . diff --git a/.github/workflows/doc-coverage.yml b/.github/workflows/doc-coverage.yml index c19e665a94..cd6ff4fb46 100644 --- a/.github/workflows/doc-coverage.yml +++ b/.github/workflows/doc-coverage.yml @@ -5,13 +5,13 @@ on: branches: - main # run for pushes to the main branch paths: - - conjure-oxide/** + - conjure_oxide/** - solvers/** - crates/** - .github/actions/doc-coverage.yml pull_request: paths: - - conjure-oxide/** + - conjure_oxide/** - solvers/** - crates/** - .github/actions/doc-coverage.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 52f137595b..3df505241c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -63,23 +63,11 @@ jobs: - run: cargo build -vv --workspace - - name: Add conjure to PATH - run: echo "${HOME}/.cargo/bin/conjure-v${{ matrix.conjure_version }}-${{ matrix.release_suffix }}-with-solvers" >> ${GITHUB_PATH} - - - name: Install conjure - run: | - 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." - 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 - + - uses: ./.github/actions/install-conjure + with: + os_arch: ${{ matrix.release_suffix }} + version: ${{ matrix.conjure_version }} + - run: cargo test --workspace audit: