Skip to content

Commit

Permalink
Merge pull request #102 from ozgurakgun/actions-matrix
Browse files Browse the repository at this point in the history
using a matrix configuration for github actions
  • Loading branch information
ozgurakgun authored Nov 22, 2023
2 parents e045d91 + 9122c0b commit 09cbd96
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 79 deletions.
122 changes: 45 additions & 77 deletions .github/workflows/oxide.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.*
Expand All @@ -15,100 +15,68 @@ on:
- .github/workflows/oxide.yml
workflow_dispatch:

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

key: ${{ runner.os }}-${{ env.rust_release }}-${{ github.event.repository.updated_at }}
restore-keys: ${{ runner.os }}-${{ env.rust_release }}-
Job:

strategy:
matrix:
rust_release:
- stable
- nightly
conjure_version:
- 2.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 }}

- working-directory: ./conjure_oxide
run: rustup update ${{ env.rust_release }} && rustup default ${{ env.rust_release }}

- working-directory: ./conjure_oxide
run: cargo build -vv

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/
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 }}
key: ${{ runner.os }}-${{ matrix.rust_release }}-${{ github.event.repository.updated_at }}
restore-keys: ${{ runner.os }}-${{ matrix.rust_release }}

- working-directory: ./conjure_oxide
run: rustup target add aarch64-apple-darwin
run: rustup update ${{ matrix.rust_release }} && rustup default ${{ matrix.rust_release }}

- 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 }}-
- name: Add conjure to PATH
run: echo "${HOME}/.cargo/bin/conjure-v${{ matrix.conjure_version }}-${{ matrix.release_suffix }}-with-solvers" >> ${GITHUB_PATH}

- working-directory: ./conjure_oxide
run: rustup update ${{ env.rust_release }} && rustup default ${{ env.rust_release }}

- working-directory: ./conjure_oxide
- name: Install conjure
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}
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
- working-directory: ./conjure_oxide
run: cargo test





6 changes: 4 additions & 2 deletions conjure_oxide/tests/generated_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ fn integration_test(path: &str, essence_base: &str) -> Result<(), Box<dyn Error>
.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)?;

Expand Down

0 comments on commit 09cbd96

Please sign in to comment.