Skip to content

Commit 07513b9

Browse files
authored
build: pkg on windows, install on linux (#692)
* build: pkg on windows, install on linux Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> * fix: paths * fix: path again Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> * fix: build * fix: build * fix: full test * fix: use sha_short as cache key --------- Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
1 parent c87f56f commit 07513b9

File tree

1 file changed

+55
-16
lines changed

1 file changed

+55
-16
lines changed

.github/workflows/build.yml

+55-16
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ on:
77
branches:
88
- main
99
paths:
10-
- 'go.*'
11-
- '**/*.go'
12-
- 'Taskfile.yml'
13-
- 'Dockerfile'
14-
- '.github/workflows/build.yml'
15-
- 'testdata/**'
10+
- "go.*"
11+
- "**/*.go"
12+
- "Taskfile.yml"
13+
- "Dockerfile"
14+
- ".github/workflows/build.yml"
15+
- "testdata/**"
1616
pull_request:
1717
paths:
18-
- 'go.*'
19-
- '**/*.go'
20-
- 'Taskfile.yml'
21-
- 'Dockerfile'
22-
- '.github/workflows/build.yml'
23-
- 'testdata/'
18+
- "go.*"
19+
- "**/*.go"
20+
- "Taskfile.yml"
21+
- "Dockerfile"
22+
- ".github/workflows/build.yml"
23+
- "testdata/"
2424

2525
permissions:
2626
contents: read
@@ -36,11 +36,11 @@ jobs:
3636
uses: caarlos0/meta/.github/workflows/ruleguard.yml@main
3737
with:
3838
go-version: stable
39-
args: '-disable largeloopcopy'
39+
args: "-disable largeloopcopy"
4040
unit-tests:
4141
strategy:
4242
matrix:
43-
os: [ ubuntu-latest, macos-latest, windows-latest ]
43+
os: [ubuntu-latest, macos-latest, windows-latest]
4444
runs-on: ${{ matrix.os }}
4545
steps:
4646
- uses: actions/checkout@v3
@@ -60,11 +60,50 @@ jobs:
6060
with:
6161
token: ${{ secrets.CODECOV_TOKEN }}
6262
file: ./coverage.txt
63+
build-pkgs-on-windows:
64+
runs-on: windows-latest
65+
steps:
66+
- uses: actions/checkout@v3
67+
- uses: actions/setup-go@v4
68+
with:
69+
go-version: stable
70+
- run: mkdir dist
71+
- shell: bash
72+
run: |
73+
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
74+
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3
75+
with:
76+
path: dist/
77+
key: ${{ env.sha_short }}
78+
enableCrossOsArchive: true
79+
- run: go run ./cmd/nfpm/... pkg -f ./testdata/acceptance/core.complex.yaml -p deb -t ./dist/foo.deb
80+
- run: go run ./cmd/nfpm/... pkg -f ./testdata/acceptance/core.complex.yaml -p rpm -t ./dist/foo.rpm
81+
- run: go run ./cmd/nfpm/... pkg -f ./testdata/acceptance/core.complex.yaml -p apk -t ./dist/foo.apk
82+
- run: go run ./cmd/nfpm/... pkg -f ./testdata/acceptance/core.complex.yaml -p archlinux -t ./dist/foo.pkg.tar.zst
83+
install-pkgs-built-on-windows:
84+
runs-on: ubuntu-latest
85+
needs: [build-pkgs-on-windows]
86+
steps:
87+
- uses: docker/setup-qemu-action@v2
88+
- uses: actions/checkout@v3
89+
- shell: bash
90+
run: |
91+
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
92+
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3
93+
with:
94+
path: dist/
95+
key: ${{ env.sha_short }}
96+
enableCrossOsArchive: true
97+
- run: ls -lha dist
98+
- run: docker run --rm --workdir /tmp -v $PWD/dist:/tmp fedora rpm -ivh foo.rpm
99+
- run: docker run --rm --workdir /tmp -v $PWD/dist:/tmp ubuntu dpkg -i foo.deb
100+
- run: docker run --rm --workdir /tmp -v $PWD/dist:/tmp archlinux pacman --noconfirm -U foo.pkg.tar.zst
101+
- run: docker run --rm --workdir /tmp -v $PWD/dist:/tmp alpine apk add --allow-untrusted foo.apk
63102
acceptance-tests:
64103
strategy:
65104
matrix:
66-
pkgFormat: [ deb, rpm, apk, archlinux ]
67-
pkgPlatform: [ amd64, arm64, 386, ppc64le, armv6, armv7, s390x ]
105+
pkgFormat: [deb, rpm, apk, archlinux]
106+
pkgPlatform: [amd64, arm64, 386, ppc64le, armv6, armv7, s390x]
68107
runs-on: ubuntu-latest
69108
env:
70109
DOCKER_CLI_EXPERIMENTAL: "enabled"

0 commit comments

Comments
 (0)