Skip to content

Commit

Permalink
fix: gen new build in ci
Browse files Browse the repository at this point in the history
  • Loading branch information
dnitsch committed Feb 3, 2023
1 parent e491e74 commit ded59bf
Show file tree
Hide file tree
Showing 14 changed files with 395 additions and 125 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: CI

on:
push:
branches: [ master, main ]

jobs:
set-deps-dotnet-poop-here:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/dotnet/sdk:6.0
outputs:
semVer: ${{ steps.gitversion.outputs.semVer }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.15
with:
versionSpec: '5.x'
- name: Set SemVer Version
uses: gittools/actions/gitversion/execute@v0.9.15
id: gitversion

- name: echo VERSIONS
run: |
echo "REVISION -> $GITHUB_SHA"
echo "VERSION -> $GITVERSION_SEMVER"
test:
runs-on: ubuntu-latest
container:
image: golang:1.19-bullseye
needs: set-deps-dotnet-poop-here
env:
SEMVER: ${{ needs.set-deps-dotnet-poop-here.outputs.semVer }}
steps:
- uses: actions/checkout@v3
- name: install deps
run: |
apt update && apt install jq -y
make REVISION=$GITHUB_SHA install
- name: make test
run: |
make REVISION=$GITHUB_SHA test
- name: Publish Junit style Test Report
uses: mikepenz/action-junit-report@v3
if: always() # always run even if the previous step fails
with:
report_paths: '**/report-junit.xml'
- name: Analyze with SonarCloud
# You can pin the exact commit or the version.
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Generate a token on Sonarcloud.io, add it to the secrets of this repo with the name SONAR_TOKEN (Settings > Secrets > Actions > add new repository secret)
with:
# Additional arguments for the sonarcloud scanner
args:
# Unique keys of your project and organization. You can find them in SonarCloud > Information (bottom-left menu)
# mandatory
-Dsonar.projectVersion=$SEMVER
-Dsonar.go.coverage.reportPaths=/github/workspace/.coverage/out
-X
64 changes: 64 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: PR

on:
pull_request:
branches: [ master, main ]

jobs:
set-deps-dotnet-poop-here:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/dotnet/sdk:6.0
outputs:
semVer: ${{ steps.gitversion.outputs.semVer }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.15
with:
versionSpec: '5.x'
- name: Set SemVer Version
uses: gittools/actions/gitversion/execute@v0.9.15
id: gitversion

- name: echo VERSIONS
run: |
echo "REVISION -> $GITHUB_SHA"
echo "VERSION -> $GITVERSION_SEMVER"
pr:
runs-on: ubuntu-latest
container:
image: golang:1.19-bullseye
needs: set-deps-dotnet-poop-here
env:
REVISION: $GITHUB_SHA
SEMVER: ${{ needs.set-deps-dotnet-poop-here.outputs.semVer }}
steps:
- uses: actions/checkout@v3
- name: install deps
run: |
apt update && apt install jq -y
make REVISION=$GITHUB_SHA install
- name: make test
run: |
make REVISION=$GITHUB_SHA test
- name: Publish Junit style Test Report
uses: mikepenz/action-junit-report@v3
if: always() # always run even if the previous step fails
with:
report_paths: '**/report-junit.xml'
- name: Analyze with SonarCloud
# You can pin the exact commit or the version.
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Generate a token on Sonarcloud.io, add it to the secrets of this repo with the name SONAR_TOKEN (Settings > Secrets > Actions > add new repository secret)
with:
# Additional arguments for the sonarcloud scanner
args:
# Unique keys of your project and organization. You can find them in SonarCloud > Information (bottom-left menu)
# mandatory
-Dsonar.projectVersion=$SEMVER
-Dsonar.go.coverage.reportPaths=/github/workspace/.coverage/out
53 changes: 53 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: release

on:
workflow_run:
workflows: ['CI']
types:
- completed

jobs:
set-deps-dotnet-poop-here:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
container:
image: mcr.microsoft.com/dotnet/sdk:6.0
outputs:
semVer: ${{ steps.gitversion.outputs.semVer }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.15
with:
versionSpec: '5.x'
- name: Set SemVer Version
uses: gittools/actions/gitversion/execute@v0.9.15
id: gitversion

- name: echo VERSIONS
run: |
echo "REVISION -> $GITHUB_SHA"
echo "VERSION -> $GITVERSION_SEMVER"
release:
runs-on: ubuntu-latest
container:
image: golang:1.19-bullseye
env:
FOO: Bar
needs: set-deps-dotnet-poop-here
env:
SEMVER: ${{ needs.set-deps-dotnet-poop-here.outputs.semVer }}
steps:
- uses: actions/checkout@v3
- name: install deps
run: |
apt update && apt install jq -y
make REVISION=$GITHUB_SHA install
- name: release library
run: make GIT_TAG=${SEMVER} REVISION=$GITHUB_SHA tag
- name: release binary
run: |
make REVISION=$GITHUB_SHA GIT_TAG=${SEMVER} PAT=${{ secrets.GITHUB_TOKEN }} build
make REVISION=$GITHUB_SHA GIT_TAG=${SEMVER} PAT=${{ secrets.GITHUB_TOKEN }} release
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ dist/

# test
.coverage
.DS_Store
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM debian:bullseye

WORKDIR /seeder

COPY dist/uiseeder-linux uiseeder
COPY .ignore-paypal.yml paypal.yml

# RUN apt-get update \
# && apt install -y libnss3

ENTRYPOINT [ "/seeder/uiseeder", "-i", "/seeder/paypal.yml" ]
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ clean:

bingen:
for os in darwin linux windows; do \
GOOS=$$os CGO_ENABLED=0 go build -a -tags netgo -installsuffix netgo $(LDFLAGS) -o dist/uiseeder-$$os ./cmd; \
GOOS=$$os CGO_ENABLED=0 go build -mod=readonly -a -tags netgo -installsuffix netgo $(LDFLAGS) -o dist/uiseeder-$$os ./cmd; \
done

build: clean install bingen

build_ci: clean install_ci bingen

tag:
git tag "v$(GIT_TAG)"
git push origin "v$(GIT_TAG)"
git tag -a $(VERSION) -m "ci tag release uistrategy" $(REVISION)
git push origin $(VERSION)

release:
OWNER=$(OWNER) NAME=$(NAME) PAT=$(PAT) VERSION=$(VERSION) . hack/release.sh
Expand All @@ -42,7 +42,7 @@ btr: build tag release

# TEST
test: test_prereq
go test `go list ./... | grep -v */generated/` -v -mod=readonly -coverprofile=.coverage/out | go-junit-report > .coverage/report-junit.xml && \
go test `go list ./... | grep -v */generated/` -v -mod=readonly -race -coverprofile=.coverage/out | go-junit-report > .coverage/report-junit.xml && \
gocov convert .coverage/out | gocov-xml > .coverage/report-cobertura.xml

test_ci:
Expand All @@ -52,4 +52,4 @@ test_prereq:
mkdir -p .coverage
go install github.com/jstemmer/go-junit-report/v2@latest && \
go install github.com/axw/gocov/gocov@latest && \
go install github.com/AlekSi/gocov-xml@latest
go install github.com/AlekSi/gocov-xml@latest
Loading

0 comments on commit ded59bf

Please sign in to comment.