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

View File

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

View File

@ -9,6 +9,10 @@ on:
tags-ignore: tags-ignore:
- "*" - "*"
env:
CARGO_TERM_COLOR: always
CARGO_UNSTABLE_SPARSE_REGISTRY: "true"
jobs: jobs:
test: test:
strategy: strategy:
@ -25,15 +29,25 @@ jobs:
runs-on: "${{ matrix.platform }}-latest" runs-on: "${{ matrix.platform }}-latest"
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1 - name: Configure toolchain
with: run: |
profile: minimal rustup toolchain install --profile minimal --no-self-update ${{ matrix.toolchain }}
toolchain: "${{ matrix.toolchain }}" rustup default ${{ matrix.toolchain }}
override: true - name: Configure caching
- name: Run test suite uses: actions/cache@v3
uses: actions-rs/cargo@v1 with:
with: path: |
command: test ~/.cargo/registry/index/
- name: Check that CLI runs ~/.cargo/registry/cache/
run: cargo run -p watchexec-cli -- -1 echo ~/.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_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.") .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) .takes_value(true)
.possible_values(&["do-nothing", "queue", "restart", "signal"]) .possible_values(["do-nothing", "queue", "restart", "signal"])
.long("on-busy-update")) .long("on-busy-update"))
.arg(Arg::new("restart") .arg(Arg::new("restart")
.help_heading(Some(OPTSET_BEHAVIOUR)) .help_heading(Some(OPTSET_BEHAVIOUR))

View File

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

View File

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

View File

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