Skip to content

Commit

Permalink
chore: use make in ci workflows (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
cristianoliveira authored Oct 10, 2024
1 parent 430a7fb commit 460af59
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 30 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/on-push-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,5 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Setup env
run: mkdir /tmp/fzz

- name: Run integration tests
run: make integration
2 changes: 1 addition & 1 deletion .github/workflows/on-push-nixbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ jobs:
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- run: mkdir -p /tmp/fzz
- run: nix flake check
- run: make nix-flake-check
- run: make nix-build-local
6 changes: 3 additions & 3 deletions .github/workflows/on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
- uses: actions/checkout@v3

- name: Build
run: cargo build --verbose
run: make prebuild

- name: Linter
run: cargo fmt -- --check
run: make lint

- name: Run tests
run: cargo test --verbose --lib
run: make tests
5 changes: 2 additions & 3 deletions .github/workflows/on-schedule-nixbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@ jobs:
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- run: mkdir -p /tmp/fzz
- run: nix flake check
- run: nix build .#funzzy --verbose
- run: make nix-flake-check
- run: make nix-build
18 changes: 14 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,22 @@ help: ## Lists the available commands. Add a comment with '##' to describe a com

.PHONY: tests
tests: ## Execute all the tests
@cargo test $UNIT_TEST --verbose --lib
@cargo test --verbose

.PHONY: build
build: tests ## Execute all the tests and build funzzy binary
@cargo build --release

.PHONY: prebuild
prebuild: ## Build the project in non-release mode
@cargo build

.PHONY: integration ## Exectute integration tests
integration:
integration: integration-clean
@cargo test --features test-integration

.PHONY: ci-integration
ci-integration:
ci-integration: integration-clean
@cargo test --features test-integration

.PHONY: lint
Expand All @@ -31,7 +35,9 @@ install: tests ## Install funzzy on your machine

.PHONY: integration-clean
integration-clean:
rm -rf /tmp/fzz || sudo rm -rf /tmp/fzz
echo "Creating a temp dir for integration tests in /tmp/fzz"
rm -rf /tmp/fzz
mkdir -p /tmp/fzz

.PHONY: nix-gen-patch
nix-gen-patch: ## Generate a patch for the nix derivation
Expand All @@ -49,6 +55,10 @@ nix-build-all: nix-build nix-build-nightly ## Build the nix derivation with the
nix-build-local: ## Build the nix derivation with the local toolchain
@nix build .#local --verbose -L

.PHONY: nix-build-nightly
nix-build-nightly: ## Build the nix derivation with the nightly toolchain
@nix build .# --verbose -L

.PHONY: nix-build
nix-build: ## Build the nix derivation with the nightly toolchain
@nix build .# --verbose -L
Expand Down
12 changes: 1 addition & 11 deletions nix/package-from-source.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,7 @@ rustPlatform.buildRustPackage {
# Creating here the temporary directory in order it to be created with
# the right permissions
checkPhase = ''
mkdir -p /tmp/fzz
ls -la /tmp/fzz
touch /tmp/fzz/accepts_full_or_relativepaths.txt
touch /tmp/fzz/accepts_full_or_relativepaths2.txt
touch /tmp/fzz/accepts_full_or_relativepaths3.txt
RUST_BACKTRACE=1 cargo test -- --nocapture
rm -rf /tmp/fzz
RUST_BACKTRACE=1 make integration
'';

# Common commands here
Expand Down
5 changes: 0 additions & 5 deletions nix/package-nightly.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ rustPlatform.buildRustPackage rec {

cargoHash = "sha256-Rs0l7361BtuhV0DsMfeyKe/ryoCZaLWBnrpuVNeRKhU=";

# When installing from source only run unit tests
checkPhase = ''
cargo test $UNIT_TEST --lib
'';

buildInputs = lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.CoreServices
];
Expand Down

0 comments on commit 460af59

Please sign in to comment.