Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake --impure
27 changes: 27 additions & 0 deletions .github/actions/default/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Setup Env
description: Setup Env for Linux x64
inputs:
token:
description: 'A Github PAT'
required: true
runs:
using: composite
steps:
- name: Install Nix
uses: cachix/install-nix-action@v31
- name: Cache dependencies
uses: nix-community/cache-nix-action@v6
with:
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/flake.nix', '**/flake.lock') }}
restore-prefixes-first-match: nix-${{ runner.os }}-
- name: Load dependencies
shell: bash
run: nix develop --install
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
/tmp/go/pkg/mod/
key: ${{ runner.os }}-${{ github.job }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-${{ github.job }}-go-
24 changes: 24 additions & 0 deletions .github/actions/env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Setup Env
description: Setup Env for Linux x64
inputs:
token:
description: 'A Github PAT'
required: true
runs:
using: composite
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: "Put back the git branch into git (Earthly uses it for tagging)"
shell: bash
run: |
branch=""
if [ -n "$GITHUB_HEAD_REF" ]; then
branch="$GITHUB_HEAD_REF"
else
branch="${GITHUB_REF##*/}"
fi
git checkout -b "$branch" || true

29 changes: 0 additions & 29 deletions .github/workflows/checks.yml

This file was deleted.

108 changes: 108 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: Default
on:
merge_group:
push:
branches:
- main
- release/*
pull_request:
types: [ assigned, opened, synchronize, reopened, labeled ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
PR:
if: github.event_name == 'pull_request'
name: Check PR Title
runs-on: ubuntu-latest
permissions:
statuses: write
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Dirty:
runs-on: "shipfox-4vcpu-ubuntu-2404"
env:
GOPATH: /tmp/go
GOLANGCI_LINT_CACHE: /tmp/golangci-lint
steps:
- uses: 'actions/checkout@v4'
with:
fetch-depth: 0
- name: Setup Env
uses: ./.github/actions/default
with:
token: ${{ secrets.NUMARY_GITHUB_TOKEN }}
- run: >
nix develop --impure --command just pre-commit
- name: Get changed files
id: changed-files
shell: bash
run: |
hasChanged=$(git status --porcelain)
if (( $(echo ${#hasChanged}) != 0 )); then
git status
echo "There are changes in the repository"
git diff
exit 1
fi

Tests:
runs-on: "shipfox-4vcpu-ubuntu-2404"
env:
GOPATH: /tmp/go
steps:
- uses: 'actions/checkout@v4'
with:
fetch-depth: 0
- name: Setup Env
uses: ./.github/actions/default
with:
token: ${{ secrets.NUMARY_GITHUB_TOKEN }}
- run: >
nix develop --impure --command just tests
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v5.4.3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

GoReleaser:
runs-on: "shipfox-4vcpu-ubuntu-2404"
if: contains(github.event.pull_request.labels.*.name, 'build-images') || github.ref == 'refs/heads/main' || github.event_name == 'merge_group'
needs:
- Dirty
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- uses: earthly/actions-setup@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
version: "latest"
- uses: 'actions/checkout@v4'
with:
fetch-depth: 0
- name: Setup Env
uses: ./.github/actions/default
with:
token: ${{ secrets.NUMARY_GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: "NumaryBot"
password: ${{ secrets.NUMARY_GITHUB_TOKEN }}
- run: >
nix develop --impure --command just release-ci
env:
GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
31 changes: 0 additions & 31 deletions .github/workflows/release.yml

This file was deleted.

34 changes: 34 additions & 0 deletions .github/workflows/releases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Release
on:
push:
tags:
- 'v*.*.*'
permissions:
contents: write

jobs:
GoReleaser:
runs-on: "shipfox-4vcpu-ubuntu-2404"
steps:
- uses: 'actions/checkout@v4'
with:
fetch-depth: 0
- name: Setup Env
uses: ./.github/actions/default
with:
token: ${{ secrets.NUMARY_GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: "NumaryBot"
password: ${{ secrets.NUMARY_GITHUB_TOKEN }}
- run: >
nix develop --impure --command just release
env:
GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
31 changes: 31 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
set dotenv-load

default:
@just --list

pre-commit: generate tidy lint
pc: pre-commit

lint:
@golangci-lint run --fix --build-tags it --timeout 5m

tidy:
@go mod tidy

generate:
@antlr4 -Dlanguage=Go Lexer.g4 Numscript.g4 -o internal/parser/antlrParser -package antlrParser
@mv internal/parser/antlrParser/_lexer.go internal/parser/antlrParser/lexer.go

tests:
@go test -race -covermode=atomic \
-coverprofile coverage.txt \
./...

release-local:
@goreleaser release --nightly --skip=publish --clean

release-ci:
@goreleaser release --nightly --clean

release:
@goreleaser release --clean
68 changes: 68 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading