diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bbae72c..744fbbd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,7 +1,7 @@ name: build concurrency: - group: build-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true on: @@ -13,8 +13,6 @@ on: paths-ignore: - '**.md' pull_request: - branches: - - 'master' paths-ignore: - '**.md' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ed86574..8199dae 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,9 @@ name: test +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + on: push: branches: @@ -7,13 +11,11 @@ on: paths-ignore: - '**.md' pull_request: - branches: - - 'master' paths-ignore: - '**.md' env: - BUILD_TAG: test + BUILD_TAG: samba:test CONTAINER_NAME: samba jobs: @@ -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 @@ -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 }} diff --git a/README.md b/README.md index c882be3..18e4ab8 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 @@ -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 diff --git a/examples/compose/docker-compose.yml b/examples/compose/compose.yml similarity index 95% rename from examples/compose/docker-compose.yml rename to examples/compose/compose.yml index 952efcf..43b94c9 100644 --- a/examples/compose/docker-compose.yml +++ b/examples/compose/compose.yml @@ -1,4 +1,4 @@ -version: "3.5" +name: samba services: samba: diff --git a/test/compose.yml b/test/compose.yml new file mode 100644 index 0000000..a2a07fa --- /dev/null +++ b/test/compose.yml @@ -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 diff --git a/.github/config-test.yml b/test/data/config.yml similarity index 100% rename from .github/config-test.yml rename to test/data/config.yml diff --git a/test/yyy_password b/test/yyy_password new file mode 100644 index 0000000..e132db2 --- /dev/null +++ b/test/yyy_password @@ -0,0 +1 @@ +zzz \ No newline at end of file