Improve sanitize path #241
This file contains 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: CI Tests | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
env: | |
GO_VERSION: "1.15" | |
NODE_BUILDER_IMAGE: "node:14-alpine" | |
GPGKEY_ID: "0x4C6D7DB1D92F58EE" | |
GPGKEY_ID_FULL: "26426A3E380F1D1B67031D3C4C6D7DB1D92F58EE" | |
GPGKEY_USER: "prvt CI <ci@prvt>" | |
S3_ENDPOINT: "127.0.0.1:9000" | |
S3_TLS: "false" | |
AZURE_STORAGE_ACCOUNT: "devstoreaccount1" | |
AZURE_STORAGE_ACCESS_KEY: "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==" | |
AZURE_STORAGE_CUSTOM_ENDPOINT: "127.0.0.1:10000" | |
AZURE_STORAGE_TLS: "false" | |
AWS_ACCESS_KEY_ID: "AKIAIOSFODNN7EXAMPLE" | |
AWS_SECRET_ACCESS_KEY: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" | |
jobs: | |
build-ui: | |
name: Build UI | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Build web UI | |
run: | | |
# Build using Docker | |
docker run \ | |
--rm \ | |
-v "$PWD"/ui:/usr/src/myapp \ | |
-w /usr/src/myapp \ | |
-e APP_VERSION=dev \ | |
${{env.NODE_BUILDER_IMAGE}} \ | |
sh -c ' | |
set -e | |
echo -e "###\nInstalling npm dependencies\n" | |
npm ci | |
echo -e "\n###\nBuilding UI\n" | |
npm run build | |
' | |
echo -e "\n###\nCompilation done\n" | |
ls -al ui/dist | |
- name: Publish web UI artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ui | |
path: ui/dist/ | |
test-linux: | |
name: Test on Linux | |
runs-on: ubuntu-20.04 | |
needs: build-ui | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ^${{env.GO_VERSION}} | |
- name: Go version | |
run: | | |
go version | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Fetch web UI artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: ui | |
path: ui/dist | |
# Can't use a GitHub Action service because that doesn't allow overriding the container's command | |
- name: Start minio | |
run: | | |
docker run \ | |
-d \ | |
-p 9000:9000 \ | |
-e "MINIO_ACCESS_KEY=${{env.AWS_ACCESS_KEY_ID}}" \ | |
-e "MINIO_SECRET_KEY=${{env.AWS_SECRET_ACCESS_KEY}}" \ | |
minio/minio \ | |
server /data | |
- name: Start Azurite | |
run: | | |
docker run \ | |
-d \ | |
-p 10000:10000 \ | |
mcr.microsoft.com/azure-storage/azurite \ | |
azurite-blob --blobHost 0.0.0.0 --blobPort 10000 | |
- name: Import CI GPG key | |
run: | | |
gpg --import tests/fixtures/gpg-ci-key.asc | |
echo "${{env.GPGKEY_ID_FULL}}:6:" | gpg --import-ownertrust | |
gpg --list-secret-keys | |
- name: Fetch tools | |
run: | | |
# Install goveralls and go-acc | |
curl -sf https://gobinaries.com/github.com/mattn/[email protected] | PREFIX=. sh | |
curl -sf https://gobinaries.com/github.com/ory/[email protected] | PREFIX=. sh | |
- name: Get dependencies | |
run: | | |
go get -v -t -d ./... | |
- name: Build | |
run: | | |
go build -v . | |
- name: Test | |
run: | | |
# Exclude the wasm package because it requires a different compilation target | |
./go-acc \ | |
$(go list ./... | grep -v prvt/wasm) \ | |
-- \ | |
-v \ | |
-ldflags "-X github.com/ItalyPaleAle/prvt/buildinfo.Production=1" | |
# Remove generated (.pb.go ones) files from coverage report | |
cat coverage.txt| grep -v ".pb.go:" > coverage-filtered.txt | |
- name: Send coverage | |
env: | |
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: ./goveralls -coverprofile=coverage-filtered.txt -service=github | |
test-windows: | |
name: Test on Windows | |
runs-on: windows-2019 | |
needs: build-ui | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ^${{env.GO_VERSION}} | |
- name: Go version | |
run: | | |
go.exe version | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Fetch web UI artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: ui | |
path: ui\dist | |
- name: Fetch and start minio | |
run: | | |
$downloadURL = "https://dl.minio.io/server/minio/release/windows-amd64/minio.exe" | |
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | |
Invoke-WebRequest -Uri $downloadURL -OutFile "minio.exe" | |
mkdir D:\minio | |
Start-Process powershell -ArgumentList ".\minio.exe server --address 127.0.0.1:9000 D:\minio > D:\minio-log.txt" -WindowStyle hidden | |
New-NetFirewallRule -Action Allow -DisplayName "MinIO" -Direction Inbound -LocalPort 9000 -Protocol TCP -Profile Domain, Private | |
env: | |
MINIO_ACCESS_KEY: "${{env.AWS_ACCESS_KEY_ID}}" | |
MINIO_SECRET_KEY: "${{env.AWS_SECRET_ACCESS_KEY}}" | |
- name: Fetch and start Azurite | |
run: | | |
npm install -g azurite | |
mkdir D:\azurite | |
Start-Process powershell -ArgumentList "azurite-blob --location D:\azurite --blobHost 127.0.0.1 --blobPort 10000 > D:\azurite-log.txt" -WindowStyle hidden | |
New-NetFirewallRule -Action Allow -DisplayName "Azurite" -Direction Inbound -LocalPort 10000 -Protocol TCP -Profile Domain, Private | |
- name: Import CI GPG key | |
run: | | |
gpg.exe --import tests/fixtures/gpg-ci-key.asc | |
echo "${{env.GPGKEY_ID_FULL}}:6:" | gpg.exe --import-ownertrust | |
gpg.exe --list-secret-keys | |
- name: Get dependencies | |
run: | | |
go.exe get -v -t -d ./... | |
- name: Build | |
run: | | |
go.exe build -v . | |
- name: Test | |
run: | | |
iex "go.exe test -v $(go.exe list ./... | grep -v prvt/wasm) -ldflags '-X github.com/ItalyPaleAle/prvt/buildinfo.Production=1'" |