Skip to content

Commit

Permalink
Merge pull request #84 from crazy-max/test-compose-stack
Browse files Browse the repository at this point in the history
ci: use compose stack for testing
  • Loading branch information
crazy-max committed Aug 13, 2023
2 parents 7449768 + b1e1de3 commit 094dd61
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 25 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: build

concurrency:
group: build-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
Expand All @@ -13,8 +13,6 @@ on:
paths-ignore:
- '**.md'
pull_request:
branches:
- 'master'
paths-ignore:
- '**.md'

Expand Down
37 changes: 22 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
name: test

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
push:
branches:
- 'master'
paths-ignore:
- '**.md'
pull_request:
branches:
- 'master'
paths-ignore:
- '**.md'

env:
BUILD_TAG: test
BUILD_TAG: samba:test
CONTAINER_NAME: samba

jobs:
Expand All @@ -37,15 +39,13 @@ jobs:
env:
DEFAULT_TAG: ${{ env.BUILD_TAG }}
-
name: Start container
name: Start
run: |
printf %s "zzz" > /tmp/baz_password
docker rm -f ${{ env.CONTAINER_NAME }} > /dev/null 2>&1 || true
docker run -d --name ${{ env.CONTAINER_NAME }} \
-e "BROWSABLE=yes" \
-v "$(pwd)/.github/config-test.yml:/data/config.yml:ro" \
-v "/tmp/baz_password:/tmp/baz_password:ro" \
${{ env.BUILD_TAG }}
docker compose up -d
working-directory: test
env:
SAMBA_IMAGE: ${{ env.BUILD_TAG }}
SAMBA_CONTAINER: ${{ env.CONTAINER_NAME }}
-
name: Check container logs
uses: crazy-max/.github/.github/actions/container-logs-check@main
Expand All @@ -56,10 +56,17 @@ jobs:
-
name: Dump smb.conf
run: |
docker exec -t ${{ env.CONTAINER_NAME }} cat /etc/samba/smb.conf
docker compose exec ${{ env.CONTAINER_NAME }} cat /etc/samba/smb.conf
working-directory: test
env:
SAMBA_IMAGE: ${{ env.BUILD_TAG }}
SAMBA_CONTAINER: ${{ env.CONTAINER_NAME }}
-
name: Container logs
name: Logs
if: always()
run: |
docker logs ${{ env.CONTAINER_NAME }}
docker rm -f ${{ env.CONTAINER_NAME }} > /dev/null 2>&1 || true
docker compose logs
working-directory: test
env:
SAMBA_IMAGE: ${{ env.BUILD_TAG }}
SAMBA_CONTAINER: ${{ env.CONTAINER_NAME }}
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ in `/var/samba/` on your host for example. Edit the compose and configuration fi
following commands:

```bash
docker-compose up -d
docker-compose logs -f
docker compose up -d
docker compose logs -f
```

### Command line
Expand All @@ -201,8 +201,8 @@ docker run -d --network host \
Recreate the container whenever I push an update:

```bash
docker-compose pull
docker-compose up -d
docker compose pull
docker compose up -d
```

## Notes
Expand Down Expand Up @@ -253,8 +253,8 @@ services:
Use the following commands to check the logs and status:

```shell
docker-compose logs samba
docker-compose exec samba smbstatus
docker compose logs samba
docker compose exec samba smbstatus
```

## Contributing
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "3.5"
name: samba

services:
samba:
Expand Down
18 changes: 18 additions & 0 deletions test/compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: samba

services:
samba:
image: ${SAMBA_IMAGE:-crazymax/samba}
container_name: ${SAMBA_CONTAINER:-samba}
network_mode: host
volumes:
- "./data:/data"
- "./public:/samba/public"
- "./share:/samba/share"
- "./foo:/samba/foo"
- "./foo-baz:/samba/foo-baz"
- "./yyy_password:/tmp/yyy_password:ro"
environment:
- "TZ=Europe/Paris"
- "BROWSABLE=yes"
restart: always
File renamed without changes.
1 change: 1 addition & 0 deletions test/yyy_password
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
zzz

0 comments on commit 094dd61

Please sign in to comment.