Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/rust.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"problemMatcher": [
{
"owner": "cargo-common",
"pattern": [
{
"regexp": "^(warning|warn|error)(\\[(\\S*)\\])?: (.*)$",
"severity": 1,
"message": 4,
"code": 3
},
{
"regexp": "^\\s+-->\\s(\\S+):(\\d+):(\\d+)$",
"file": 1,
"line": 2,
"column": 3
}
]
},
{
"owner": "cargo-test",
"pattern": [
{
"regexp": "^\\s+thread\\s+'(.*?)'.+panicked\\s+at\\s+([^:]+):(\\d+):(\\d+):$",
"message": 1,
"file": 2,
"line": 3,
"column": 4
}
]
},
{
"owner": "cargo-fmt",
"pattern": [
{
"regexp": "^(Diff in ([^:]+):(\\d+)):$",
"message": 1,
"file": 1,
"line": 2
}
]
}
]
}
13 changes: 12 additions & 1 deletion .github/workflows/crate-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Options:
-f, --force Force overwriting an existing binary
--crate NAME Name of the crate to install (default <repository name>)
--tag TAG Tag (version) of the crate to install (default <latest release>)
--filename Filename (instead of $crate-$tag-$target.tar.gz).
--target TARGET Install the release compiled for $TARGET (default <`rustc` host>)
--to LOCATION Where to install the binary (default ~/.cargo/bin)
EOF
Expand Down Expand Up @@ -71,6 +72,10 @@ while test $# -gt 0; do
tag=$2
shift
;;
--filename)
filename=$2
shift
;;
--target)
target=$2
shift
Expand Down Expand Up @@ -148,7 +153,13 @@ fi

say_err "Installing to: $dest"

url="$url/download/$tag/$crate-$tag-$target.tar.gz"
if [ -z "$filename" ]; then
filename="$crate-$tag-$target.tar.gz"
fi

url="$url/download/$tag/$filename"

say_err "URL: $url"

td=$(mktemp -d || mktemp -d -t tmp)
curl -sL "$url" | tar xz -f - -C "$td"
Expand Down
96 changes: 96 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Test

on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize

# Drop all default GITHUB_TOKEN permissions; each job declares its own least-privilege set.
permissions: {}

env:
MSRV: '1.90'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
decide-runs:
name: Decision task
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
rust-changed: ${{ steps.set-flags.outputs.rust-changed }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
filter: blob:none
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- id: changed-files-rust
uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6
with:
files: |
**/Cargo.toml
**/Cargo.lock
**/*.rs
base_sha: ${{ github.event.pull_request.base.sha || github.event.before }}
- name: Decide which jobs to run
id: set-flags
env:
RUST_CHANGED: ${{ steps.changed-files-rust.outputs.any_changed }}
run: |
echo "rust-changed=$RUST_CHANGED" >> $GITHUB_OUTPUT

test-rust:
runs-on: ubuntu-latest
needs: [decide-runs]
if: needs.decide-runs.outputs.rust-changed == 'true'
strategy:
fail-fast: false
matrix:
rust-version: ["stable", "1.90"]
steps:
- &checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
filter: blob:none
ref: ${{ github.event.pull_request.head.sha || github.sha }}

- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust-version }}

- name: Install nextest
run: |
.github/workflows/crate-ci.sh \
--git nextest-rs/nextest \
--crate nextest \
--tag "cargo-nextest-0.9.143" \
--filename "cargo-nextest-0.9.143-x86_64-unknown-linux-gnu.tar.gz"

- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1

- name: Install deps
run: |
sudo apt update
sudo apt install --yes --no-install-recommends \
faketime

- name: Test
run: |
export RUST_BACKTRACE=1
export RUST_LOG=glean_core=debug
export CARGO_INCREMENTAL=0

echo "::add-matcher::.github/rust.json"
make test-rust
Loading