pupate

No description provided
git clone https://git.woozle.org/neale/pupate.git

Neale Pickett  ·  2025-03-10

.gitlab-ci.yml

 1stages:
 2  - test
 3  - build
 4  - push
 5
 6variables:
 7  PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${CI_COMMIT_TAG}"
 8
 9test:
10  stage: test
11  image: &goimage golang:1.23
12  script:
13    - go test -coverprofile=coverage.txt -covermode=atomic -race ./...
14    - go tool cover -html=coverage.txt -o coverage.html
15    - go tool cover -func coverage.txt
16  coverage: /\(statements\)(?:\s+)?(\d+(?:\.\d+)?%)/
17  artifacts:
18    paths:
19    - coverage.html
20    - coverage.txt
21
22build:
23  stage: build
24  image: *goimage
25  script:
26    - GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -o ./bin/windows.amd64/ ./...
27    - GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o ./bin/linux.amd64/ ./...
28    - GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -o ./bin/linux.arm64/ ./...
29    - GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -o ./bin/darwin.amd64/ ./...
30    - GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -o ./bin/darwin.arm64/ ./...
31    - mkdir ./bin/darwin.multiarch/
32    - go run github.com/randall77/makefat@latest ./bin/darwin.multiarch/cocoon ./bin/darwin.amd64/cocoon ./bin/darwin.arm64/cocoon
33    - go run github.com/randall77/makefat@latest ./bin/darwin.multiarch/pupate ./bin/darwin.amd64/pupate ./bin/darwin.arm64/pupate
34  rules:
35    - if: $CI_COMMIT_TAG
36    - if: $CI_COMMIT_BRANCH
37  artifacts:
38    paths:
39      - bin/
40
41container:
42  stage: push
43  needs:
44    - job: build
45  rules:
46    - if: $CI_COMMIT_TAG
47    - if: $CI_COMMIT_BRANCH
48  script:
49    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
50    - docker build --tag=$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME -f build/Dockerfile .
51    - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
52
53binaries:
54  stage: push
55  image: curlimages/curl
56  needs:
57    - job: build
58      artifacts: true
59  rules:
60    - if: $CI_COMMIT_TAG
61  script:
62    - ls
63    - 'curl --silent --fail-with-body --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file "./bin/windows.amd64/{cocoon,pupate}.exe" "${PACKAGE_REGISTRY_URL}/windows.amd64/"'
64    - 'curl --silent --fail-with-body --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file "./bin/linux.amd64/{cocoon,pupate}" "${PACKAGE_REGISTRY_URL}/linux.amd64/"'
65    - 'curl --silent --fail-with-body --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file "./bin/darwin.multiarch/{cocoon,pupate}" "${PACKAGE_REGISTRY_URL}/darwin.multiarch/"'
66
67release:
68  stage: push
69  image: registry.gitlab.com/gitlab-org/release-cli:latest
70  needs:
71    - job: container
72    - job: binaries
73  rules:
74    - if: $CI_COMMIT_TAG
75  script:
76    - echo "Creating release"
77    - awk -v rel=$CI_COMMIT_TAG '/^## / {p = ($2 == rel); next} (p) {print}' docs/CHANGELOG.md > release-notes.md
78  release:
79    name: 'Release $CI_COMMIT_TAG'
80    tag_name: '$CI_COMMIT_TAG'
81    description: release-notes.md
82    assets:
83      links:
84        - name: 'Container Image'
85          url: "https://$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG:$CI_COMMIT_SHA"
86          link_type: image
87        - name: 'Windows amd64 HTTP development tool'
88          url: "${PACKAGE_REGISTRY_URL}/windows.amd64/cocoon.exe"
89        - name: 'Linux amd64 HTTP development tool'
90          url: "${PACKAGE_REGISTRY_URL}/linux.amd64/cocoon"
91        - name: 'MacOS HTTP development tool'
92          url: "${PACKAGE_REGISTRY_URL}/darwin.multiarch/cocoon"