-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Add workflow for tests, currently without tests that require yt-d…
…lp or spotify credentials To run all tests, use `make test`
- Loading branch information
Showing
5 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Run tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- "main" | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# No checkout step here because build-push-action uses git context by default: | ||
# https://github.com/marketplace/actions/build-and-push-docker-images#git-context | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Build and test | ||
uses: docker/build-push-action@v5 | ||
with: | ||
file: Dockerfile.test | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM rust:alpine as builder | ||
|
||
# Dependencies for some crates | ||
RUN apk add --no-cache alpine-sdk cmake | ||
|
||
WORKDIR /usr/src/app | ||
|
||
# First build a dummy target to cache dependencies in a separate Docker layer | ||
COPY Cargo.toml Cargo.lock ./ | ||
RUN mkdir src && echo 'fn main() { println!("Dummy image called!"); }' > src/main.rs | ||
RUN cargo build | ||
|
||
# Now run tests | ||
COPY src ./src | ||
# Update modified attribute as otherwise cargo won't rebuild it | ||
RUN touch -a -m ./src/main.rs | ||
RUN cargo test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters