Skip to content

v0.0.1

v0.0.1 #15

Workflow file for this run

on: [push, pull_request, release]
name: build
permissions:
contents: read
pull-requests: write
jobs:
test:
strategy:
matrix:
go-version: [1.25.x]
os: [ubuntu-24.04, macos-latest, windows-latest]
targetplatform: [x64]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache: false
- name: Checkout code
uses: actions/checkout@v5
- name: Checkout excelize-py
uses: actions/checkout@v5
with:
repository: xuri/excelize-py
path: excelize-py
- name: Get dependencies
run: cd excelize-py && env GO111MODULE=on go vet ./...
- name: Setup dotnet
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
6.x
7.x
8.x
9.x
- name: Test on Windows
env:
CGO_ENABLED: 1
if: matrix.os == 'windows-latest'
run: |
cd excelize-py
go build -buildmode=c-shared -o ..\Excelize\libexcelize.amd64.windows.dll main.go
cd ..\Excelize
dotnet restore && dotnet build -c Release
cd ..\Excelize.Tests
dotnet restore && dotnet test --collect:"XPlat Code Coverage" --results-directory .
- name: Test on Linux
env:
CGO_ENABLED: 1
if: matrix.os == 'ubuntu-24.04'
run: |
cd excelize-py
go build -buildmode=c-shared -o ../Excelize/libexcelize.amd64.linux.so main.go
cd ../Excelize
dotnet restore && dotnet build -c Release
cd ../Excelize.Tests
dotnet restore && dotnet test --collect:"XPlat Code Coverage" --results-directory .
- name: Test on macOS
env:
CGO_ENABLED: 1
if: matrix.os == 'macos-latest'
run: |
cd excelize-py
go build -buildmode=c-shared -o ../Excelize/libexcelize.arm64.darwin.dylib main.go
cd ../Excelize
dotnet restore && dotnet build -c Release
cd ../Excelize.Tests
dotnet restore && dotnet test --collect:"XPlat Code Coverage" --results-directory .
- name: Codecov
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: .
flags: unittests
name: codecov-umbrella
build:
runs-on: ${{ matrix.os }}
needs: [test]
if: github.event_name == 'release' && github.event.action == 'published'
strategy:
matrix:
os: [ubuntu-24.04, macos-latest]
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.25.x
cache: false
- name: Checkout excelize-py
uses: actions/checkout@v5
with:
repository: xuri/excelize-py
path: .
- name: Get dependencies
run: env GO111MODULE=on go vet ./...
- name: Build Shared Library
env:
CGO_ENABLED: 1
run: |
if [[ "$RUNNER_OS" == "Linux" ]]; then
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install -y gcc-multilib g++-multilib libc6-dev-i386
CC="gcc -m32" GOOS=linux GOARCH=386 go build -ldflags "-s -w" -buildmode=c-shared -o libexcelize.386.linux.so main.go
GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -buildmode=c-shared -o libexcelize.amd64.linux.so main.go
rm -f libexcelize.*.h
elif [[ "$RUNNER_OS" == "macOS" ]]; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew tap messense/macos-cross-toolchains
brew install FiloSottile/musl-cross/musl-cross mingw-w64
wget https://github.com/mstorsjo/llvm-mingw/releases/download/20250709/llvm-mingw-20250709-ucrt-macos-universal.tar.xz
tar -xzf llvm-mingw-20250709-ucrt-macos-universal.tar.xz
export PATH="$(pwd)/llvm-mingw-20250709-ucrt-macos-universal/bin:$PATH"
CC=aarch64-linux-musl-gcc GOOS=linux GOARCH=arm64 go build -ldflags "-s -w" -buildmode=c-shared -o libexcelize.arm64.linux.so main.go
CC=x86_64-w64-mingw32-gcc GOOS=windows GOARCH=amd64 go build -ldflags "-s -w" -buildmode=c-shared -o libexcelize.amd64.windows.dll main.go
CC=i686-w64-mingw32-gcc GOOS=windows GOARCH=386 go build -ldflags "-s -w" -buildmode=c-shared -o libexcelize.386.windows.dll main.go
CC=aarch64-w64-mingw32-gcc GOOS=windows GOARCH=arm64 go build -ldflags "-s -w" -buildmode=c-shared -o libexcelize.arm64.windows.dll main.go
CC=gcc GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w" -buildmode=c-shared -o libexcelize.arm64.darwin.dylib main.go
CC=gcc GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w" -buildmode=c-shared -o libexcelize.amd64.darwin.dylib main.go
rm -f libexcelize.*.h
fi
- name: Upload Linux Artifacts
if: matrix.os == 'ubuntu-24.04'
uses: actions/upload-artifact@v4
with:
name: linux-artifacts
path: |
libexcelize.386.linux.so
libexcelize.amd64.linux.so
- name: Upload Darwin Artifacts
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v4
with:
name: darwin-artifacts
path: |
libexcelize.arm64.linux.so
libexcelize.amd64.windows.dll
libexcelize.386.windows.dll
libexcelize.arm64.windows.dll
libexcelize.arm64.darwin.dylib
libexcelize.amd64.darwin.dylib
publish:
runs-on: ubuntu-latest
needs: [build]
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Setup dotnet
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
6.x
7.x
8.x
9.x
- name: Download Artifacts
uses: actions/download-artifact@v5
with:
merge-multiple: true
path: ./Excelize
- name: Pack and Publish Package
run: |
cd Excelize
dotnet build -c Release && dotnet pack -c Release
dotnet nuget push ./bin/ExcelizeCs*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source "https://api.nuget.org/v3/index.json" --skip-duplicate
dotnet nuget push ./bin/ExcelizeCs*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" --skip-duplicate