mirror of
https://github.com/pagefaultgames/rogueserver.git
synced 2025-10-14 15:20:42 +08:00
ci: use change filters for workflows
This commit is contained in:
parent
a6aec58c62
commit
4d7fe4e473
13
.editorconfig
Normal file
13
.editorconfig
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# EditorConfig is awesome: https://EditorConfig.org
|
||||||
|
|
||||||
|
|
||||||
|
# top-most EditorConfig file
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*.yml]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = false
|
||||||
|
insert_final_newline = false
|
15
.github/workflows/ci.yml
vendored
15
.github/workflows/ci.yml
vendored
@ -8,7 +8,14 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
changes:
|
||||||
|
uses: ./.github/workflows/filter-changes.yml
|
||||||
|
permissions:
|
||||||
|
pull-requests: read
|
||||||
|
contents: read
|
||||||
build:
|
build:
|
||||||
|
needs: changes
|
||||||
|
if: ${{ needs.changes.outputs.ci == 'true' }} && github.repository == 'pagefaultgames/rogueserver'
|
||||||
name: Build (${{ matrix.os_name }})
|
name: Build (${{ matrix.os_name }})
|
||||||
env:
|
env:
|
||||||
GO_VERSION: 1.22
|
GO_VERSION: 1.22
|
||||||
@ -25,9 +32,9 @@ jobs:
|
|||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
os_name: windows
|
os_name: windows
|
||||||
arch: amd64
|
arch: amd64
|
||||||
# TODO macos needs universal binary!
|
# TODO macos needs universal binary!
|
||||||
# - os: macos-latest
|
# - os: macos-latest
|
||||||
# os_name: macos
|
# os_name: macos
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up Go ${{ env.GO_VERSION }}
|
- name: Set up Go ${{ env.GO_VERSION }}
|
||||||
@ -43,7 +50,7 @@ jobs:
|
|||||||
version: latest
|
version: latest
|
||||||
args: --config .golangci.yml
|
args: --config .golangci.yml
|
||||||
- name: Test
|
- name: Test
|
||||||
run: go test -v
|
run: go test -v ./...
|
||||||
- name: Build
|
- name: Build
|
||||||
run: go build -v
|
run: go build -v
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
|
38
.github/workflows/filter-changes.yml
vendored
Normal file
38
.github/workflows/filter-changes.yml
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
name: Path Filters
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
pull-requests: read
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# JOB to run change detection
|
||||||
|
changes:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
# Required permissions
|
||||||
|
permissions:
|
||||||
|
pull-requests: read
|
||||||
|
# Set job outputs to values from filter step
|
||||||
|
outputs:
|
||||||
|
ci: ${{ steps.filter.outputs.ci }}
|
||||||
|
ghcr: ${{ steps.filter.outputs.ghcr }}
|
||||||
|
steps:
|
||||||
|
# For pull requests it's not necessary to checkout the code
|
||||||
|
- uses: dorny/paths-filter@v3
|
||||||
|
id: filter
|
||||||
|
with:
|
||||||
|
filters: |
|
||||||
|
common: &common
|
||||||
|
- '**/*.go'
|
||||||
|
- go.mod
|
||||||
|
- go.sum
|
||||||
|
ghcr:
|
||||||
|
- *common
|
||||||
|
- .dockerignore
|
||||||
|
- Dockerfile
|
||||||
|
- docker-compose.Development.yml
|
||||||
|
ci:
|
||||||
|
- *common
|
||||||
|
- .golangci.yml
|
9
.github/workflows/ghcr.yml
vendored
9
.github/workflows/ghcr.yml
vendored
@ -10,9 +10,16 @@ permissions:
|
|||||||
packages: write
|
packages: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
changes:
|
||||||
|
uses: ./.github/workflows/filter-changes.yml
|
||||||
|
permissions:
|
||||||
|
pull-requests: read
|
||||||
|
contents: read
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
needs: changes
|
||||||
name: Build and publish to GHCR
|
name: Build and publish to GHCR
|
||||||
if: github.repository == 'pagefaultgames/rogueserver'
|
if: ${{ needs.changes.outputs.ghcr == 'true' }} && github.repository == 'pagefaultgames/rogueserver'
|
||||||
env:
|
env:
|
||||||
GO_VERSION: 1.22
|
GO_VERSION: 1.22
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -12,6 +12,7 @@ path = [
|
|||||||
"go.sum",
|
"go.sum",
|
||||||
"go.mod",
|
"go.mod",
|
||||||
".github/FUNDING.yml",
|
".github/FUNDING.yml",
|
||||||
|
"**/*.editorconfig",
|
||||||
]
|
]
|
||||||
SPDX-FileCopyrightText = "NONE"
|
SPDX-FileCopyrightText = "NONE"
|
||||||
SPDX-License-Identifier = "CC0-1.0"
|
SPDX-License-Identifier = "CC0-1.0"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user