change npm version, update windows testing information #520
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
on: | |
push: | |
branches: [ '*' ] | |
pull_request: | |
branches: [ '*' ] | |
jobs: | |
test: | |
strategy: | |
matrix: | |
go-version: [1.22.x] | |
os: [ubuntu-22.04] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- name: Build UI | |
run: | | |
cd ui | |
npm ci | |
npm run build --if-present | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Set up dependencies | |
run: | | |
go mod download | |
- name: Run golangci-lint | |
uses: golangci/golangci-lint-action@v5 | |
with: | |
version: v1.58 | |
args: --timeout=10m | |
- name: Unit Tests | |
run: go test -race -v $(go list ./... | grep -v /test/) -coverprofile=coverage.out | |
- name: Send coverage | |
uses: shogo82148/actions-goveralls@v1 | |
with: | |
path-to-profile: coverage.out | |
flag-name: Go-${{ matrix.go }} | |
parallel: true | |
integration-test: | |
needs: test | |
strategy: | |
matrix: | |
distro: [ 'ubuntu:20.04', 'ubuntu:22.04', 'ubuntu:24.04', 'debian:buster', 'debian:bullseye', 'debian:bookworm' ] | |
database: [mysql, sqlite] | |
web-server: [nginx, apache] | |
go-version: [1.22.x] | |
experimental: [false] | |
exclude: | |
- distro: 'ubuntu:20.04' | |
database: 'sqlite' | |
- distro: 'debian:buster' | |
database: 'sqlite' | |
include: | |
- distro: 'debian:sid' | |
web-server: 'nginx' | |
database: 'mysql' | |
experimental: true | |
go-version: '1.22.x' | |
- distro: 'debian:buster' | |
web-server: 'nginx' | |
database: 'mysql' | |
experimental: true | |
go-version: '1.22.x' | |
runs-on: ubuntu-latest | |
continue-on-error: ${{ matrix.experimental }} | |
container: | |
image: ${{ matrix.distro }} | |
options: --user root | |
volumes: | |
- /usr/local/share/ca-certificates:/usr/local/share/ca-certificates | |
steps: | |
- name: Container preparation | |
run: | | |
apt -y update | |
apt-get install ca-certificates -y | |
update-ca-certificates | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20.x' | |
- name: Build UI | |
run: | | |
cd ui | |
npm ci | |
npm run build --if-present | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Set up dependencies | |
run: go mod download | |
- name: GameAP Installation Test | |
run: | | |
cd cmd/gameapctl/ | |
go build . | |
./gameapctl --non-interactive panel install --path=/var/www/gameap --host=127.0.0.1 --web-server=${{ matrix.web-server}} --database=${{ matrix.database}} | |
- name: Daemon Installation Test | |
run: | | |
cd cmd/gameapctl/ | |
echo "Illuminate\Support\Facades\Cache::put('gdaemonAutoCreateToken', 'test_auto_setup_token', 99999);" | /var/www/gameap/artisan tinker || true | |
./gameapctl --non-interactive daemon install --host=http://127.0.0.1 --token=test_auto_setup_token | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: logs | |
path: /var/log/ | |
retention-days: 5 | |
integration-test-windows: | |
needs: test | |
strategy: | |
matrix: | |
database: [ mysql, sqlite ] | |
web-server: [ nginx ] | |
go-version: [ 1.22.x ] | |
experimental: [ false ] | |
runs-on: windows-latest | |
continue-on-error: ${{ matrix.experimental }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20.x' | |
- name: Build UI | |
run: | | |
cd ui | |
npm ci | |
npm run build --if-present | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Set up dependencies | |
run: go mod download | |
- name: Tests | |
run: | | |
sc delete nginx | |
del C:\tools\nginx* -Recurse -Force | |
cd .\cmd\gameapctl\ | |
go build . | |
.\gameapctl.exe --non-interactive panel install --path=C:\gameap\web --host=127.0.0.1 --port=3080 --web-server=${{ matrix.web-server}} --database=${{ matrix.database}} | |
- name: Daemon Installation Test | |
run: | | |
cd .\cmd\gameapctl\ | |
echo "Illuminate\Support\Facades\Cache::put('gdaemonAutoCreateToken', 'test_auto_setup_token', 99999);" | C:\tools\php\php.exe C:\gameap\web\artisan tinker | |
.\gameapctl.exe --non-interactive daemon install --host=http://127.0.0.1:3080 --token=test_auto_setup_token | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: logs_windows | |
path: | | |
~/AppData/Local/Temp/gameapctl* | |
C:/gameap/services/* | |
C:/gameap/logs/* | |
retention-days: 5 | |
test-cache: | |
needs: [test, integration-test, integration-test-windows] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.22.x | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
# In order: | |
# * Module download cache | |
# * Build cache (Linux) | |
# * Build cache (Mac) | |
# * Build cache (Windows) | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
~/Library/Caches/go-build | |
%LocalAppData%\go-build | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
finish: | |
needs: [test, integration-test, integration-test-windows] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: shogo82148/actions-goveralls@v1 | |
with: | |
parallel-finished: true |