-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Local nix files, workflows, and more.
- Loading branch information
Alina Shumann
committed
Nov 11, 2024
1 parent
4769bd1
commit ba9f54d
Showing
10 changed files
with
596 additions
and
95 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
config.yml | ||
!.circleci/config.yml | ||
test | ||
dist | ||
# Ignore all files | ||
* | ||
# Except go files | ||
!go.mod | ||
!go.sum | ||
!**/*.go |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
use flake |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"$schema": "https://docs.renovatebot.com/renovate-schema.json", | ||
"extends": [ | ||
"config:recommended" | ||
], | ||
"nix": { | ||
"enabled": true | ||
}, | ||
"lockFileMaintenance": { | ||
"enabled": true, | ||
"automerge": true, | ||
"schedule": [ | ||
"before 4am" | ||
] | ||
}, | ||
"packageRules": [ | ||
{ | ||
"matchUpdateTypes": [ | ||
"minor", | ||
"patch" | ||
], | ||
"matchCurrentVersion": "!/^0/", | ||
"automerge": true | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Build Docker Images | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- 'v*' | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
defaults: | ||
run: | ||
working-directory: './Store' | ||
steps: | ||
- name: 'Checkout GitHub Action' | ||
uses: actions/checkout@v4 | ||
- name: Log in to Docker Hub | ||
uses: docker/login-action@3d58c274f17dffee475a5520cbe67f0a882c4dbb | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@3d58c274f17dffee475a5520cbe67f0a882c4dbb | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 | ||
with: | ||
images: | | ||
screepers/${{ env.IMAGE_NAME }} | ||
ghcr.io/${{ env.IMAGE_NAME }} | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@94d76d3bc1409736cb5dc1ada9502bec3a72973c | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
- name: Generate artifact attestation | ||
uses: actions/attest-build-provenance@v1 | ||
with: | ||
subject-name: ghcr.io/${{ env.IMAGE_NAME}} | ||
subject-digest: ${{ steps.push.outputs.digest }} | ||
push-to-registry: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: Build and Release | ||
|
||
on: [push] | ||
|
||
env: | ||
go-version: 1.22.x | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Go ${{ env.go-version }} | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '${{ env.go-version }}' | ||
- name: Install dependencies | ||
run: go get . | ||
- name: Vet | ||
run: go vet ./... | ||
- name: Test | ||
run: go test ./... | ||
build: | ||
needs: test | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
os: [linux, darwin, windows] | ||
arch: [amd64, arm, arm64] | ||
eclude: | ||
- os: windows | ||
arch: arm | ||
- os: darwin | ||
arch: arm | ||
- os: darwin | ||
arch: arm64 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Go ${{ env.go-version }} | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '${{ env.go-version }}' | ||
- name: Install dependencies | ||
run: go get . | ||
- name: Build | ||
run: GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} go build -o ./bin/screeps-launcher_${{ matrix.os }}_${{ matrix.arch }} ./cmd/screeps-launcher | ||
- name: Upload binary | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: screeps-launcher | ||
path: ./bin/ | ||
release: | ||
if: startsWith(github.ref, 'refs/tags/') | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/download-artifact@master | ||
with: | ||
name: screeps-launcher | ||
path: ./bin | ||
- name: Create release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
files: bin/* | ||
- name: Upload binaries | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./bin | ||
asset_name: screeps-launcher_${{ matrix.os }}_${{ matrix.arch }} | ||
asset_content_type: application/octet-stream |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
description = "screeps-launcher flake"; | ||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
gomod2nix.url = "github:nix-community/gomod2nix"; | ||
}; | ||
outputs = { self, nixpkgs, flake-utils, gomod2nix }: | ||
(flake-utils.lib.eachDefaultSystem | ||
(system: | ||
let | ||
pkgs = import nixpkgs { | ||
inherit system; | ||
overlays = [ gomod2nix.overlays.default ]; | ||
}; | ||
screeps-launcher = pkgs.buildGoApplication { | ||
pname = "screeps-launcher"; | ||
version = "1.16.0"; | ||
src = ./.; | ||
modules = ./gomod2nix.toml; | ||
subPackages = [ "cmd/screeps-launcher" ]; | ||
# force 1.22, 1.23 is currently broken due to modules.txt not being generated | ||
go = pkgs.go_1_22; | ||
}; | ||
in | ||
{ | ||
packages = { | ||
default = screeps-launcher; | ||
# Disable for now, this needs to be considered due to needing build | ||
# dependencies for screeps | ||
# docker = pkgs.dockerTools.buildLayeredImage { | ||
# name = "screeps-launcher"; | ||
# config = { | ||
# Cmd = [ "${screeps-launcher}/bin/screeps-launcher" ]; | ||
# }; | ||
# }; | ||
}; | ||
devShells.default = pkgs.mkShell { | ||
packages = [ | ||
(pkgs.mkGoEnv { pwd = ./.; }) | ||
pkgs.gomod2nix | ||
]; | ||
}; | ||
}) | ||
); | ||
} |
Oops, something went wrong.