Skip to content

Commit

Permalink
ci: Use make in the pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
tomphp committed Oct 24, 2023
1 parent 0ae7cb4 commit 4b18179
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 25 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,16 @@ jobs:
id: get-binary-name
with:
name: versioned-files
- uses: actions-rs/cargo@v1.0.3
name: Build release version
with:
args: --release --locked
command: build
- name: Build release version
run: make "$BINARY_NAME"
env:
BINARY_NAME: ${{ steps.get-binary-name.outputs.name }}
shell: bash
- name: Move binary to upload location
env:
BINARY_NAME: ${{ steps.get-binary-name.outputs.name }}
BINARY_NAME_WITH_ARCH: ${{ steps.get-binary-name.outputs.name-with-arch }}
run: mv "./target/release/$BINARY_NAME" "./$BINARY_NAME_WITH_ARCH"
run: mv "$BINARY_NAME" "$BINARY_NAME_WITH_ARCH"
shell: bash
- uses: actions/upload-artifact@v3
name: Store built binary version
Expand Down
21 changes: 7 additions & 14 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ jobs:
takeown /F 'C:\Windows\System32\bash.exe'
icacls 'C:\Windows\System32\bash.exe' /grant administrators:F
ren 'C:\Windows\System32\bash.exe' wsl-bash.exe
- run: cargo build --release
- run: echo "$PWD/target/debug" >> "$GITHUB_PATH"
shell: bash
- run: cargo test --locked
- name: Run tests
run: make test
shell: bash

lint:
Expand All @@ -53,14 +51,9 @@ jobs:
- uses: tomphp/github-actions/checkout-rust-project@v0.2.0
with:
rust-components: rustfmt, clippy
- uses: actions-rs/cargo@v1.0.3
with:
command: fmt
args: --all -- --check
- uses: actions-rs/cargo@v1.0.3
with:
command: clippy
args: --all-targets --all-features -- -D warnings -Dclippy::all -D clippy::pedantic
-D clippy::cargo -A clippy::multiple-crate-versions
- uses: gaurav-nelson/github-action-markdown-link-check@1.0.15
- name: Check code
run: make lint
shell: bash
- name: Check markdown links
uses: gaurav-nelson/github-action-markdown-link-check@1.0.15
if: matrix.os == 'ubuntu-latest'
19 changes: 14 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
SOURCE_FILES := $(shell find src -type f)

target/debug/versioned-files: Cargo.toml Cargo.lock src/ $(SOURCE_FILES)
ifeq ($(OS),Windows_NT)
TARGET_EXTENSION := .exe
else
TARGET_EXTENSION :=
endif

TARGET := versioned-files$(TARGET_EXTENSION)

target/debug/$(TARGET): Cargo.toml Cargo.lock src/ $(SOURCE_FILES)
cargo build

target/release/versioned-files: Cargo.toml Cargo.lock src/ $(SOURCE_FILES)
target/release/$(TARGET): Cargo.toml Cargo.lock src/ $(SOURCE_FILES)
cargo build --release

versioned-files: target/release/versioned-files
mv target/release/versioned-files .
$(TARGET): target/release/$(TARGET)
mv target/release/$@ .

.PHONY=clean
clean:
rm -rf target/
rm -f $(TARGET)

.PHONY=check
lint:
Expand All @@ -25,7 +34,7 @@ format:
cargo fmt --all

.PHONY=test-integration
test-integration: target/release/versioned-files
test-integration: target/release/$(TARGET)
cargo test --test '*' --locked

.PHONY=test-unit
Expand Down

0 comments on commit 4b18179

Please sign in to comment.