mirror of
https://github.com/lukaszraczylo/semver-generator.git
synced 2026-06-16 01:31:19 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
c08aeae7f1
|
|||
|
915c9a9f71
|
|||
|
7787fe5e6c
|
|||
|
be885367df
|
|||
|
3e885b5e7c
|
@@ -28,7 +28,7 @@ jobs:
|
||||
RELEASE_VERSION: ${{ steps.get_env.outputs.RELEASE_VERSION }}
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: '0'
|
||||
- name: Setting environment variables
|
||||
@@ -37,6 +37,7 @@ jobs:
|
||||
DOWNLOAD_URL=$(curl -s https://api.github.com/repos/lukaszraczylo/semver-generator/releases/latest \
|
||||
| grep browser_download_url \
|
||||
| grep semver-gen-linux-amd64 \
|
||||
| grep -v '.md5' \
|
||||
| cut -d '"' -f 4)
|
||||
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')
|
||||
@@ -59,7 +60,7 @@ jobs:
|
||||
CI: true
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
- name: Lint Code Base
|
||||
if: env.ENABLE_CODE_LINT == true
|
||||
env:
|
||||
@@ -90,7 +91,7 @@ jobs:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
- name: Configure git for private modules
|
||||
run: |
|
||||
make update
|
||||
@@ -111,7 +112,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
- name: Get list of the commits since last release
|
||||
run: |
|
||||
echo "$(git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"%h %s")" > .release_notes
|
||||
@@ -131,7 +132,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
- name: Set up Docker Buildx
|
||||
@@ -201,10 +202,10 @@ jobs:
|
||||
continue-on-error: [true]
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Compile binary
|
||||
- name: Compile and release semver
|
||||
uses: wangyoucao577/go-release-action@v1.32
|
||||
with:
|
||||
github_token: ${{ secrets.GHCR_TOKEN }}
|
||||
@@ -221,6 +222,23 @@ jobs:
|
||||
overwrite: true
|
||||
pre_command: export GODEBUG=http2client=0
|
||||
|
||||
- name: Compile and release v1
|
||||
uses: wangyoucao577/go-release-action@v1.32
|
||||
with:
|
||||
github_token: ${{ secrets.GHCR_TOKEN }}
|
||||
goos: ${{ matrix.goos }}
|
||||
goarch: ${{ matrix.goarch }}
|
||||
ldflags: -s -w -X main.PKG_VERSION=${{ needs.prepare.outputs.RELEASE_VERSION }}
|
||||
project_path: .
|
||||
binary_name: semver-gen
|
||||
asset_name: semver-gen-${{ matrix.goos }}-${{ matrix.goarch }}
|
||||
release_name: version v1
|
||||
release_tag: v1
|
||||
compress_assets: false
|
||||
retry: 10
|
||||
overwrite: true
|
||||
pre_command: export GODEBUG=http2client=0
|
||||
|
||||
# - name: Create Release
|
||||
# id: create_release
|
||||
# uses: marvinpinto/action-automatic-releases@latest
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
FROM golang:1-alpine as baseimg
|
||||
|
||||
RUN apk add make ca-certificates
|
||||
RUN apk add --no-cache make ca-certificates
|
||||
WORKDIR /go/src/app
|
||||
ENV GO111MODULE=on CGO_ENABLED=1 GOOS=linux
|
||||
COPY . /go/src/app/
|
||||
|
||||
+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 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
|
||||
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