Skip to content

Fix format function syntax #138

Fix format function syntax

Fix format function syntax #138

Workflow file for this run

name: CI Build
on: [push, pull_request]
env:
os_with_codebuild: '["ubuntu-latest", "windows-latest", "macos-latest", "{0}-arm-3.0-large", "{0}-al2-5.0-large"]'
os_without_codebuild: '["ubuntu-latest", "windows-latest", "macos-latest"]'
jobs:
build:
name: Build and Test
runs-on: ${{ format(matrix.os, format('codebuild-ion-rust-{0}-{1}', github.run_id, github.run_attempt)) }}
# We want to run on external PRs, but not on internal ones as push automatically builds
# H/T: https://github.com/Dart-Code/Dart-Code/commit/612732d5879730608baa9622bf7f5e5b7b51ae65
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'amazon-ion/ion-rust'
strategy:
matrix:
os: ${{ vars.USE_CODEBUILD_RUNNERS && fromJSON(env.os_with_codebuild) || fromJSON(env.os_without_codebuild) }}

Check failure on line 18 in .github/workflows/rust.yml

View workflow run for this annotation

GitHub Actions / CI Build

Invalid workflow file

The workflow is not valid. .github/workflows/rust.yml (Line: 18, Col: 13): Unrecognized named-value: 'env'. Located at position 40 within expression: vars.USE_CODEBUILD_RUNNERS && fromJSON(env.os_with_codebuild) || fromJSON(env.os_without_codebuild) .github/workflows/rust.yml (Line: 18, Col: 13): Unexpected value '${{ vars.USE_CODEBUILD_RUNNERS && fromJSON(env.os_with_codebuild) || fromJSON(env.os_without_codebuild) }}'
# build and test for different and interesting crate features
features: ['default', 'all', 'experimental-ion-hash', 'experimental']
permissions:
checks: write
steps:
- name: Install Dependencies
if: runner.os == 'Windows'
run: choco install llvm -y
- name: Git Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Rust Toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt, clippy
override: true
- name: Cargo Test (default/no features)
if: matrix.features == 'default'
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --workspace
- name: Cargo Test (all features)
if: matrix.features == 'all'
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --workspace --all-features
- name: Cargo Test (specific feature)
if: matrix.features != 'default' && matrix.features != 'all'
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --workspace --features "${{ matrix.features }}"
- name: Rustfmt Check
# We really only need to run this once--ubuntu/all features mode is as good as any
if: matrix.os == 'ubuntu-latest' && matrix.features == 'all'
uses: actions-rs/cargo@v1
with:
command: fmt
args: --verbose -- --check
# `clippy-check` will run `cargo clippy` on new pull requests. Due to a limitation in GitHub
# permissions, the behavior of the Action is different depending on the source of the PR. If the
# PR comes from the ion-rust project itself, any suggestions will be added to the PR as comments.
# If the PR comes from a fork, any suggestions will be added to the Action's STDOUT for review.
# For details, see: https://github.com/actions-rs/clippy-check/issues/2
- name: Install Clippy
# The clippy check depends on setup steps defined above, but we don't want it to run
# for every OS because it posts its comments to the PR. These `if` checks limit clippy to
# only running on the Linux test. (The choice of OS was arbitrary.)
if: matrix.os == 'ubuntu-latest' && matrix.features == 'all'
run: rustup component add clippy
- name: Run Clippy
if: matrix.os == 'ubuntu-latest' && matrix.features == 'all'
uses: actions-rs/clippy-check@v1
with:
# Adding comments to the PR requires the GITHUB_TOKEN secret.
token: ${{ secrets.GITHUB_TOKEN }}
# We are opinionated here and fail the build if anything is complained about.
# We can always explicitly allow clippy things we disagree with or if this gets too annoying, get rid of it.
args: --workspace --all-features --tests -- -Dwarnings
- name: Rustdoc on Everything
# We really only need to run this once--ubuntu/all features mode is as good as any
if: matrix.os == 'ubuntu-latest' && matrix.features == 'all'
uses: actions-rs/cargo@v1
with:
command: doc
args: --document-private-items --all-features
confirm_build:
# This job is just a "join" on all parallel strategies for the `build` job so that we can require it in our branch protection rules.
needs: build
name: Build and Test (all) Success
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'amazon-ion/ion-rust'
runs-on: ubuntu-latest
steps:
- name: Pass
run: echo "ok"