Ditch actions-rs (#395)

This commit is contained in:
Félix Saparelli 2022-09-07 14:15:38 +12:00 committed by GitHub
parent f7d38206e3
commit 669ad6a7bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 104 additions and 85 deletions

View File

@ -1,18 +0,0 @@
name: Security audit
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -9,6 +9,10 @@ on:
tags-ignore:
- "*"
env:
CARGO_TERM_COLOR: always
CARGO_UNSTABLE_SPARSE_REGISTRY: "true"
jobs:
check:
strategy:
@ -22,14 +26,24 @@ jobs:
runs-on: "${{ matrix.platform }}-latest"
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add clippy
- uses: actions-rs/cargo@v1
with:
command: clippy
- uses: actions/checkout@v3
- name: Configure toolchain
run: |
rustup toolchain install --profile minimal --no-self-update nightly
rustup default nightly
rustup component add clippy
- name: Configure caching
uses: actions/cache@v3
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Clippy
run: cargo clippy -- -D clippy::all

View File

@ -7,6 +7,10 @@ on:
tags:
- "v*.*.*"
env:
CARGO_TERM_COLOR: always
CARGO_UNSTABLE_SPARSE_REGISTRY: "true"
jobs:
info:
name: Gather info
@ -16,7 +20,7 @@ jobs:
release_notes: ${{ fromJSON(steps.notes.outputs.notes_json) }}
announce: ${{ steps.announce.outputs.announce }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Extract version
id: version
shell: bash
@ -159,11 +163,19 @@ jobs:
dst: watchexec-${{ needs.info.outputs.cli_version }}-${{ matrix.target }}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/checkout@v3
- name: Configure caching
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('Cargo.lock') }}
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ matrix.target }}-
${{ runner.os }}-cargo-
- name: Add musl tools
run: sudo apt install -y musl musl-dev musl-tools
@ -183,31 +195,38 @@ jobs:
- name: Install cargo-deb
if: startsWith(matrix.name, 'linux-')
uses: baptiste0928/cargo-install@v1
uses: taiki-e/install-action@v1
with:
crate: cargo-deb
version: 1.34.2
tool: cargo-deb
- name: Install cargo-generate-rpm
if: startsWith(matrix.name, 'linux-')
uses: baptiste0928/cargo-install@v1
uses: taiki-e/install-action@v1
with:
crate: cargo-generate-rpm
version: 0.6.0
tool: cargo-generate-rpm
- uses: actions-rs/toolchain@v1
with:
target: ${{ matrix.target }}
toolchain: stable
profile: minimal
override: true
- name: Configure toolchain
run: |
rustup toolchain install --profile minimal --no-self-update stable
rustup default stable
- uses: actions-rs/cargo@v1
name: Build
- name: Install cross
if: matrix.cross
uses: taiki-e/install-action@v1
with:
use-cross: ${{ matrix.cross }}
command: build
args: --package watchexec-cli --release --locked --target ${{ matrix.target }}
tool: cross
- name: Install host target
if: "!matrix.cross"
run: rustup target add ${{ matrix.target }}
- name: Build (cargo)
if: "!matrix.cross"
run: cargo build --package watchexec-cli --release --locked --target ${{ matrix.target }}
- name: Build (cross)
if: matrix.cross
run: cross build --package watchexec-cli --release --locked --target ${{ matrix.target }}
- name: Package
shell: bash
@ -245,7 +264,7 @@ jobs:
shell: bash
run: 7z a "$dst.zip" "$dst"
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: builds
retention-days: 1
@ -262,23 +281,20 @@ jobs:
name: Checksum and sign
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install rsign2
uses: baptiste0928/cargo-install@v1
uses: taiki-e/install-action@v1
with:
crate: rsign2
version: 0.6.1
tool: rsign2
- name: Install b3sum
uses: baptiste0928/cargo-install@v1
uses: taiki-e/install-action@v1
with:
crate: b3sum
version: 1.3.0
tool: b3sum
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: builds

View File

@ -29,7 +29,7 @@ jobs:
echo "CUSTOM_TAG=${crate}-${version}" >> $GITHUB_ENV
fi
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Push release tag
id: tag_version
uses: mathieudutour/github-tag-action@v6.0

View File

@ -9,6 +9,10 @@ on:
tags-ignore:
- "*"
env:
CARGO_TERM_COLOR: always
CARGO_UNSTABLE_SPARSE_REGISTRY: "true"
jobs:
test:
strategy:
@ -25,15 +29,25 @@ jobs:
runs-on: "${{ matrix.platform }}-latest"
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: "${{ matrix.toolchain }}"
override: true
- name: Run test suite
uses: actions-rs/cargo@v1
with:
command: test
- name: Check that CLI runs
run: cargo run -p watchexec-cli -- -1 echo
- uses: actions/checkout@v3
- name: Configure toolchain
run: |
rustup toolchain install --profile minimal --no-self-update ${{ matrix.toolchain }}
rustup default ${{ matrix.toolchain }}
- name: Configure caching
uses: actions/cache@v3
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ matrix.toolchain }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ matrix.toolchain }}-
${{ runner.os }}-cargo-
- name: Run test suite
run: cargo test
- name: Check that CLI runs
run: cargo run -p watchexec-cli -- -1 echo

View File

@ -45,7 +45,7 @@ pub fn get_args(tagged_filterer: bool) -> Result<ArgMatches> {
.help_heading(Some(OPTSET_BEHAVIOUR))
.help("Select the behaviour to use when receiving events while the command is running. Current default is queue, will change to do-nothing in 2.0.")
.takes_value(true)
.possible_values(&["do-nothing", "queue", "restart", "signal"])
.possible_values(["do-nothing", "queue", "restart", "signal"])
.long("on-busy-update"))
.arg(Arg::new("restart")
.help_heading(Some(OPTSET_BEHAVIOUR))

View File

@ -169,7 +169,7 @@ pub async fn ignores(
.filter(|ig| {
!ig.applies_in
.as_ref()
.map_or(false, |p| p.starts_with(&origin))
.map_or(false, |p| p.starts_with(origin))
})
.collect::<Vec<_>>();
debug!(

View File

@ -56,8 +56,8 @@ impl GlobsetFilterer {
extensions: impl IntoIterator<Item = OsString>,
) -> Result<Self, Error> {
let origin = origin.as_ref();
let mut filters_builder = GitignoreBuilder::new(&origin);
let mut ignores_builder = GitignoreBuilder::new(&origin);
let mut filters_builder = GitignoreBuilder::new(origin);
let mut ignores_builder = GitignoreBuilder::new(origin);
for (filter, in_path) in filters {
trace!(filter=?&filter, "add filter to globset filterer");

View File

@ -461,14 +461,7 @@ impl DirTourist {
pub fn skip(&mut self, path: PathBuf) {
let check_path = path.as_path();
self.to_visit = self
.to_visit
.iter()
.filter(|p| !p.starts_with(check_path))
.cloned()
.collect();
// TODO: use drain_filter when that lands
self.to_visit.retain(|p| !p.starts_with(check_path));
self.to_skip.insert(path);
}