Skip to content

Commit

Permalink
run workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
lens0021 committed Dec 17, 2024
1 parent 042c595 commit bed9f17
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 35 deletions.
54 changes: 29 additions & 25 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@ name: Cargo & Clippy Test

on:
push:
branches: [master]
paths:
- src/**
- test_files/**
- .cargo/**
- Cargo.toml
- Cargo.lock
- rust-toolchain.toml
- flake.nix
- flake.lock
pull_request:
paths:
- src/**
- test_files/**
- .cargo/**
- Cargo.toml
- Cargo.lock
- rust-toolchain.toml
- flake.nix
- flake.lock
# branches: [master]
# paths:
# - src/**
# - test_files/**
# - .cargo/**
# - Cargo.toml
# - Cargo.lock
# - rust-toolchain.toml
# - flake.nix
# - flake.lock
# pull_request:
# paths:
# - src/**
# - test_files/**
# - .cargo/**
# - Cargo.toml
# - Cargo.lock
# - rust-toolchain.toml
# - flake.nix
# - flake.lock

env:
CARGO_TERM_COLOR: always
Expand Down Expand Up @@ -72,10 +72,10 @@ jobs:
# - "bash:4.0"
# - "bash:3.2"
sed:
- GNU sed
- GNU_sed
# Uncomment the next matrix when https://github.com/amber-lang/amber/issues/617 is resolved
# include:
# - sed: BusyBox sed
# - sed: BusyBox_sed
# bash_version: "bash:latest"
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -111,8 +111,12 @@ jobs:
if [ -f "~/docker-images/${{ matrix.bash_docker_image }}-${{ matrix.sed }}" ]; then
docker load -i "~/docker-images/${{ matrix.bash_docker_image }}-${{ matrix.sed }}"
else
docker build --tag testbash
docker save -o "~/docker-images/${{ matrix.bash_docker_image }}-${{ matrix.sed }}"
docker build --tag testenv -f TestEnvDockerfile \
--build-arg "BASE_BASH_IMAGE=${{ matrix.bash_docker_image }}" \
--build-arg "INSTALL_GNU_SED=${{ matrix.sed }}" \
.
mkdir ~/docker-images
docker save -o "~/docker-images/${{ matrix.bash_docker_image }}-${{ matrix.sed }}" testenv
fi
- name: Run cargo tests
env:
Expand All @@ -122,7 +126,7 @@ jobs:
test_container
bash
run: |
docker run --network host --detach --name test_container testbash
docker run --network host --detach --name test_container testenv
cargo test --all-targets --all-features
docker stop test_container -t 0
docker rm --force test_container
Expand Down
18 changes: 8 additions & 10 deletions TestEnvDockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
LABEL description="Used to test the compiled bash script for various environment."

ARG BASE_BASE_IMAGE=bash:5.2
ARG INSTALL_GNU_SED
FROM $BASE_BASE_IMAGE

# A non-root user(guest) is required by is_root() test
RUN useradd -m appuser
USER appuser
WORKDIR /home/appuser

RUN apk add \
curl \
# Includes mktemp
coreutils \
;

RUN if [ -n "$INSTALL_GNU_SED" ]; then \
apk add sed \
RUN if [ "$INSTALL_GNU_SED" == "GNU_sed" ]; \
then apk add sed; \
fi

# A non-root user(guest) is required by is_root() test
RUN adduser -D appuser
USER appuser
WORKDIR /home/appuser

CMD ["sleep", "infinity"]
LABEL description="Used to test the compiled bash script for various environment."

0 comments on commit bed9f17

Please sign in to comment.