Skip to content

Commit

Permalink
Updating tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
edufolly committed Feb 12, 2024
1 parent 575ba42 commit d7d9e9a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/#-action@v2
uses: docker/#-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: .
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -22,4 +29,6 @@ jobs:
sudo apt-get install sshpass -y
- name: Running Tests
env:
ALPINE_VERSION: ${{ matrix.alpine }}
run: ./test.sh
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.17
FROM alpine:${ALPINE_VERSION:-3.19}

RUN apk add --no-cache openssh sshpass

Expand Down

0 comments on commit d7d9e9a

Please # to comment.