From d7d9e9ac5463a0190d302dfc8118bcd6391a72e0 Mon Sep 17 00:00:00 2001 From: Eduardo Folly Date: Mon, 12 Feb 2024 18:35:11 -0300 Subject: [PATCH] Updating tests. --- .github/workflows/main.yml | 19 +++++++++++-------- .github/workflows/test.yml | 11 ++++++++++- Dockerfile | 2 +- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d7899aa..031cd56 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,32 +14,35 @@ jobs: contents: write steps: - name: Code Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Get Version run: | - VERSION=$(grep 'version:' version.yaml | cut -c 10-) + echo "TAGS=latest" >> $GITHUB_ENV + SUFFIX="" + VERSION=$(grep 'version:' version.yaml | cut -c 10-)$SUFFIX echo "VERSION=$VERSION" >> $GITHUB_ENV echo "REPO=$GITHUB_REPOSITORY" >> $GITHUB_ENV echo "OWNER=$GITHUB_REPOSITORY_OWNER" >> $GITHUB_ENV - name: Check if version is used run: | - URL=$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases/latest - LATEST=$(curl --silent "$URL" | jq -r .name) - if [ "$LATEST" == "$VERSION" ]; then - echo "Version already used: v$VERSION" + URL=$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases/tags/${{ env.VERSION }} + echo "$URL" + CODE=$(curl -s -o /dev/null -w "%{http_code}" "$URL") + if [ "$CODE" != 404 ]; then + echo "Release '$VERSION' already exists. ($CODE)" exit 1 fi - name: Login to DockerHub - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: username: ${{ env.OWNER }} password: ${{ secrets.DOCKER_TOKEN }} - name: Docker Build & Push - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v5 with: push: true context: . diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4e2f08d..9c0556f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,9 +10,16 @@ jobs: name: Tests runs-on: ubuntu-latest timeout-minutes: 20 + strategy: + matrix: + alpine: + - 3.16 + - 3.17 + - 3.18 + - 3.19 steps: - name: Code Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install sshpass env: @@ -22,4 +29,6 @@ jobs: sudo apt-get install sshpass -y - name: Running Tests + env: + ALPINE_VERSION: ${{ matrix.alpine }} run: ./test.sh diff --git a/Dockerfile b/Dockerfile index 1c3ae09..09dd69b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.17 +FROM alpine:${ALPINE_VERSION:-3.19} RUN apk add --no-cache openssh sshpass