-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
init @go-task Taskfile for
tran
, create tran ci workflow
- Loading branch information
Showing
5 changed files
with
240 additions
and
4 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 |
---|---|---|
@@ -0,0 +1,149 @@ | ||
name: Tran CI | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | ||
|
||
jobs: | ||
bfs: # build from source | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17 | ||
|
||
- name: Building From Source | ||
run: | | ||
go mod tidy | ||
go run ./scripts/date.go >> date.txt | ||
go build -ldflags "-X main.version=$(git describe --abbrev=0 --tags) -X main.buildDate=$(cat date.txt)" -o tran | ||
- name: Run Help | ||
run: ./tran help | ||
|
||
bfs_windows: # build from source (windows) | ||
runs-on: windows-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17 | ||
|
||
- name: Building From Source | ||
run: | | ||
.\scripts\bfs.ps1 | ||
echo "::add-path::C:\Users\runneradmin\AppData\Local\tran\bin\;" | ||
- name: Run Help | ||
run: tran help | ||
|
||
from_script: | ||
needs: [ bfs ] | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install from script | ||
run: curl -sL https://cutt.ly/tran-cli | bash | ||
|
||
- name: Run Help | ||
run: tran help | ||
|
||
from_script_windows: | ||
needs: [ bfs_windows ] | ||
|
||
runs-on: windows-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install from script | ||
run: | | ||
iwr -useb https://cutt.ly/tran-win | iex | ||
echo "::add-path::C:\Users\runneradmin\AppData\Local\tran\bin\;" | ||
- name: Run Help | ||
run: tran help | ||
|
||
go: | ||
needs: [ bfs, bfs_windows ] | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17 | ||
|
||
- name: Install from Go | ||
run: go install github.com/abdfnx/tran@latest | ||
|
||
- name: Run Help | ||
run: tran help | ||
|
||
snapshot: | ||
needs: [ bfs, bfs_windows, go ] | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17 | ||
|
||
- name: Set up `GoReleaser` | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
install-only: true | ||
|
||
- name: Set up `Date` | ||
run: go run ./scripts/date.go >> date.txt | ||
|
||
- name: Build | ||
run: BuildDate="$(cat date.txt)" goreleaser release --snapshot --rm-dist --timeout 100m | ||
|
||
homebrew: | ||
needs: [ bfs, snapshot ] | ||
|
||
runs-on: macos-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Get Tran via homebrew | ||
run: brew install abdfnx/tap/tran | ||
|
||
- name: Run `tran help` | ||
run: tran help | ||
|
||
# via_docker: | ||
# needs: [ bfs, from_script, go ] | ||
|
||
# runs-on: ubuntu-latest | ||
|
||
# steps: | ||
# - uses: actions/checkout@v2 | ||
|
||
# - name: Run in docker container | ||
# run: docker run --rm -iv trancli/tran -h |
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 |
---|---|---|
|
@@ -16,4 +16,6 @@ | |
vendor | ||
node_modules | ||
|
||
# Build Files | ||
date.txt | ||
tag.txt |
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
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,80 @@ | ||
# https://taskfile.dev | ||
|
||
version: "3" | ||
|
||
vars: | ||
TRAN_CONTAINER: trancli/tran | ||
TRAN_FULL_CONTAINER: trancli/tran-full | ||
|
||
tasks: | ||
default: | ||
deps: [ build, ght ] | ||
|
||
set-tag-and-date: | ||
cmds: | ||
- if [ -f "date.txt" ]; then rm date.txt; fi | ||
- if [ -f "tag.txt" ]; then rm tag.txt; fi | ||
- echo {{ now | date "2006-01-02" }} >> date.txt | ||
- git describe --abbrev=0 --tags >> tag.txt | ||
|
||
build: | ||
cmds: | ||
- task: set-tag-and-date | ||
- go mod tidy | ||
- go build -ldflags "-X main.version=$(cat tag.txt) -X main.buildDate=$(cat date.txt)" -o tran | ||
|
||
install: | ||
deps: [ build ] | ||
cmds: | ||
- sudo mv tran /usr/local/bin | ||
|
||
tran-container: | ||
deps: [ just-build-tran-container, build-tran-container, build-tran-container-with-cache ] | ||
|
||
tran-full-container: | ||
deps: [ just-build-tran-full-container, build-tran-full-container, build-full-tran-container-with-cache ] | ||
|
||
just-build-tran-container: | ||
dir: ./docker/vm | ||
cmds: | ||
- docker build -t "{{ .TRAN_CONTAINER }}" . | ||
|
||
build-tran-container: | ||
deps: [ just-build-tran-container ] | ||
dir: ./docker/vm | ||
cmds: | ||
- docker push "{{ .TRAN_CONTAINER }}" | ||
|
||
build-tran-container-with-cache: | ||
cmds: | ||
- docker pull "{{ .TRAN_CONTAINER }}":latest | ||
- docker build -t "{{ .TRAN_CONTAINER }}" --cache-from "{{ .TRAN_CONTAINER }}":latest . | ||
- docker push "{{ .TRAN_CONTAINER }}" | ||
|
||
just-build-tran-full-container: | ||
dir: ./docker/container | ||
cmds: | ||
- docker build -t "{{ .TRAN_CONTAINER }}" . | ||
|
||
build-tran-full-container: | ||
deps: [ just-build-tran-full-container ] | ||
dir: ./docker/container | ||
cmds: | ||
- docker push "{{ .TRAN_CONTAINER }}" | ||
|
||
build-full-tran-container-with-cache: | ||
cmds: | ||
- docker pull "{{ .TRAN_CONTAINER }}":latest && \ | ||
- docker build -t "{{ .TRAN_CONTAINER }}" --cache-from "{{ .TRAN_CONTAINER }}":latest . && \ | ||
- docker push "{{ .TRAN_CONTAINER }}" | ||
|
||
check_node_moduels: | ||
dir: ./scripts/gh-tran | ||
cmds: | ||
- if ! [ -d "node_modules" ]; then yarn; fi | ||
|
||
ght: | ||
deps: [ build ] | ||
cmds: | ||
- task: check_node_moduels | ||
- node ./scripts/gh-tran/gh-trn.js |
Submodule gh-tran
added at
5efc63