Skip to content

Commit

Permalink
ci: Build wasm on explicit rust version (#975)
Browse files Browse the repository at this point in the history
* ci: Build wasm on explicit rust version

* Upgrade to dtolnay/rust-toolchain in CI

* Try not installing a toolchain at all

Unfortunately dtolnay/rust-toolchain#12
  • Loading branch information
max-sixty authored Sep 16, 2022
1 parent 700cd2d commit 1c91a3a
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 57 deletions.
19 changes: 3 additions & 16 deletions .github/actions/test-rust/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,21 @@ name: Test Rust
description: Runs cargo test & cargo lint for a given platform & target.

inputs:
target:
description: "Target triple, like `wasm32-unknown-unknown"
required: false
target_option:
description: "--target={target}"
description: "Target triple with prefix, like `--target=wasm32-unknown-unknown`"
required: false

runs:
using: composite
steps:
- name: 🔗 Setup toolchain
# If we don't get a value, then skip; we're using the default value.
if: ${{ inputs.target }}
uses: actions-rs/toolchain@v1
with:
profile: minimal
target: ${{ inputs.target }}
toolchain: stable
override: true
default: true
- name: 💰 Cache
uses: Swatinem/rust-cache@v1
with:
# Without inputs.target, it seems to select linux x64 in the wasm32
# tests, though in the docs it says it uses the target as the key?
key: ${{ inputs.target }}
key: ${{ inputs.target_option }}
- uses: jetli/[email protected]
if: inputs.target == 'wasm32-unknown-unknown'
if: inputs.target_option == '--target=wasm32-unknown-unknown'
- name: 📎 Clippy
uses: actions-rs/cargo@v1
with:
Expand Down
22 changes: 6 additions & 16 deletions .github/actions/time-compilation/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,18 @@ name: Time Compilation
description: Time the cargo compilation, outputting an HTML file.

inputs:
target:
description: "Target triple, like `wasm32-unknown-unknown"
required: false
target_option:
description: "--target={target}"
required: false
use_cache:
required: true
type: boolean

runs:
using: composite
steps:
# We need to pin the toolchain so caching works across days; and it requires nightly atm.
- name: 🔗 Setup toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
target: ${{ inputs.target }}
# Pin this so caching works across days
toolchain: nightly-2022-07-26
override: true
default: true
shell: bash
# Doing this ourselves since https://github.com/dtolnay/rust-toolchain/issues/29
run: rustup override set nightly-2022-07-26
- name: 💰 Cache
id: cache
uses: Swatinem/rust-cache@v1
Expand All @@ -44,5 +34,5 @@ runs:
name: cargo-timing.html
path: target/cargo-timings/cargo-timing-*.html
if-no-files-found: error
# Only upload if a) we didn't want to use the cache, or b) we got a cache hit
if: inputs.use_cache == 'false' || steps.cache.outputs.cache-hit == 'true'
# Only upload if a) we got a cache hit or b) we didn't want to use the cache anyway
if: steps.cache.outputs.cache-hit == 'true' || inputs.use_cache == 'false'
5 changes: 0 additions & 5 deletions .github/workflows/publish-web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ jobs:
steps:
- name: 📂 Checkout code
uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
target: wasm32-unknown-unknown
toolchain: stable

# Website setup
- name: Setup hugo
Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,21 @@ jobs:
matrix:
include:
# TODO: I'm sure there's a better way of doing this, where `target_option` derives from `target`?
- target: ""
- target: "wasm32-unknown-unknown"
target_option: "--target=wasm32-unknown-unknown"
- target_option: ""
- target_option: "--target=wasm32-unknown-unknown"
steps:
- name: 📂 Checkout code
uses: actions/checkout@v3
- name: 📋 Test workspace
uses: ./.github/actions/test-rust
with:
target: ${{ matrix.target }}
target_option: ${{ matrix.target_option }}

test-book:
runs-on: ubuntu-latest
steps:
- name: 📂 Checkout code
uses: actions/checkout@v3
- name: 🔗 Setup rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
# https://github.com/actions-rs/toolchain/issues/126
toolchain: stable
- name: 💰 Cache
uses: Swatinem/rust-cache@v1
- uses: peaceiris/actions-mdbook@v1
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/test-all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,12 @@ jobs:
- os: windows-latest
- os: macos-latest
- os: ubuntu-latest
target: "wasm32-unknown-unknown"
target_option: "--target=wasm32-unknown-unknown"
steps:
- name: 📂 Checkout code
uses: actions/checkout@v3
- uses: ./.github/actions/test-rust
with:
target: ${{ matrix.target }}
target_option: ${{ matrix.target_option }}

test-python:
Expand All @@ -50,7 +48,7 @@ jobs:
# TODO: enable for windows
os: [ubuntu-latest, macos-latest]
# Java test is simple enough that it's not worth splitting out into a
# separate action. These three lines is copied to test-java, which runs on
# separate action. These three lines are copied to test-java, which runs on
# any java change.
steps:
- name: 📂 Checkout code
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/test-java.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
default: true
# Java test is simple enough that it's not worth splitting out into a
# separate action. These three lines is copied to test-java, which runs on
# separate action. These three lines are copied to test-all, which runs on
# each merge.
- name: Maven test
working-directory: prql-java/java/
Expand Down

0 comments on commit 1c91a3a

Please sign in to comment.