chore: matrix build (#106)

* chore: matrix build

* chore: test goos goarch

* fix: artifact path

* chore: new download version

* artifact paths
This commit is contained in:
Florian Forster 2020-05-14 07:38:58 +02:00 committed by GitHub
parent 92a294f5c8
commit 767bc5ce6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 15 deletions

View File

@ -84,23 +84,28 @@ jobs:
go-build: go-build:
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
needs: [angular-build, angular-test, angular-lint, go-test] ### We need the artifact from the angular build and that's why we wait here needs: [angular-build, angular-test, angular-lint, go-test] ### We need the artifact from the angular build and that's why we wait here
name: Build ${{ matrix.goos }}-${{ matrix.goarch }}
strategy:
matrix:
goos: [ 'linux', 'darwin', 'windows' ]
goarch: ['amd64']
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-go@v2-beta - uses: actions/setup-go@v2-beta
with: with:
go-version: ${{ env.GO_VERSION }} go-version: ${{ env.GO_VERSION }}
- uses: actions/download-artifact@v1 - uses: actions/download-artifact@v2
with: with:
name: angular name: angular
path: console/dist/app path: console/dist/app
- run: go get github.com/rakyll/statik - run: go get github.com/rakyll/statik
- run: ./build/console/generate-static.sh - run: ./build/console/generate-static.sh
- run: cat pkg/console/statik/statik.go - run: cat pkg/console/statik/statik.go
- run: CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -o zitadel cmd/zitadel/main.go - run: CGO_ENABLED=0 GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -o zitadel-${{ matrix.goos }}-${{ matrix.goarch }} cmd/zitadel/main.go
- uses: actions/upload-artifact@v1 - uses: actions/upload-artifact@v1
with: with:
name: go-binary name: zitadel-${{ matrix.goos }}-${{ matrix.goarch }}
path: zitadel path: zitadel-${{ matrix.goos }}-${{ matrix.goarch }}
container-prod: container-prod:
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
@ -108,10 +113,10 @@ jobs:
steps: steps:
- name: Source checkout - name: Source checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- uses: actions/download-artifact@v1 - uses: actions/download-artifact@v2
with: with:
name: go-binary name: zitadel-linux-amd64
path: .build/go path: .artifacts
- uses: docker/build-push-action@v1 - uses: docker/build-push-action@v1
with: with:
dockerfile: build/docker/prod dockerfile: build/docker/prod
@ -175,6 +180,12 @@ jobs:
- name: Generate Short SHA Container Tag - name: Generate Short SHA Container Tag
id: vars id: vars
run: echo "::set-output name=sha_short::SHA-$(git rev-parse --short HEAD)" run: echo "::set-output name=sha_short::SHA-$(git rev-parse --short HEAD)"
- uses: actions/download-artifact@v2
with:
path: .artifacts
- name: Display structure of downloaded files
run: ls -R
working-directory: .artifacts
- name: Docker Login - name: Docker Login
run: docker login $REGISTRY -u $GITHUB_ACTOR -p $GITHUB_TOKEN run: docker login $REGISTRY -u $GITHUB_ACTOR -p $GITHUB_TOKEN
- name: Docker Pull short-sha - name: Docker Pull short-sha
@ -182,7 +193,7 @@ jobs:
- name: Semantic Release - name: Semantic Release
uses: cycjimmy/semantic-release-action@v2 uses: cycjimmy/semantic-release-action@v2
with: with:
dry_run:  false dry_run: false
semantic_version: 17.0.4 semantic_version: 17.0.4
extra_plugins: | extra_plugins: |
@semantic-release/exec@5.0.0 @semantic-release/exec@5.0.0

View File

@ -3,7 +3,13 @@ module.exports = {
plugins: [ plugins: [
"@semantic-release/commit-analyzer", "@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator", "@semantic-release/release-notes-generator",
"@semantic-release/github", ["@semantic-release/github", {
"assets": [
{"path": ".artifacts/zitadel-darwin-amd64/zitadel-darwin-amd64", "label": "Darwin x86_64"},
{"path": ".artifacts/zitadel-linux-amd64/zitadel-linux-amd64", "label": "Linux x86_64"},
{"path": ".artifacts/zitadel-windows-amd64/zitadel-windows-amd64", "label": "Windows x86_64"}
]
}],
["@semantic-release/exec", { ["@semantic-release/exec", {
"publishCmd": "echo '::set-env name=CAOS_NEXT_VERSION::${nextRelease.version}'" "publishCmd": "echo '::set-env name=CAOS_NEXT_VERSION::${nextRelease.version}'"
}], }],

View File

@ -1,18 +1,15 @@
# # This Stage prepares the user in the container and copies the files
FROM alpine:latest as prepare FROM alpine:latest as prepare
RUN adduser -D zitadel RUN adduser -D zitadel
COPY .build/go/zitadel / COPY .artifacts/zitadel-linux-amd64 /zitadel
COPY cmd/zitadel/*.yaml / COPY cmd/zitadel/*.yaml /
RUN chmod a+x /zitadel RUN chmod a+x /zitadel
# # This Stage is intended as production image
FROM scratch as final FROM scratch as final
COPY --from=prepare /etc/passwd /etc/passwd COPY --from=prepare /etc/passwd /etc/passwd
COPY --from=prepare / / COPY --from=prepare / /
USER zitadel USER zitadel
HEALTHCHECK NONE HEALTHCHECK NONE
ENTRYPOINT ["/zitadel"] ENTRYPOINT ["/zitadel"]
## TODO enable CMD ## TODO enable CMD