1
1
Fork 0
mirror of https://github.com/goreleaser/nfpm synced 2024-05-19 00:56:13 +02:00

build: improve windows testing

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
Carlos Alexandro Becker 2023-07-12 19:05:14 +00:00
parent 741acf8bcc
commit 53d938780e
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
2 changed files with 78 additions and 40 deletions

View File

@ -40,7 +40,7 @@ jobs:
unit-tests:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
@ -60,45 +60,6 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
build-pkgs-on-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: stable
- run: mkdir dist
- shell: bash
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3
with:
path: dist/
key: ${{ env.sha_short }}
enableCrossOsArchive: true
- run: go run ./cmd/nfpm/... pkg -f ./testdata/acceptance/core.complex.yaml -p deb -t ./dist/foo.deb
- run: go run ./cmd/nfpm/... pkg -f ./testdata/acceptance/core.complex.yaml -p rpm -t ./dist/foo.rpm
- run: go run ./cmd/nfpm/... pkg -f ./testdata/acceptance/core.complex.yaml -p apk -t ./dist/foo.apk
- run: go run ./cmd/nfpm/... pkg -f ./testdata/acceptance/core.complex.yaml -p archlinux -t ./dist/foo.pkg.tar.zst
install-pkgs-built-on-windows:
runs-on: ubuntu-latest
needs: [build-pkgs-on-windows]
steps:
- uses: docker/setup-qemu-action@v2
- uses: actions/checkout@v3
- shell: bash
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3
with:
path: dist/
key: ${{ env.sha_short }}
enableCrossOsArchive: true
- run: ls -lha dist
- run: docker run --rm --workdir /tmp -v $PWD/dist:/tmp fedora rpm -ivh foo.rpm
- run: docker run --rm --workdir /tmp -v $PWD/dist:/tmp ubuntu dpkg -i foo.deb
- run: docker run --rm --workdir /tmp -v $PWD/dist:/tmp archlinux pacman --noconfirm -U foo.pkg.tar.zst
- run: docker run --rm --workdir /tmp -v $PWD/dist:/tmp alpine apk add --allow-untrusted foo.apk
acceptance-tests:
strategy:
matrix:

77
.github/workflows/windows.yml vendored Normal file
View File

@ -0,0 +1,77 @@
name: windows
on:
push:
tags:
- v*
branches:
- main
paths:
- "go.*"
- "**/*.go"
- "Taskfile.yml"
- ".github/workflows/windows.yml"
pull_request:
paths:
- "go.*"
- "**/*.go"
- "Taskfile.yml"
- ".github/workflows/windows.yml"
permissions:
contents: read
jobs:
test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: stable
- uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: setup-tparse
run: go install github.com/mfridman/tparse@latest
- run: task setup
- name: test
shell: bash
run: ./scripts/test.sh test windows-latest
build-pkgs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: stable
- uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- shell: bash
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3
with:
path: dist/
key: ${{ env.sha_short }}
enableCrossOsArchive: true
- run: task acceptance:windows:package
install-pkgs:
runs-on: ubuntu-latest
needs: [build-pkgs]
steps:
- uses: docker/setup-qemu-action@v2
- uses: actions/checkout@v3
- uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- shell: bash
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3
with:
path: dist/
key: ${{ env.sha_short }}
enableCrossOsArchive: true
- run: task acceptance:windows:install