mirror of
https://github.com/lukaszraczylo/semver-generator.git
synced 2026-06-20 01:51:22 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
7787fe5e6c
|
|||
|
be885367df
|
|||
|
3e885b5e7c
|
@@ -28,7 +28,7 @@ jobs:
|
|||||||
RELEASE_VERSION: ${{ steps.get_env.outputs.RELEASE_VERSION }}
|
RELEASE_VERSION: ${{ steps.get_env.outputs.RELEASE_VERSION }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: '0'
|
fetch-depth: '0'
|
||||||
- name: Setting environment variables
|
- name: Setting environment variables
|
||||||
@@ -37,6 +37,7 @@ jobs:
|
|||||||
DOWNLOAD_URL=$(curl -s https://api.github.com/repos/lukaszraczylo/semver-generator/releases/latest \
|
DOWNLOAD_URL=$(curl -s https://api.github.com/repos/lukaszraczylo/semver-generator/releases/latest \
|
||||||
| grep browser_download_url \
|
| grep browser_download_url \
|
||||||
| grep semver-gen-linux-amd64 \
|
| grep semver-gen-linux-amd64 \
|
||||||
|
| grep -v '.md5' \
|
||||||
| cut -d '"' -f 4)
|
| cut -d '"' -f 4)
|
||||||
curl -s -L -o semver-gen "$DOWNLOAD_URL" && chmod +x semver-gen
|
curl -s -L -o semver-gen "$DOWNLOAD_URL" && chmod +x semver-gen
|
||||||
TMP_SANITISED_REPOSITORY_NAME=$(echo ${{ github.event.repository.name }} | sed -e 's|\.|-|g')
|
TMP_SANITISED_REPOSITORY_NAME=$(echo ${{ github.event.repository.name }} | sed -e 's|\.|-|g')
|
||||||
@@ -59,7 +60,7 @@ jobs:
|
|||||||
CI: true
|
CI: true
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
- name: Lint Code Base
|
- name: Lint Code Base
|
||||||
if: env.ENABLE_CODE_LINT == true
|
if: env.ENABLE_CODE_LINT == true
|
||||||
env:
|
env:
|
||||||
@@ -90,7 +91,7 @@ jobs:
|
|||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
- name: Configure git for private modules
|
- name: Configure git for private modules
|
||||||
run: |
|
run: |
|
||||||
make update
|
make update
|
||||||
@@ -111,7 +112,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
- name: Get list of the commits since last release
|
- name: Get list of the commits since last release
|
||||||
run: |
|
run: |
|
||||||
echo "$(git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"%h %s")" > .release_notes
|
echo "$(git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"%h %s")" > .release_notes
|
||||||
@@ -131,7 +132,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v1
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
@@ -201,7 +202,7 @@ jobs:
|
|||||||
continue-on-error: [true]
|
continue-on-error: [true]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Compile binary
|
- name: Compile binary
|
||||||
|
|||||||
+50
-1
@@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
|
|||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
@@ -581,3 +581,52 @@ func (suite *Tests) Test_parseExistingSemver() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (suite *Tests) TestSetup_ListExistingTags() {
|
||||||
|
type fields struct {
|
||||||
|
RepositoryName string
|
||||||
|
RepositoryLocalPath string
|
||||||
|
RepositoryHandler *git.Repository
|
||||||
|
LocalConfigFile string
|
||||||
|
Commits []CommitDetails
|
||||||
|
Semver SemVer
|
||||||
|
Wording Wording
|
||||||
|
Force Force
|
||||||
|
}
|
||||||
|
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
fields fields
|
||||||
|
noTags bool
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "List tags from existing repository",
|
||||||
|
fields: fields{
|
||||||
|
RepositoryName: "https://github.com/lukaszraczylo/simple-gql-client",
|
||||||
|
},
|
||||||
|
noTags: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "List tags from non-existing repository",
|
||||||
|
fields: fields{
|
||||||
|
RepositoryName: "https://github.com/lukaszraczylo/simple-gql-client-dead",
|
||||||
|
},
|
||||||
|
noTags: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
for _, tt := range tests {
|
||||||
|
suite.T().Run(tt.name, func(t *testing.T) {
|
||||||
|
s := &Setup{}
|
||||||
|
s.ReadConfig(tt.fields.LocalConfigFile)
|
||||||
|
s.RepositoryName = tt.fields.RepositoryName
|
||||||
|
s.Force = tt.fields.Force
|
||||||
|
s.Prepare()
|
||||||
|
s.ListExistingTags()
|
||||||
|
if tt.noTags {
|
||||||
|
assert.Equal(len(s.Tags), 0, "Unexpected number of tags in "+tt.name)
|
||||||
|
} else {
|
||||||
|
assert.GreaterOrEqual(len(s.Tags), 1, "Unexpected number of tags in "+tt.name)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user