Skip to content

README: updated environment variable table #299

README: updated environment variable table

README: updated environment variable table #299

Workflow file for this run

name: Release
on:
push:
tags: [ 'v*' ]
branches: [ '*' ]
pull_request:
branches: [ main ]
jobs:
go-test:
name: Go Tests
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '^1.22.1'
- name: Set up linux dependencies
run: sudo apt-get update && sudo apt-get install -y gcc libgtk-3-dev libayatana-appindicator3-dev
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: go test ./...
windows:
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
goos: windows
goarch: amd64
suffix: zip
snfm: snfm-*-windows-x64.zip
- os: windows-latest
goos: windows
goarch: "386"
suffix: zip
- os: windows-latest
goos: windows
goarch: arm
suffix: zip
- os: windows-latest
goos: windows
goarch: arm64
suffix: zip
runs-on: windows-latest
steps:
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '^1.22.1'
- run: echo "basename=sni-${{env.GITHUB_REF_SLUG}}-${{matrix.goos}}-${{matrix.goarch}}${{matrix.alt}}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- uses: actions/checkout@v4
name: Checkout
with:
fetch-depth: 0
- name: Generate Windows resources
run: |
cd cmd/sni
go install github.com/tc-hib/go-winres@latest
go-winres simply --icon icon/sni.ico --product-version git-tag --file-version git-tag --file-description "SNI" --product-name "Super Nintendo Interface" --copyright "© jsd1982 2021" --original-filename "sni"
- name: Package Lua Bridge for distribution
run: |
mkdir ${{env.basename}}
mkdir ${{env.basename}}/lua
mkdir ${{env.basename}}/lua/x64
mkdir ${{env.basename}}/lua/x86
cp README.md ${{env.basename}}
cp LICENSE ${{env.basename}}
cp protos/sni/sni.proto ${{env.basename}}
cp cmd/sni/apps.yaml ${{env.basename}}
cp lua/Connector.lua ${{env.basename}}/lua
- name: Copy in lua socket.dll dependencies for Windows
run: |
rm ${{env.basename}}/lua/Connector.lua
cp lua/Connector.lua ${{env.basename}}/lua/
cp lua/x64/socket-windows-5-1.dll ${{env.basename}}/lua/x64
cp lua/x64/socket-windows-5-4.dll ${{env.basename}}/lua/x64
cp lua/x64/luasocket.LICENSE.txt ${{env.basename}}/lua/x64
cp lua/x86/socket-windows-5-1.dll ${{env.basename}}/lua/x86
cp lua/x86/luasocket.LICENSE.txt ${{env.basename}}/lua/x86
- name: Build SNI
run: |
Set-Item -Path Env:GOOS -Value "${{matrix.goos}}"
Set-Item -Path Env:GOARCH -Value "${{matrix.goarch}}"
go build -tags="${{ matrix.tags }}" -gcflags=all=-l -ldflags="-w -H=windowsgui -X 'main.version=${{env.GITHUB_REF_SLUG}}' -X 'main.commit=${{env.GITHUB_SHA_SHORT}}' -X 'main.date=$(date +'%Y-%m-%dT%H:%M:%S')' -X 'main.builtBy=$(go version | cut -f3 -d ' ')'" -o ./${{env.basename}}/sni.exe ./cmd/sni
- name: Download SNFM
if: ${{ matrix.snfm }}
run: gh release download --repo zig-for/snfm --pattern ${{ matrix.snfm }} --dir ${{ runner.temp }}
env:
GH_TOKEN: ${{ github.token }}
- name: Extract SNFM
if: ${{ matrix.snfm }}
run: 7z x -o"${{env.basename}}" "${{ runner.temp }}/${{ matrix.snfm }}"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{env.basename}}
path: ${{env.basename}}/
- name: Package ${{env.basename}}.${{matrix.suffix}} for Windows
if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') }}
run: Compress-Archive -DestinationPath ${{env.basename}}.${{matrix.suffix}} -Path ${{env.basename}}/*
- name: Upload binaries to release
if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ env.GITHUB_REF_SLUG }}
overwrite: true
asset_name: ${{env.basename}}.${{matrix.suffix}}
file: ${{ github.workspace }}/${{env.basename}}.${{matrix.suffix}}
macos:
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
suffix: tar.gz
snfm: snfm-*-macos-x64.zip
runs-on: macos-latest
steps:
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '^1.22.1'
- run: echo "basename=sni-${{env.GITHUB_REF_SLUG}}-darwin-universal${{matrix.alt}}" >> $GITHUB_ENV
- uses: actions/checkout@v4
name: Checkout
with:
fetch-depth: 0
- name: Package Lua Bridge for distribution
run: |
mkdir ${{env.basename}}
mkdir ${{env.basename}}/lua
cp README.md ${{env.basename}}
cp LICENSE ${{env.basename}}
cp protos/sni/sni.proto ${{env.basename}}
cp cmd/sni/apps.yaml ${{env.basename}}
cp lua/Connector.lua ${{env.basename}}/lua
- name: Build SNI (amd64, arm64)
run: >
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build
-tags="${{ matrix.tags }}"
-gcflags=all=-l
-ldflags="-w -X 'main.version=${{env.GITHUB_REF_SLUG}}' -X 'main.commit=${{env.GITHUB_SHA_SHORT}}' -X 'main.date=$(date +'%Y-%m-%dT%H:%M:%S')'"
-o ./${{env.basename}}/sni.amd64
./cmd/sni
CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build
-tags="${{ matrix.tags }}"
-gcflags=all=-l
-ldflags="-w -X 'main.version=${{env.GITHUB_REF_SLUG}}' -X 'main.commit=${{env.GITHUB_SHA_SHORT}}' -X 'main.date=$(date +'%Y-%m-%dT%H:%M:%S')'"
-o ./${{env.basename}}/sni.arm64
./cmd/sni
lipo -create -output ./${{env.basename}}/sni ./${{env.basename}}/sni.amd64 ./${{env.basename}}/sni.arm64
rm -f ./${{env.basename}}/sni.amd64 ./${{env.basename}}/sni.arm64
- name: Download SNFM
if: ${{ matrix.snfm }}
run: gh release download --repo zig-for/snfm --pattern ${{ matrix.snfm }} --dir ${{ runner.temp }}
env:
GH_TOKEN: ${{ github.token }}
- name: Extract SNFM
if: ${{ matrix.snfm }}
run: 7z x -o"${{env.basename}}" "${{ runner.temp }}/${{ matrix.snfm }}"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{env.basename}}
path: ${{env.basename}}/
- name: Package ${{env.basename}}.${{matrix.suffix}} for MacOS
if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') }}
run: tar czf ${{env.basename}}.${{matrix.suffix}} ${{env.basename}}/
- name: Upload binaries to release
if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ env.GITHUB_REF_SLUG }}
overwrite: true
asset_name: ${{env.basename}}.${{matrix.suffix}}
file: ${{ github.workspace }}/${{env.basename}}.${{matrix.suffix}}
linux:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
goos: linux
goarch: amd64
suffix: tar.xz
linuxdeps: libgtk-3-dev libayatana-appindicator3-dev
snfm: snfm-*-linux-x64.zip
- os: ubuntu-latest
goos: linux
goarch: amd64
suffix: tar.xz
tags: notray
alt: -notray
snfm: snfm-*-linux-x64.zip
## NOTE(2023-08-31): disabled arm64 builds due to cross-compilation error with systray package:
## # github.com/getlantern/systray
## In file included from /usr/aarch64-linux-gnu/include/features.h:510,
## from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
## from /usr/aarch64-linux-gnu/include/stdlib.h:26,
## from _cgo_export.c:3:
## /usr/include/x86_64-linux-gnu/gnu/stubs.h:7:11: fatal error: gnu/stubs-32.h: No such file or directory
## 7 | # include <gnu/stubs-32.h>
## | ^~~~~~~~~~~~~~~~
## compilation terminated.
#- os: ubuntu-latest
# goos: linux
# goarch: arm64
# suffix: tar.xz
# linuxdeps: gcc-aarch64-linux-gnu libgtk-3-dev libayatana-appindicator3-dev
# gobuildenvs: CC=aarch64-linux-gnu-gcc
#- os: ubuntu-latest
# goos: linux
# goarch: arm64
# suffix: tar.xz
# tags: notray
# alt: -notray
# linuxdeps: gcc-aarch64-linux-gnu
# gobuildenvs: CC=aarch64-linux-gnu-gcc
#- os: ubuntu-latest
# goos: linux
# goarch: "386"
runs-on: ubuntu-latest
steps:
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '^1.22.1'
- name: Set up linux dependencies
run: sudo apt-get update && sudo apt-get install -y gcc ${{matrix.linuxdeps}}
- run: echo "basename=sni-${{env.GITHUB_REF_SLUG}}-${{matrix.goos}}-${{matrix.goarch}}${{matrix.alt}}" >> $GITHUB_ENV
- uses: actions/checkout@v4
name: Checkout
with:
fetch-depth: 0
- name: Package Lua Bridge for distribution
run: |
mkdir ${{env.basename}}
mkdir ${{env.basename}}/lua
cp README.md ${{env.basename}}
cp LICENSE ${{env.basename}}
cp protos/sni/sni.proto ${{env.basename}}
cp cmd/sni/apps.yaml ${{env.basename}}
cp lua/Connector.lua ${{env.basename}}/lua
- name: Copy in lua socket.so dependencies for Linux amd64
if: ${{ matrix.goarch == 'amd64' }}
run: |
mkdir ${{env.basename}}/lua/x64
cp lua/x64/socket-linux-5-4.so ${{env.basename}}/lua/x64/socket-linux-5-4.so
cp lua/x64/socket-linux-5-1.so ${{env.basename}}/lua/x64/socket-linux-5-1.so
- name: Build SNI
run: >
CGO_ENABLED=1 GOOS=${{matrix.goos}} GOARCH=${{matrix.goarch}} ${{matrix.gobuildenvs}} go build
-tags="${{ matrix.tags }}"
-gcflags=all=-l
-ldflags="-w -X 'main.version=${{env.GITHUB_REF_SLUG}}' -X 'main.commit=${{env.GITHUB_SHA_SHORT}}' -X 'main.date=$(date +'%Y-%m-%dT%H:%M:%S')'"
-o ./${{env.basename}}/sni
./cmd/sni
- name: Download SNFM
if: ${{ matrix.snfm }}
run: gh release download --repo zig-for/snfm --pattern ${{ matrix.snfm }} --dir ${{ runner.temp }}
env:
GH_TOKEN: ${{ github.token }}
- name: Extract SNFM
if: ${{ matrix.snfm }}
run: 7z x -o"${{env.basename}}" "${{ runner.temp }}/${{ matrix.snfm }}"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{env.basename}}
path: ${{env.basename}}/
- name: Package ${{env.basename}}.${{matrix.suffix}} for Linux
if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') }}
run: tar cJf ${{env.basename}}.${{matrix.suffix}} ${{env.basename}}/
- name: Upload binaries to release
if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ env.GITHUB_REF_SLUG }}
overwrite: true
asset_name: ${{env.basename}}.${{matrix.suffix}}
file: ${{ github.workspace }}/${{env.basename}}.${{matrix.suffix}}
manylinux2014:
runs-on: ubuntu-latest
container: quay.io/pypa/manylinux2014_x86_64
steps:
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
- name: Set up Go
uses: actions/setup-go@v4 # @v5 does not work with manylinux2014 glibc
with:
go-version: '^1.22.1'
- name: Set up linux dependencies
run: |
# manylinux2014 is based on centos 7, so we use yum
yum -y install libappindicator libappindicator-devel libappindicator-gtk3 libappindicator-gtk3-devel gtk3-devel libdbusmenu-gtk3 libdbusmenu-gtk3-devel
- run: echo "basename=sni-${{env.GITHUB_REF_SLUG}}-manylinux2014-amd64" >> $GITHUB_ENV
- uses: actions/checkout@v3 # @v4 does not work with manylinux2014 glibc
name: Checkout
with:
fetch-depth: 0
- name: Collect files
run: |
mkdir ${{env.basename}}
mkdir ${{env.basename}}/lua
mkdir ${{env.basename}}/lua/x64
cp README.md ${{env.basename}}
cp LICENSE ${{env.basename}}
cp protos/sni/sni.proto ${{env.basename}}
cp cmd/sni/apps.yaml ${{env.basename}}
cp lua/Connector.lua ${{env.basename}}/lua
cp lua/x64/socket-linux-5-1.so ${{env.basename}}/lua/x64/socket-linux-5-1.so
cp lua/x64/socket-linux-5-4.so ${{env.basename}}/lua/x64/socket-linux-5-4.so
echo -e "\n--\nlibappindicator, libindicator and libdbusmenu are licensed under LGPL, see" >> ${{env.basename}}/LICENSE
echo "https://launchpad.net/libappindicator/" >> ${{env.basename}}/LICENSE
echo "https://launchpad.net/libindicator/" >> ${{env.basename}}/LICENSE
echo "https://launchpad.net/libdbusmenu/" >> ${{env.basename}}/LICENSE
cp -L /lib64/libappindicator3.so.1 ${{env.basename}}
cp -L /lib64/libindicator3.so.7 ${{env.basename}}
cp -L /lib64/libdbusmenu-glib.so.4 ${{env.basename}}
cp -L /lib64/libdbusmenu-gtk3.so.4 ${{env.basename}}
- name: Build SNI
run: >
CGO_ENABLED=1
CGO_LDFLAGS="$CGO_LDFLAGS -Wl,-rpath=. -Wl,--gc-sections"
GOARCH=amd64
go build -tags=legacy_appindicator -buildvcs=false
-gcflags=all=-l
-ldflags="-w -X 'main.version=${{env.GITHUB_REF_SLUG}}' -X 'main.commit=${{env.GITHUB_SHA_SHORT}}' -X 'main.date=$(date +'%Y-%m-%dT%H:%M:%S')'"
-o ./${{env.basename}}/sni
./cmd/sni
- name: Package ${{env.basename}}.tar.xz for Linux
run: |
ldd ${{env.basename}}/sni
tar cJf ${{env.basename}}.tar.xz ${{env.basename}}/
- name: Upload artifact
uses: actions/upload-artifact@v3 # @v4 does not work with manylinux2014 glibc
with:
name: ${{env.basename}}.tar.xz
path: ${{github.workspace}}/${{env.basename}}.tar.xz
- name: Upload binaries to release
if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') }}
uses: svenstaro/[email protected] # @2.8.0 probably does not work with manylinux2014 glibc
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ env.GITHUB_REF_SLUG }}
overwrite: true
asset_name: ${{env.basename}}.tar.xz
file: ${{github.workspace}}/${{env.basename}}.tar.xz