Skip to content

Commit

Permalink
Added GitHub workflows.
Browse files Browse the repository at this point in the history
  • Loading branch information
glektarssza committed Sep 3, 2024
1 parent 845dd7f commit f98e2d2
Show file tree
Hide file tree
Showing 6 changed files with 263 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Build
on:
workflow_call:
secrets:
github-token:
required: true
description: |
The token to use when making authenticated GitHub API calls.
inputs:
build-os:
required: true
type: string
description: |
The operating system to build for.
Valid options are:
* `windows`
* `linux`
* `macos`
outputs:
artifact-id:
description: |
The ID of the artifact generated by this workflow.
value: ${{jobs.build.outputs.artifact-id}}
artifact-name:
description: |
The name of the artifact generated by this workflow.
value: ${{jobs.build.outputs.artifact-name}}
jobs:
build:
name: Build
runs-on: ${{(inputs.build-os == 'windows' && 'windows-latest') || (inputs.build-os == 'linux' && 'ubuntu-latest') || (inputs.build-os == 'macos' && 'macos-latest') || ''}}
outputs:
artifact-id: ${{steps.upload-artifacts.outputs.artifact-id}}
artifact-name: dist-${{inputs.build-os}}
steps:
- id: install-system-dependencies-linux
name: Install system dependencies (Linux)
if: inputs.build-os == 'linux'
run: sudo apt update && sudo apt install --assume-yes --no-install-recommends libglfw3-dev
- id: install-tasks
name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.github-token || secrets.GITHUB_TOKEN }}
- id: checkout-repository
name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{secrets.github-token || secrets.GITHUB_TOKEN}}
lfs: true
- id: setup-odin
name: Setup Odin
uses: laytan/setup-odin@v2.4.1
with:
token: ${{secrets.github-token || secrets.GITHUB_TOKEN}}
release: latest
- id: build-distribution
name: Build distribution
run: task dist
- id: upload-artifacts
name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist-${{inputs.build-os}}
path: dist
34 changes: 34 additions & 0 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: CodeQL
on:
push:
pull_request:
branches:
- main
schedule:
- cron: '0 12 * * 3'
jobs:
codeql-analyze:
name: CodeQL Analyze
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- id: checkout-repository
name: Checkout repository
uses: actions/checkout@v4
with:
lfs: true
- id: initialize-codeql
name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: csharp
queries: security-and-quality
- id: autobuild
name: Autobuild
uses: github/codeql-action/autobuild@v3
- id: analyze
name: Analyze
uses: github/codeql-action/analyze@v3
35 changes: 35 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Lint
on:
workflow_call:
secrets:
github-token:
required: true
description: |
The token to use when making authenticated GitHub API calls.
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- id: install-tasks
name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.github-token || secrets.GITHUB_TOKEN }}
- id: checkout-repository
name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{secrets.github-token || secrets.GITHUB_TOKEN}}
lfs: true
- id: setup-odin
name: Setup Odin
uses: laytan/setup-odin@v2.4.1
with:
token: ${{secrets.github-token || secrets.GITHUB_TOKEN}}
release: latest
- id: lint
name: Lint
run: task lint
40 changes: 40 additions & 0 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Pull Request
on:
pull_request:
branches:
- main
jobs:
build:
name: Build
strategy:
fail-fast: true
matrix:
build-os:
- windows
- linux
- macos
uses: ./.github/workflows/build.yaml
secrets:
github-token: ${{secrets.GITHUB_TOKEN}}
with:
build-os: ${{matrix.build-os}}
test:
name: Test
strategy:
fail-fast: true
matrix:
build-os:
- windows
- linux
- macos
uses: ./.github/workflows/test.yaml
secrets:
github-token: ${{secrets.GITHUB_TOKEN}}
with:
build-os: ${{matrix.build-os}}
lint:
name: Lint
uses: ./.github/workflows/lint.yaml
secrets:
github-token: ${{secrets.GITHUB_TOKEN}}
38 changes: 38 additions & 0 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Push
on:
push:
jobs:
build:
name: Build
strategy:
fail-fast: true
matrix:
build-os:
- windows
- linux
- macos
uses: ./.github/workflows/build.yaml
secrets:
github-token: ${{secrets.GITHUB_TOKEN}}
with:
build-os: ${{matrix.build-os}}
test:
name: Test
strategy:
fail-fast: true
matrix:
build-os:
- windows
- linux
- macos
uses: ./.github/workflows/test.yaml
secrets:
github-token: ${{secrets.GITHUB_TOKEN}}
with:
build-os: ${{matrix.build-os}}
lint:
name: Lint
uses: ./.github/workflows/lint.yaml
secrets:
github-token: ${{secrets.GITHUB_TOKEN}}
47 changes: 47 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Test
on:
workflow_call:
secrets:
github-token:
required: true
description: |
The token to use when making authenticated GitHub API calls.
inputs:
build-os:
required: true
type: string
description: |
The operating system to build for.
Valid options are:
* `windows`
* `linux`
* `macos`
jobs:
test:
name: Test
runs-on: ${{(inputs.build-os == 'windows' && 'windows-latest') || (inputs.build-os == 'linux' && 'ubuntu-latest') || (inputs.build-os == 'macos' && 'macos-latest') || ''}}
steps:
- id: install-tasks
name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.github-token || secrets.GITHUB_TOKEN }}
- id: checkout-repository
name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{secrets.github-token || secrets.GITHUB_TOKEN}}
lfs: true
- id: setup-odin
name: Setup Odin
uses: laytan/setup-odin@v2.4.1
with:
token: ${{secrets.github-token || secrets.GITHUB_TOKEN}}
release: latest
- id: test
name: Test
run: task test

0 comments on commit f98e2d2

Please sign in to comment.