Skip to content

Refactor

Refactor #530

Workflow file for this run

name: CI
on:
push:
branches:
- main
tags:
- '*'
pull_request: {}
env:
NJS_VERSION: 0.8.3
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.107.1, ldc-1.37.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
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- uses: actions/cache@v4
with:
path: |
/tmp/.buildx-cache
${{ github.workspace }}/.dub
key: ${{ runner.os }}-buildx
- name: Build container to build single binary
id: dev_container
uses: docker/build-push-action@v5
with:
file: Dockerfile.build
load: true
tags: shaft-dev
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
build-args: |
NJS_VERSION=${{ env.NJS_VERSION }}
- run: |
docker run --rm -i -v $GITHUB_WORKSPACE:/workdir -e GITHUB_REF=$GITHUB_REF shaft-dev \
sh -c "dub --cache=local build -b release-static && strip bin/shaft"
- name: Setup cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
sudo chown -R $UID:$UID .dub
- 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 }}-master
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.37.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 }}-master
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 }}-master
- 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
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://www.commonwl.org/v1.0/CommandLineTool.html) [![ExpressionTool](https://badgen.net/https/raw.githubusercontent.com/tom-tan/conformance/master/shaft/cwl_${cwlVersion}/shaft_${tag}/expression_tool.json?icon=commonwl)](https://www.commonwl.org/v1.0/Workflow.html#ExpressionTool)
### Required features
[![Required](https://badgen.net/https/raw.githubusercontent.com/tom-tan/conformance/master/shaft/cwl_${cwlVersion}/shaft_${tag}/required.json?icon=commonwl)](https://www.commonwl.org/v1.0/)
### Optional features
[![DockerRequirement](https://badgen.net/https/raw.githubusercontent.com/tom-tan/conformance/master/shaft/cwl_${cwlVersion}/shaft_${tag}/docker.json?icon=commonwl)](https://www.commonwl.org/v1.0/CommandLineTool.html#DockerRequirement) [![EnvVarRequirement](https://badgen.net/https/raw.githubusercontent.com/tom-tan/conformance/master/shaft/cwl_${cwlVersion}/shaft_${tag}/env_var.json?icon=commonwl)](https://www.commonwl.org/v1.0/CommandLineTool.html#EnvVarRequirement) [![InitialWorkDirRequirement](https://badgen.net/https/raw.githubusercontent.com/tom-tan/conformance/master/shaft/cwl_${cwlVersion}/shaft_${tag}/initial_work_dir.json?icon=commonwl)](https://www.commonwl.org/v1.0/CommandLineTool.html#InitialWorkDirRequirement) [![InlineJavascriptRequirement](https://badgen.net/https/raw.githubusercontent.com/tom-tan/conformance/master/shaft/cwl_${cwlVersion}/shaft_${tag}/inline_javascript.json?icon=commonwl)](https://www.commonwl.org/v1.0/CommandLineTool.html#InlineJavascriptRequirement) [![ResourceRequirement](https://badgen.net/https/raw.githubusercontent.com/tom-tan/conformance/master/shaft/cwl_${cwlVersion}/shaft_${tag}/resource.json?icon=commonwl)](https://www.commonwl.org/v1.0/CommandLineTool.html#ResourceRequirement) [![SchemaDefRequirement](https://badgen.net/https/raw.githubusercontent.com/tom-tan/conformance/master/shaft/cwl_${cwlVersion}/shaft_${tag}/schema_def.json?icon=commonwl)](https://www.commonwl.org/v1.0/CommandLineTool.html#SchemaDefRequirement) [![ShellCommandRequirement](https://badgen.net/https/raw.githubusercontent.com/tom-tan/conformance/master/shaft/cwl_${cwlVersion}/shaft_${tag}/shell_command.json?icon=commonwl)](https://www.commonwl.org/v1.0/CommandLineTool.html#ShellCommandRequirement)
EOS
env:
cwlVersion: v1.0
tag: ${{ needs.info.outputs.tag }}
- uses: actions/download-artifact@v4
with:
name: shaft-linux-X64-master
- 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-X64-master
- run: |
chmod +x shaft
tar cf ${GITHUB_WORKSPACE}/shaft-osx-x86_64.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-x86_64.tar.gz