Skip to content

Commit

Permalink
Extract build-and-test workflow (iotaledger#70)
Browse files Browse the repository at this point in the history
* Extract `build-and-test` workflow

* Fix
  • Loading branch information
grtlr authored Apr 21, 2022
1 parent f26b692 commit 482fc7b
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 44 deletions.
48 changes: 4 additions & 44 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,50 +14,10 @@ concurrency:

jobs:
build-and-test:
runs-on: ${{ matrix.os }}
# Unfortunately, we can do this right now because `indexmap` does not seem to follow semver.
# env:
# RUSTFLAGS: -D warnings -D missing-docs
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- uses: actions/checkout@v2

- name: Install LLVM and Clang (Windows)
uses: KyleMayes/install-llvm-action@32c4866ebb71e0949e8833eb49beeebed48532bd
if: contains(matrix.os, 'windows')
with:
version: "11.0"
directory: ${{ runner.temp }}/llvm

- name: Set LIBCLANG_PATH (Windows)
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV
if: contains(matrix.os, 'windows')

- name: Install Rust (stable)
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- uses: Swatinem/rust-cache@v1

- name: Build
uses: actions-rs/cargo@v1
with:
command: ci-build

- name: Test
uses: actions-rs/cargo@v1
with:
command: ci-test

- name: Doc Test
uses: actions-rs/cargo@v1
with:
command: ci-doctest
uses: iotaledger/inx-chronicle/.github/workflows/common-build-and-test.yml@main
with:
os: '["ubuntu-latest, macos-latest, windows-latest"]'
rust: '["stable"]'

format:
runs-on: ubuntu-latest
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/common-build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build and test

on:
workflow_call:
inputs:
os:
required: true
type: string
description: 'Stringified JSON object listing the operating systems.'
rust:
required: true
type: string
description: 'Stringified JSON object listing the Rust versions.'

jobs:
build-and-test:
build-and-test:
runs-on: ${{ matrix.os }}
# Unfortunately, we can do this right now because `indexmap` does not seem to follow semver.
# env:
# RUSTFLAGS: -D warnings -D missing-docs
strategy:
matrix:
os: ${{ fromJson(inputs.os) }}
rust: ${{ fromJson(inputs.rust) }}

steps:
- uses: actions/checkout@v2

- name: Install LLVM and Clang (Windows)
uses: KyleMayes/install-llvm-action@32c4866ebb71e0949e8833eb49beeebed48532bd
if: contains(matrix.os, 'windows')
with:
version: "11.0"
directory: ${{ runner.temp }}/llvm

- name: Set LIBCLANG_PATH (Windows)
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV
if: contains(matrix.os, 'windows')

- name: Install Rust (${{ matrix.rust }})
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true

- uses: Swatinem/rust-cache@v1

- name: Build
uses: actions-rs/cargo@v1
with:
command: ci-build

- name: Test
uses: actions-rs/cargo@v1
with:
command: ci-test

- name: Doc Test
uses: actions-rs/cargo@v1
with:
command: ci-doctest

0 comments on commit 482fc7b

Please sign in to comment.