Skip to content

CI

CI #548

Workflow file for this run

name: CI
on:
push:
branches:
- main
tags:
- '*'
pull_request: {}
env:
NJS_VERSION: 0.8.5
jobs:
info:
runs-on: ubuntu-latest
outputs:
has_tag: ${{ steps.get_info.outputs.has_tag }}
tag: ${{ steps.get_info.outputs.tag }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- id: get_info
run: |
tag="${GITHUB_REF##*/}"
echo "has_tag=$has_tag" >> $GITHUB_OUTPUT
echo "tag=$tag" >> $GITHUB_OUTPUT
env:
has_tag: ${{ startsWith(github.ref, 'refs/tags/') }}
- name: Validate version tag
if: github.event_name == 'push' && steps.get_info.outputs.has_tag == 'true'
run: |
if [ $(cat VERSION) != ${{ steps.get_info.outputs.tag }} ]; then
echo "::error file=VERSION,line=1,col=1::Version string in VERSION ($(cat VERSION)) does not match the tag string (${{ steps.get_info.outputs.tag }})"
exit 1
fi
test:
needs: [info]
strategy:
matrix:
dc: [dmd-2.109.1, ldc-1.39.0 ]
experimental: [false]
include:
- dc: dmd-latest
experimental: true
- dc: ldc-latest
experimental: true
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/.dub
key: ${{ runner.os }}-${{ runner.arch }}-glibc-dub-${{ matrix.dc }}-${{ hashFiles('dub.selections.json') }}
- id: njs_cache
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/.njs
key: ${{ runner.os }}-${{ runner.arch }}-${{ env.NJS_VERSION }}
- uses: dlang-community/setup-dlang@v1
with:
compiler: ${{ matrix.dc }}
- name: Install njs libs
if: steps.njs_cache.outputs.cache-hit != 'true'
run: |
./.devcontainer/setup-njs.sh ${{ env.NJS_VERSION }} .njs
- name: Run tests
run: |
dub --cache=local test
env:
NJS_BASE: ${{ github.workspace }}/.njs
CPATH: ${{ github.workspace }}/.njs/include
LIBRARY_PATH: ${{ github.workspace }}/.njs/lib
build-linux:
needs: [info]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: jirutka/setup-alpine@v1
with:
branch: edge
packages: ldc dub gcc musl-dev git pcre2-dev make
- uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/.dub
key: alpine-${{ runner.arch }}-dub-${{ hashFiles('dub.selections.json') }}
- id: njs_cache
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/.njs
key: alpine-${{ runner.arch }}-njs-${{ env.NJS_VERSION }}
- name: Install njs libs
if: steps.njs_cache.outputs.cache-hit != 'true'
run: |
./.devcontainer/setup-njs.sh ${{ env.NJS_VERSION }} .njs
shell: alpine.sh {0}
- name: Run tests
run: |
dub --cache=local test
shell: alpine.sh {0}
env:
NJS_BASE: ${{ github.workspace }}/.njs
C_INCLUDE_PATH: ${{ github.workspace }}/.njs/include
LIBRARY_PATH: ${{ github.workspace }}/.njs/lib
- name: Build a binary
run: |
dub --cache=local build -b release-static
strip bin/shaft
shell: alpine.sh {0}
env:
NJS_BASE: ${{ github.workspace }}/.njs
C_INCLUDE_PATH: ${{ github.workspace }}/.njs/include
LIBRARY_PATH: ${{ github.workspace }}/.njs/lib
- name: Test shaft-specific features
uses: common-workflow-lab/run-tests@v1
with:
test-list: ${{ github.workspace }}/tests/test.yml
runner: ${{ github.workspace }}/bin/shaft
timeout: 30
result-title: Results of shaft-specific features
- uses: actions/upload-artifact@v4
with:
name: shaft-linux-${{ runner.arch }}-main
path: ${{ github.workspace }}/bin/shaft
build-mac:
needs: [info]
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/.dub
key: ${{ runner.os }}-${{ runner.arch }}-dub-${{ hashFiles('dub.selections.json') }}
- id: njs_cache
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/.njs
key: ${{ runner.os }}-${{ runner.arch }}-${{ env.NJS_VERSION }}
- uses: dlang-community/setup-dlang@v1
with:
compiler: ldc-1.39.0
- name: Install njs libs
if: steps.njs_cache.outputs.cache-hit != 'true'
run: |
./.devcontainer/setup-njs.sh ${{ env.NJS_VERSION }} .njs
- name: Run tests
run: |
dub --cache=local test
env:
NJS_BASE: ${{ github.workspace }}/.njs
C_INCLUDE_PATH: ${{ github.workspace }}/.njs/include
LIBRARY_PATH: ${{ github.workspace }}/.njs/lib
- name: Build a binary
run: |
dub --cache=local build -b release
env:
NJS_BASE: ${{ github.workspace }}/.njs
C_INCLUDE_PATH: ${{ github.workspace }}/.njs/include
LIBRARY_PATH: ${{ github.workspace }}/.njs/lib
- uses: actions/upload-artifact@v4
with:
name: shaft-osx-${{ runner.arch }}-main
path: ${{ github.workspace }}/bin/shaft
conformance:
needs: [test, build-linux, build-mac]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: shaft-linux-${{ runner.arch }}-main
- run: chmod +x shaft
- name: Run conformance tests
id: run-conformance
uses: common-workflow-lab/run-conformance-tests@v1
with:
cwlVersion: v1.0
runner: ${{ github.workspace }}/shaft
timeout: 30
tags: command_line_tool,expression_tool
extra: --remove-tmpdir --veryverbose --enable-compat=extended-props
- name: Save badges
if: success() && github.event_name == 'push'
uses: common-workflow-lab/upload-conformance-badges@v1
with:
cwlVersion: v1.0
runner-name: shaft
badgedir: ${{ steps.run-conformance.outputs.badgedir }}
repository: ${{ github.repository_owner }}/conformance
upload-default-branch: true
upload-markdown-reports: true
ssh-key: ${{ secrets.CONFORMANCE_KEY }}
release:
runs-on: ubuntu-latest
needs: [info, conformance]
if: github.event_name == 'push' && needs.info.outputs.has_tag == 'true'
steps:
- name: Generate release text
run: |
cat << EOS > $GITHUB_WORKSPACE/release.md
## Conformance tests for CWL ${cwlVersion}
[![version](https://badgen.net/https/raw.githubusercontent.com/tom-tan/conformance/master/shaft/cwl_${cwlVersion}/shaft_${tag}/version.json)](https://github.com/tom-tan/shaft/releases/tag/${tag}) [![commit](https://badgen.net/https/raw.githubusercontent.com/tom-tan/conformance/master/shaft/cwl_${cwlVersion}/shaft_${tag}/commit.json)](https://github.com/tom-tan/shaft/tree/${tag})
### Classes
[![CommandLineTool](https://badgen.net/https/raw.githubusercontent.com/tom-tan/conformance/master/shaft/cwl_${cwlVersion}/shaft_${tag}/command_line_tool.json?icon=commonwl)](https://github.com/tom-tan/conformance/blob/master/shaft/cwl_${cwlVersion}/shaft_${tag}/command_line_tool.md) [![ExpressionTool](https://badgen.net/https/raw.githubusercontent.com/tom-tan/conformance/master/shaft/cwl_${cwlVersion}/shaft_${tag}/expression_tool.json?icon=commonwl)](https://github.com/tom-tan/conformance/blob/master/shaft/cwl_${cwlVersion}/shaft_${tag}/expression_tool.md)
### Required features
[![Required](https://badgen.net/https/raw.githubusercontent.com/tom-tan/conformance/master/shaft/cwl_${cwlVersion}/shaft_${tag}/required.json?icon=commonwl)](https://github.com/tom-tan/conformance/blob/master/shaft/cwl_${cwlVersion}/shaft_${tag}/required.md)
### Optional features
[![DockerRequirement](https://badgen.net/https/raw.githubusercontent.com/tom-tan/conformance/master/shaft/cwl_${cwlVersion}/shaft_${tag}/docker.json?icon=commonwl)](https://github.com/tom-tan/conformance/blob/master/shaft/cwl_${cwlVersion}/shaft_${tag}/docker.md) [![EnvVarRequirement](https://badgen.net/https/raw.githubusercontent.com/tom-tan/conformance/master/shaft/cwl_${cwlVersion}/shaft_${tag}/env_var.json?icon=commonwl)](https://github.com/tom-tan/conformance/blob/master/shaft/cwl_${cwlVersion}/shaft_${tag}/env_var.md) [![InitialWorkDirRequirement](https://badgen.net/https/raw.githubusercontent.com/tom-tan/conformance/master/shaft/cwl_${cwlVersion}/shaft_${tag}/initial_work_dir.json?icon=commonwl)](https://github.com/tom-tan/conformance/blob/master/shaft/cwl_${cwlVersion}/shaft_${tag}/initial_work_dir.md) [![InlineJavascriptRequirement](https://badgen.net/https/raw.githubusercontent.com/tom-tan/conformance/master/shaft/cwl_${cwlVersion}/shaft_${tag}/inline_javascript.json?icon=commonwl)](https://github.com/tom-tan/conformance/blob/master/shaft/cwl_${cwlVersion}/shaft_${tag}/inline_javascript.md) [![ResourceRequirement](https://badgen.net/https/raw.githubusercontent.com/tom-tan/conformance/master/shaft/cwl_${cwlVersion}/shaft_${tag}/resource.json?icon=commonwl)](https://github.com/tom-tan/conformance/blob/master/shaft/cwl_${cwlVersion}/shaft_${tag}/resource.md) [![SchemaDefRequirement](https://badgen.net/https/raw.githubusercontent.com/tom-tan/conformance/master/shaft/cwl_${cwlVersion}/shaft_${tag}/schema_def.json?icon=commonwl)](https://github.com/tom-tan/conformance/blob/master/shaft/cwl_${cwlVersion}/shaft_${tag}/schema_def.md) [![ShellCommandRequirement](https://badgen.net/https/raw.githubusercontent.com/tom-tan/conformance/master/shaft/cwl_${cwlVersion}/shaft_${tag}/shell_command.json?icon=commonwl)](https://github.com/tom-tan/conformance/blob/master/shaft/cwl_${cwlVersion}/shaft_${tag}/shell_command.md)
EOS
env:
cwlVersion: v1.0
tag: ${{ needs.info.outputs.tag }}
- uses: actions/download-artifact@v4
with:
name: shaft-linux-X64-main
- run: |
chmod +x shaft
tar cf ${GITHUB_WORKSPACE}/shaft-linux-x86_64.tar.gz shaft
rm shaft
- uses: actions/download-artifact@v4
with:
name: shaft-osx-ARM64-main
- run: |
chmod +x shaft
tar cf ${GITHUB_WORKSPACE}/shaft-osx-aarch64.tar.gz shaft
rm shaft
- uses: softprops/action-gh-release@v1
id: create_release
with:
body_path: ${{ github.workspace }}/release.md
files: |
shaft-linux-x86_64.tar.gz
shaft-osx-aarch64.tar.gz