From 505589e9e91106e8f83b7d75323b59c5bf313c31 Mon Sep 17 00:00:00 2001 From: Nicolas Chan Date: Sat, 20 Mar 2021 02:04:24 -0700 Subject: [PATCH] Update actions --- .github/workflows/ci.yml | 10 +++++++--- .github/workflows/docker-image.yml | 21 --------------------- test/test.sh | 6 +++--- 3 files changed, 10 insertions(+), 27 deletions(-) delete mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e7a6e64..02c6f91 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,8 +11,7 @@ on: # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "build" - test: + build: # The type of runner that the job will run on runs-on: ubuntu-latest @@ -40,4 +39,9 @@ jobs: - name: shellcheck run: shellcheck backup.sh - + + - name: Build the Docker image + run: | + echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin + docker build . --file Dockerfile --tag ghcr.io/nicolaschan/minecraft-backup:$GITHUB_SHA + docker push ghcr.io/nicolaschan/minecraft-backup:$GITHUB_SHA diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml deleted file mode 100644 index c86dda4..0000000 --- a/.github/workflows/docker-image.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Docker Image CI - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Build the Docker image - run: | - echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin - docker build . --file Dockerfile --tag ghcr.io/nicolaschan/minecraft-backup:$GITHUB_SHA - docker push ghcr.io/nicolaschan/minecraft-backup:$GITHUB_SHA diff --git a/test/test.sh b/test/test.sh index 15a2a9e..dba1b68 100755 --- a/test/test.sh +++ b/test/test.sh @@ -295,9 +295,10 @@ test-thinning-delete () { test-thinning-delete-long () { for i in $(seq 0 99); do TIMESTAMP="$(date +%F_%H-%M-%S --date="2021-01-01 +$i day")" - OUTPUT="$(./backup.sh -v -i "$TEST_TMP/server/world" -o "$TEST_TMP/backups" -s "$SCREEN_TMP" -f "$TIMESTAMP")" + OUTPUT="$(./backup.sh -v -m 73 -i "$TEST_TMP/server/world" -o "$TEST_TMP/backups" -s "$SCREEN_TMP" -f "$TIMESTAMP")" done UNEXPECTED_TIMESTAMPS=( + "2021-01-04_00-00-00" "2021-01-05_00-00-00" "2021-01-12_00-00-00" "2021-01-24_00-00-00" @@ -305,10 +306,9 @@ test-thinning-delete-long () { for TIMESTAMP in "${UNEXPECTED_TIMESTAMPS[@]}"; do assertFalse '[ -f '"$TEST_TMP/backups/$TIMESTAMP.tar.gz"' ]' done - assertEquals 74 "$(find "$TEST_TMP/backups" -type f | wc -l)" + assertEquals 73 "$(find "$TEST_TMP/backups" -type f | wc -l)" EXPECTED_TIMESTAMPS=( # Weekly - "2021-01-04_00-00-00" "2021-01-11_00-00-00" "2021-01-25_00-00-00" "2021-01-25_00-00-00"