Compare commits
No commits in common. "dc80b5ffee03a635f8da71ebd9a45c10e665c210" and "f2e0b5e1fb1bd85ed7b3bf2341b5b935358e0f09" have entirely different histories.
dc80b5ffee
...
f2e0b5e1fb
8 changed files with 99 additions and 219 deletions
|
@ -40,4 +40,4 @@ jobs:
|
||||||
pr: ((.:pr))
|
pr: ((.:pr))
|
||||||
gitea_api_key: ((gitea_api_key))
|
gitea_api_key: ((gitea_api_key))
|
||||||
instance_vars:
|
instance_vars:
|
||||||
n: ((.:pr.number))
|
pr: ((.:pr.number))
|
||||||
|
|
|
@ -2,17 +2,6 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
# The actual CI pipeline that is run per branch
|
# The actual CI pipeline that is run per branch
|
||||||
resource_types:
|
|
||||||
- name: gitea-package
|
|
||||||
type: registry-image
|
|
||||||
source:
|
|
||||||
repository: registry.local:5000/gitea-package
|
|
||||||
|
|
||||||
- name: gitea-status
|
|
||||||
type: registry-image
|
|
||||||
source:
|
|
||||||
repository: registry.local:5000/gitea-status
|
|
||||||
|
|
||||||
|
|
||||||
resources:
|
resources:
|
||||||
- name: repo
|
- name: repo
|
||||||
|
@ -21,179 +10,53 @@ resources:
|
||||||
uri: http://forgejo:3000/bitsquid_dt/dtmt
|
uri: http://forgejo:3000/bitsquid_dt/dtmt
|
||||||
branch: ((pr.head.ref))
|
branch: ((pr.head.ref))
|
||||||
|
|
||||||
- name: gitea-package
|
|
||||||
type: gitea-package
|
|
||||||
source:
|
|
||||||
access_token: ((gitea_api_key))
|
|
||||||
url: http://forgejo:3000
|
|
||||||
owner: concourse
|
|
||||||
type: generic
|
|
||||||
name: dtmt
|
|
||||||
|
|
||||||
- name: pr-status-lint-clippy
|
|
||||||
type: gitea-status
|
|
||||||
source:
|
|
||||||
access_token: ((gitea_api_key))
|
|
||||||
url: http://forgejo:3000
|
|
||||||
owner: bitsquid_dt
|
|
||||||
repo: dtmt
|
|
||||||
sha: ((pr.head.sha))
|
|
||||||
context: lint/clippy
|
|
||||||
description: Checking for common mistakes and opportunities for code improvement
|
|
||||||
|
|
||||||
- name: pr-status-build-msvc
|
|
||||||
type: gitea-status
|
|
||||||
source:
|
|
||||||
access_token: ((gitea_api_key))
|
|
||||||
url: http://forgejo:3000
|
|
||||||
owner: bitsquid_dt
|
|
||||||
repo: dtmt
|
|
||||||
sha: ((pr.head.sha))
|
|
||||||
context: build/msvc
|
|
||||||
description: "Build for the target platform: msvc"
|
|
||||||
|
|
||||||
- name: pr-status-build-linux
|
|
||||||
type: gitea-status
|
|
||||||
source:
|
|
||||||
access_token: ((gitea_api_key))
|
|
||||||
url: http://forgejo:3000
|
|
||||||
owner: bitsquid_dt
|
|
||||||
repo: dtmt
|
|
||||||
sha: ((pr.head.sha))
|
|
||||||
context: build/linux
|
|
||||||
description: "Build for the target platform: linux"
|
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
- name: clippy
|
- name: clippy
|
||||||
on_success:
|
|
||||||
put: state-success
|
|
||||||
resource: pr-status-lint-clippy
|
|
||||||
no_get: true
|
|
||||||
params:
|
|
||||||
state: success
|
|
||||||
|
|
||||||
on_failure:
|
|
||||||
put: state-success
|
|
||||||
resource: pr-status-lint-clippy
|
|
||||||
no_get: true
|
|
||||||
params:
|
|
||||||
state: failure
|
|
||||||
|
|
||||||
plan:
|
plan:
|
||||||
- put: state-pending
|
|
||||||
resource: pr-status-lint-clippy
|
|
||||||
no_get: true
|
|
||||||
params:
|
|
||||||
state: pending
|
|
||||||
|
|
||||||
- get: repo
|
- get: repo
|
||||||
trigger: true
|
trigger: true
|
||||||
|
- load_var: ref
|
||||||
|
file: repo/.git/ref
|
||||||
- task: check
|
- task: check
|
||||||
file: repo/.ci/tasks/clippy.yml
|
file: repo/.ci/tasks/clippy.yml
|
||||||
vars:
|
vars:
|
||||||
|
ref: ((.:ref))
|
||||||
gitea_api_key: ((gitea_api_key))
|
gitea_api_key: ((gitea_api_key))
|
||||||
|
|
||||||
|
|
||||||
- name: build-msvc
|
- name: build-msvc
|
||||||
on_success:
|
|
||||||
put: state-success
|
|
||||||
resource: pr-status-build-msvc
|
|
||||||
no_get: true
|
|
||||||
params:
|
|
||||||
state: success
|
|
||||||
|
|
||||||
on_failure:
|
|
||||||
put: state-success
|
|
||||||
resource: pr-status-build-msvc
|
|
||||||
no_get: true
|
|
||||||
params:
|
|
||||||
state: failure
|
|
||||||
|
|
||||||
plan:
|
plan:
|
||||||
- put: state-pending
|
|
||||||
resource: pr-status-build-msvc
|
|
||||||
no_get: true
|
|
||||||
params:
|
|
||||||
state: pending
|
|
||||||
|
|
||||||
- get: repo
|
- get: repo
|
||||||
trigger: true
|
trigger: true
|
||||||
|
- load_var: ref
|
||||||
|
file: repo/.git/ref
|
||||||
- task: build
|
- task: build
|
||||||
file: repo/.ci/tasks/build.yml
|
file: repo/.ci/tasks/build.yml
|
||||||
vars:
|
vars:
|
||||||
target: msvc
|
target: msvc
|
||||||
pr: ((pr))
|
output: artifact
|
||||||
|
ref: ((.:ref))
|
||||||
gitea_url: http://forgejo:3000
|
gitea_url: http://forgejo:3000
|
||||||
gitea_api_key: ((gitea_api_key))
|
gitea_api_key: ((gitea_api_key))
|
||||||
|
|
||||||
- load_var: version_number
|
|
||||||
reveal: true
|
|
||||||
file: artifact/version
|
|
||||||
|
|
||||||
- put: package
|
|
||||||
resource: gitea-package
|
|
||||||
no_get: true
|
|
||||||
inputs:
|
|
||||||
- artifact
|
|
||||||
params:
|
|
||||||
version: ((.:version_number))
|
|
||||||
fail_fast: true
|
|
||||||
override: true
|
|
||||||
globs:
|
|
||||||
- artifact/dtmt
|
|
||||||
- artifact/dtmm
|
|
||||||
- artifact/*.exe
|
|
||||||
|
|
||||||
- name: build-linux
|
- name: build-linux
|
||||||
on_success:
|
|
||||||
put: state-success
|
|
||||||
resource: pr-status-build-linux
|
|
||||||
no_get: true
|
|
||||||
params:
|
|
||||||
state: success
|
|
||||||
|
|
||||||
on_failure:
|
|
||||||
put: state-success
|
|
||||||
resource: pr-status-build-linux
|
|
||||||
no_get: true
|
|
||||||
params:
|
|
||||||
state: failure
|
|
||||||
|
|
||||||
plan:
|
plan:
|
||||||
- put: state-pending
|
|
||||||
resource: pr-status-build-linux
|
|
||||||
no_get: true
|
|
||||||
params:
|
|
||||||
state: pending
|
|
||||||
|
|
||||||
- get: repo
|
- get: repo
|
||||||
trigger: true
|
trigger: true
|
||||||
|
- load_var: ref
|
||||||
|
file: repo/.git/ref
|
||||||
- task: build
|
- task: build
|
||||||
file: repo/.ci/tasks/build.yml
|
file: repo/.ci/tasks/build.yml
|
||||||
vars:
|
vars:
|
||||||
target: linux
|
target: linux
|
||||||
pr: ((pr))
|
output: artifact
|
||||||
|
ref: ((.:ref))
|
||||||
gitea_url: http://forgejo:3000
|
gitea_url: http://forgejo:3000
|
||||||
gitea_api_key: ((gitea_api_key))
|
gitea_api_key: ((gitea_api_key))
|
||||||
|
- task: upload
|
||||||
- load_var: version_number
|
file: repo/.ci/tasks/upload.yml
|
||||||
reveal: true
|
vars:
|
||||||
file: artifact/version
|
input: artifact
|
||||||
|
pr: ((.:pr))
|
||||||
- put: package
|
gitea_api_key: ((gitea_api_key))
|
||||||
resource: gitea-package
|
gitea_user: bitsquid_dt
|
||||||
no_get: true
|
gitea_url: http://forgejo:3000
|
||||||
inputs:
|
|
||||||
- artifact
|
|
||||||
params:
|
|
||||||
version: ((.:version_number))
|
|
||||||
fail_fast: true
|
|
||||||
override: true
|
|
||||||
globs:
|
|
||||||
- artifact/dtmt
|
|
||||||
- artifact/dtmm
|
|
||||||
- artifact/*.exe
|
|
||||||
|
|
|
@ -1,48 +1,25 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
set -eu
|
set -eux
|
||||||
|
|
||||||
if [ -n "$OUTPUT" ]; then
|
|
||||||
OUTPUT="$PWD/$OUTPUT"
|
|
||||||
else
|
|
||||||
OUTPUT=$(mktemp -d)
|
|
||||||
fi
|
|
||||||
|
|
||||||
title() {
|
|
||||||
printf "\033[1m%s\033[0m\n" "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ -n "${PR:-}" ]; then
|
|
||||||
title "PR: $(echo "$PR" | jq '.number') - $(echo "$PR" | jq '.title')"
|
|
||||||
ref="pr-$(echo "$PR" | jq '.number')-$(git rev-parse --short HEAD 2>/dev/null || echo 'manual')"
|
|
||||||
else
|
|
||||||
ref=$(git describe --tags)
|
|
||||||
fi
|
|
||||||
|
|
||||||
title "Version is '$ref'"
|
|
||||||
echo "$ref" > "$OUTPUT/version"
|
|
||||||
|
|
||||||
cd "repo"
|
|
||||||
case "$TARGET" in
|
case "$TARGET" in
|
||||||
msvc)
|
msvc)
|
||||||
cp /src/*.lib ./lib/oodle/
|
cp /src/*.lib ./lib/oodle/
|
||||||
|
|
||||||
title "Build project for target $TARGET"
|
|
||||||
cargo build --color always --locked --release --target x86_64-pc-windows-msvc -Zbuild-std
|
cargo build --color always --locked --release --target x86_64-pc-windows-msvc -Zbuild-std
|
||||||
|
|
||||||
title "Install artifacts"
|
if [ -d "$OUTPUT" ]; then
|
||||||
install -t "$OUTPUT/" target/x86_64-pc-windows-msvc/release/dtmt.exe
|
install -t "$OUTPUT/" target/x86_64-pc-windows-msvc/release/dtmt.exe
|
||||||
install -t "$OUTPUT/" target/x86_64-pc-windows-msvc/release/dtmm.exe
|
install -t "$OUTPUT/" target/x86_64-pc-windows-msvc/release/dtmm.exe
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
linux)
|
linux)
|
||||||
cp /src/*.a ./lib/oodle/
|
cp /src/*.a ./lib/oodle/
|
||||||
|
|
||||||
title "Build project for target $TARGET"
|
|
||||||
cargo build --color always --locked --profile release-lto
|
cargo build --color always --locked --profile release-lto
|
||||||
|
|
||||||
title "Install artifacts"
|
if [ -d "$OUTPUT" ]; then
|
||||||
install -t "$OUTPUT/" target/release-lto/dtmt
|
install -t "$OUTPUT/" target/release/dtmt
|
||||||
install -t "$OUTPUT/" target/release-lto/dtmm
|
install -t "$OUTPUT/" target/release/dtmm
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Env var 'TARGET' must either be 'msvc' or 'linux'. Got '$TARGET'." >&2
|
echo "Env var 'TARGET' must either be 'msvc' or 'linux'. Got '$TARGET'." >&2
|
||||||
|
|
|
@ -13,7 +13,7 @@ inputs:
|
||||||
- name: repo
|
- name: repo
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
- name: artifact
|
- name: artifacts
|
||||||
|
|
||||||
caches:
|
caches:
|
||||||
- path: repo/target
|
- path: repo/target
|
||||||
|
@ -23,8 +23,13 @@ params:
|
||||||
CI: "true"
|
CI: "true"
|
||||||
TARGET: ((target))
|
TARGET: ((target))
|
||||||
GITEA_API_KEY: ((gitea_api_key))
|
GITEA_API_KEY: ((gitea_api_key))
|
||||||
PR: ((pr))
|
REF: ((ref))
|
||||||
OUTPUT: artifact
|
OUTPUT: artifacts
|
||||||
|
|
||||||
run:
|
run:
|
||||||
path: repo/.ci/tasks/build.sh
|
path: .ci/util/run.sh
|
||||||
|
dir: repo
|
||||||
|
args:
|
||||||
|
- .ci/tasks/build.sh
|
||||||
|
- build/((target))
|
||||||
|
- "Build for the target platform: ((target))"
|
||||||
|
|
|
@ -19,8 +19,13 @@ caches:
|
||||||
params:
|
params:
|
||||||
CI: "true"
|
CI: "true"
|
||||||
GITEA_API_KEY: ((gitea_api_key))
|
GITEA_API_KEY: ((gitea_api_key))
|
||||||
|
REF: ((ref))
|
||||||
|
|
||||||
run:
|
run:
|
||||||
path: .ci/tasks/clippy.sh
|
path: .ci/util/run.sh
|
||||||
dir: repo
|
dir: repo
|
||||||
|
args:
|
||||||
|
- .ci/tasks/clippy.sh
|
||||||
|
- lint/clippy
|
||||||
|
- "Checking for common mistakes and opportunities for code improvement"
|
||||||
|
|
||||||
|
|
31
.ci/tasks/upload.sh
Executable file
31
.ci/tasks/upload.sh
Executable file
|
@ -0,0 +1,31 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
artifacts="$PWD/artifacts"
|
||||||
|
repo="$PWD/repo"
|
||||||
|
|
||||||
|
base_url="${GITEA_URL}/api/packages/${GITEA_USER}/generic"
|
||||||
|
|
||||||
|
cd "$repo"
|
||||||
|
|
||||||
|
if [ -n "$PR" ]; then
|
||||||
|
echo "PR: $(echo "$PR" | jq '.number') - $(echo "$PR" | jq '.title')"
|
||||||
|
ref="pr-$(echo "$PR" | jq '.number')-$(git rev-parse --short HEAD 2>/dev/null || echo 'manual')"
|
||||||
|
else
|
||||||
|
ref=$(git describe --tags)
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "ref: $ref"
|
||||||
|
|
||||||
|
# TODO: If this is a tag, check the tag name to determine which
|
||||||
|
# binary was affected and only upload that.
|
||||||
|
for f in dtmt dtmt.exe dtmm dtmm.exe; do
|
||||||
|
if [ -f "$artifacts/$f" ]; then
|
||||||
|
url="$base_url/$(basename -s .exe $f)/$ref/$f"
|
||||||
|
curl -i -X 'PUT' \
|
||||||
|
--user "concourse:$GITEA_API_KEY" \
|
||||||
|
--upload-file "$artifacts/$f" \
|
||||||
|
"$url"
|
||||||
|
fi
|
||||||
|
done
|
24
.ci/tasks/upload.yml
Normal file
24
.ci/tasks/upload.yml
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
# yaml-language-server: $schema=https://raw.githubusercontent.com/cappyzawa/concourse-pipeline-jsonschema/master/concourse_jsonschema.json#/definitions/TaskConfig
|
||||||
|
---
|
||||||
|
platform: linux
|
||||||
|
|
||||||
|
image_resource:
|
||||||
|
name: python-script
|
||||||
|
type: registry-image
|
||||||
|
source:
|
||||||
|
repository: registry.local:5000/python-script
|
||||||
|
tag: latest
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
- name: repo
|
||||||
|
- name: ((input))
|
||||||
|
|
||||||
|
params:
|
||||||
|
CI: "true"
|
||||||
|
GITEA_API_KEY: ((gitea_api_key))
|
||||||
|
GITEA_URL: ((gitea_url))
|
||||||
|
GITEA_USER: ((user))
|
||||||
|
PR: ((pr))
|
||||||
|
|
||||||
|
run:
|
||||||
|
path: repo/.ci/tasks/upload.sh
|
25
Justfile
25
Justfile
|
@ -1,5 +1,3 @@
|
||||||
fly_target := "main"
|
|
||||||
|
|
||||||
ci-build: ci-build-msvc ci-build-linux
|
ci-build: ci-build-msvc ci-build-linux
|
||||||
|
|
||||||
ci-build-msvc:
|
ci-build-msvc:
|
||||||
|
@ -27,26 +25,3 @@ ci-image-linux:
|
||||||
docker build -t dtmt-ci-base-linux -f .ci/image/Dockerfile.linux .ci/image
|
docker build -t dtmt-ci-base-linux -f .ci/image/Dockerfile.linux .ci/image
|
||||||
docker tag dtmt-ci-base-linux registry.sclu1034.dev/dtmt-ci-base-linux
|
docker tag dtmt-ci-base-linux registry.sclu1034.dev/dtmt-ci-base-linux
|
||||||
docker push registry.sclu1034.dev/dtmt-ci-base-linux
|
docker push registry.sclu1034.dev/dtmt-ci-base-linux
|
||||||
|
|
||||||
set-base-pipeline:
|
|
||||||
fly -t ((fly_target)) set-pipeline \
|
|
||||||
--pipeline dtmt-prs \
|
|
||||||
--config .ci/pipelines/base-pipeline.yml \
|
|
||||||
-v gitea_api_key=${GITEA_API_KEY} \
|
|
||||||
-v owner=bitsquid_dt \
|
|
||||||
-v repo=dtmt
|
|
||||||
|
|
||||||
set-pr-pipeline pr:
|
|
||||||
curl \
|
|
||||||
-H "Authorization: ${GITEA_API_KEY}" \
|
|
||||||
-H 'Accept: application/json' \
|
|
||||||
'https://git.sclu1034.dev/api/v1/repos/bitsquid_dt/dtmt/pulls/{{pr}}' \
|
|
||||||
| yq -y '.' - > 'pr-{{pr}}.yaml'
|
|
||||||
fly -t main set-pipeline \
|
|
||||||
--pipeline dtmt-pr \
|
|
||||||
--config .ci/pipelines/pr.yml \
|
|
||||||
-v gitea_api_key=${GITEA_API_KEY} \
|
|
||||||
-i n={{pr}} \
|
|
||||||
-y branch="$(yq -y '.head.ref' 'pr-{{pr}}.yaml')" \
|
|
||||||
-y pr="$(cat 'pr-{{pr}}.yaml')"
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue