Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Setup sccache for Rust builds. (#1148)
Browse files Browse the repository at this point in the history
* Dump stats.

* Add some debugs.

* Move proto.

* Add sccache.

* Try a global.

* Add env vars.

* Use an action.

* Fix version.

* Add logging.

* Turn off daemon.

* Try aws.

* Move vars.

* Disable logging.

* Change id debug.

* Update pipeline.

* Add action.
milesj authored Oct 27, 2023
1 parent 68f5fbe commit dd1f59c
Showing 2 changed files with 29 additions and 14 deletions.
26 changes: 20 additions & 6 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -16,6 +16,16 @@ on:
- rust-toolchain.toml
env:
WITH_COVERAGE: ${{ contains(github.ref, 'develop-') || github.ref_name == 'master' }}
# sccache
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
RUSTC_WRAPPER: sccache
# RUST_LOG: trace
SCCACHE_BUCKET: moon-ci-sccache
# SCCACHE_LOG: debug
# SCCACHE_NO_DAEMON: 1
SCCACHE_REGION: us-east-2
SCCACHE_S3_SERVER_SIDE_ENCRYPTION: true
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
@@ -43,6 +53,7 @@ jobs:
with:
bins: cargo-make
components: clippy
- uses: mozilla-actions/sccache-action@v0.0.3
- name: Run linter
run: cargo make lint
test:
@@ -52,23 +63,26 @@ jobs:
matrix:
os: [buildjet-8vcpu-ubuntu-2204, self-hosted-laptop-macos-m1, self-hosted-laptop-windows-i7]
fail-fast: false
# Linux runs out of disk space right now...
continue-on-error: ${{ matrix.os == 'buildjet-8vcpu-ubuntu-2204' }}
steps:
- uses: actions/checkout@v4
- uses: moonrepo/setup-rust@v1
with:
bins: cargo-make, cargo-nextest, cargo-llvm-cov
components: llvm-tools-preview
cache: false # ${{ runner.os == 'Linux' }}
- name: Run tests with coverage
if: ${{ env.WITH_COVERAGE == 'true' }}
run: cargo make test-coverage
env:
NEXTEST_PROFILE: ci
cache: false
- uses: mozilla-actions/sccache-action@v0.0.3
- name: Run tests
if: ${{ env.WITH_COVERAGE == 'false' }}
run: cargo make test-ci
env:
NEXTEST_PROFILE: ci
- name: Run tests with coverage
if: ${{ env.WITH_COVERAGE == 'true' }}
run: cargo make test-coverage
env:
NEXTEST_PROFILE: ci
- name: Generate code coverage
if: ${{ env.WITH_COVERAGE == 'true' }}
run: cargo make generate-report
17 changes: 9 additions & 8 deletions nextgen/common/src/id.rs
Original file line number Diff line number Diff line change
@@ -4,12 +4,7 @@ use regex::Regex;
use schematic::{SchemaType, Schematic};
use serde::{de, Deserialize, Deserializer, Serialize};
use starbase_styles::{Style, Stylize};
use std::{
borrow::Borrow,
fmt::{self, Display},
ops::Deref,
str::FromStr,
};
use std::{borrow::Borrow, fmt, ops::Deref, str::FromStr};
use thiserror::Error;

pub static ID_CHARS: &str = r"[0-9A-Za-z/\._-]*";
@@ -26,7 +21,7 @@ pub static ID_CLEAN: Lazy<Regex> = Lazy::new(|| Regex::new(r"[^0-9A-Za-z/\._-]+"
#[error("Invalid format for {}, may only contain alpha-numeric characters, dashes (-), slashes (/), underscores (_), and dots (.), and must start with an alpha character.", .0.style(Style::Id))]
pub struct IdError(String);

#[derive(Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
#[derive(Clone, Default, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub struct Id(String);

impl Id {
@@ -53,7 +48,13 @@ impl Id {
}
}

impl Display for Id {
impl fmt::Debug for Id {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.0)
}
}

impl fmt::Display for Id {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.0)
}

0 comments on commit dd1f59c

Please sign in to comment.