mirror of
https://github.com/git-chglog/git-chglog.git
synced 2026-01-22 18:06:11 +00:00
fix(ci): add integration test with docker image (#226)
* fix: add git safe directory for /workdir * chore: use docker staged build
This commit is contained in:
parent
b0f4afeff4
commit
f3cf5b67a0
2 changed files with 51 additions and 3 deletions
29
.github/workflows/ci.yml
vendored
29
.github/workflows/ci.yml
vendored
|
|
@ -59,3 +59,32 @@ jobs:
|
|||
uses: golangci/golangci-lint-action@v3
|
||||
with:
|
||||
version: ${{ env.GOLANGCI_VERSION }}
|
||||
|
||||
integration-tests:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Updating and upgrading brew
|
||||
if: matrix.os == 'macos-latest'
|
||||
run: |
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||
brew --version
|
||||
- name: Install docker-cli and start colima
|
||||
if: matrix.os == 'macos-latest'
|
||||
# https://github.com/docker/for-mac/issues/2359#issuecomment-943131345
|
||||
run: |
|
||||
brew install docker
|
||||
colima start
|
||||
docker info
|
||||
- name: Test docker image
|
||||
run: |
|
||||
docker build -t git-chglog:ci-build .
|
||||
docker run -v ${GITHUB_WORKSPACE}:/workdir -w /workdir git-chglog:ci-build > ${GITHUB_WORKSPACE}/ci-build.md
|
||||
head ${GITHUB_WORKSPACE}/ci-build.md
|
||||
25
Dockerfile
25
Dockerfile
|
|
@ -1,9 +1,28 @@
|
|||
FROM alpine:3.17.1
|
||||
##################
|
||||
########## Builder
|
||||
##################
|
||||
FROM golang:1.19-alpine as builder
|
||||
|
||||
RUN apk add --no-cache make git
|
||||
|
||||
WORKDIR /build
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN make build
|
||||
|
||||
##################
|
||||
########## PROD
|
||||
##################
|
||||
FROM alpine
|
||||
|
||||
RUN apk add --no-cache git && \
|
||||
mkdir /workdir
|
||||
mkdir /workdir && \
|
||||
git config --global --add safe.directory /workdir
|
||||
|
||||
COPY git-chglog /usr/local/bin/git-chglog
|
||||
COPY --from=builder /build/git-chglog /usr/local/bin/git-chglog
|
||||
|
||||
WORKDIR /workdir
|
||||
RUN chmod +x /usr/local/bin/git-chglog
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue