Skip to content

Fix for same train showing multiple times. Changed default station #22

Fix for same train showing multiple times. Changed default station

Fix for same train showing multiple times. Changed default station #22

Workflow file for this run

name: Build and Release WMATA Train Tracker
on:
push:
branches:
- main
pull_request:
release:
types: [created]
permissions:
contents: write
jobs:
lint-go:
name: Lint - Go
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: "1.21"
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.54
test-go:
name: Test - Go
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Build frontend
run: |
cd frontend
pnpm install
pnpm build
- uses: actions/setup-go@v4
with:
go-version: "1.21"
cache: false
- name: Install dependencies
run: go get .
- name: Run tests
run: go test ./...
build:
name: Build - Wails
needs: [lint-go, test-go]
strategy:
fail-fast: false
matrix:
build: [
{
name: wmata-train-tracker-linux,
platform: linux/amd64,
os: ubuntu-latest,
},
# TODO: Build for MacOS and Windows
# { name: wmata-train-tracker, platform: windows/amd64, os: windows-latest },
# { name: wmata-train-tracker, platform: darwin/universal, os: macos-latest },
]
runs-on: ${{ matrix.build.os }}
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- uses: ncpleslie/wails-build-action@v2.2
with:
build-name: ${{ matrix.build.name }}
build-platform: ${{ matrix.build.platform }}
go-version: "1.21"
node-version: 18
package: false
- name: Create Config File
run: |
echo "BASE_URL=${{ vars.BASE_URL }}" > build/bin/config.cfg
echo "TRAIN_UPDATE_IN_SECONDS=${{ vars.TRAIN_UPDATE_IN_SECONDS }}" >> build/bin/config.cfg
echo "TRAIN_ROUTE=${{ vars.TRAIN_ROUTE }}" >> build/bin/config.cfg
echo "INCIDENT_UPDATE_IN_SECONDS=${{ vars.INCIDENT_UPDATE_IN_SECONDS }}" >> build/bin/config.cfg
echo "INCIDENT_ROUTE=${{ vars.INCIDENT_ROUTE }}" >> build/bin/config.cfg
echo "STATIONS_ROUTE=${{ vars.STATIONS_ROUTE }}" >> build/bin/config.cfg
echo "STATION_BY_ID_ROUTE=${{ vars.STATION_BY_ID_ROUTE }}" >> build/bin/config.cfg
echo "DEFAULT_STATION_ID=${{ vars.DEFAULT_STATION_ID }}" >> build/bin/config.cfg
echo "SQLITE_URL=${{ vars.SQLITE_URL }}" >> build/bin/config.cfg
- name: Make executable
if: runner.os == 'Linux'
run: chmod +x build/bin/*
# Tar the application to preserve permissions set by previous step
- name: Tar files
if: runner.os == 'Linux'
run: tar -cvf ${{matrix.build.name}}.tar -C build/bin .
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: ${{matrix.build.name}}
path: ${{matrix.build.name}}.tar
release:
name: Release
needs: [build]
strategy:
matrix:
build: [
{ name: wmata-train-tracker-linux },
# TODO: Build for MacOS and Windows
# { name: wmata-train-tracker, platform: windows/amd64, os: windows-latest },
# { name: wmata-train-tracker, platform: darwin/universal, os: macos-latest },
]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: ${{matrix.build.name}}
path: artifacts
- uses: softprops/action-gh-release@v1
with:
files: artifacts/*