mirror of
https://github.com/im-tomu/fomu-toolchain.git
synced 2024-09-20 02:40:08 +00:00
172 lines
4.2 KiB
YAML
172 lines
4.2 KiB
YAML
name: 'update'
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
schedule:
|
|
- cron: '0 0 * * 5'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
|
|
|
|
run:
|
|
strategy:
|
|
fail-fast: false
|
|
max-parallel: 3
|
|
matrix:
|
|
os: [ Linux, Windows, macOS ]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
|
|
- run: git config --global core.autocrlf input
|
|
shell: bash
|
|
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- run: ARCH=${{ matrix.os }} ./build.sh
|
|
|
|
- uses: actions/upload-artifact@v2
|
|
with:
|
|
name: fomu-toolchain-${{ matrix.os }}
|
|
path: |
|
|
output/fomu-toolchain-${{ matrix.os }}*.tar.gz
|
|
output/fomu-toolchain-${{ matrix.os }}*.zip
|
|
output/fomu-toolchain-${{ matrix.os }}*.sha1
|
|
output/fomu-toolchain-${{ matrix.os }}*.sha256
|
|
output/fomu-toolchain-${{ matrix.os }}*.sha512
|
|
|
|
|
|
test:
|
|
needs: [ run ]
|
|
strategy:
|
|
fail-fast: false
|
|
max-parallel: 3
|
|
matrix:
|
|
os: [ ubuntu, windows, macos ]
|
|
runs-on: ${{ matrix.os }}-latest
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
steps:
|
|
|
|
- run: git config --global core.autocrlf input
|
|
shell: bash
|
|
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
repository: im-tomu/fomu-workshop
|
|
submodules: true
|
|
fetch-depth: 0
|
|
|
|
- uses: actions/setup-python@v2
|
|
with:
|
|
python-version: 3.8
|
|
|
|
- name: Set FOMU_TOOLCHAIN envvar
|
|
run: |
|
|
case '${{ matrix.os }}' in
|
|
ubuntu) ARCH=Linux;;
|
|
windows) ARCH=Windows;;
|
|
macos) ARCH=macOS;;
|
|
esac
|
|
echo "FOMU_TOOLCHAIN=fomu-toolchain-$ARCH" >> $GITHUB_ENV
|
|
|
|
- uses: actions/download-artifact@v2
|
|
with:
|
|
name: ${{ env.FOMU_TOOLCHAIN }}
|
|
|
|
- name: Install (Ubuntu)
|
|
if: matrix.os == 'ubuntu'
|
|
run: |
|
|
tar xzf ${{ env.FOMU_TOOLCHAIN }}.tar.gz
|
|
curl -L https://ziglang.org/download/0.9.0/zig-linux-x86_64-0.9.0.tar.xz | tar -xJf -
|
|
echo "$(pwd)/zig-linux-x86_64-0.9.0" >> $GITHUB_PATH
|
|
|
|
- name: Install (Windows)
|
|
if: matrix.os == 'windows'
|
|
run: |
|
|
unzip ${{ env.FOMU_TOOLCHAIN }}.zip
|
|
choco install zig --version 0.9.0
|
|
ln -s $(which python) /usr/bin/python3
|
|
|
|
- name: Install (Mac OS)
|
|
if: matrix.os == 'macos'
|
|
run: |
|
|
unzip ${{ env.FOMU_TOOLCHAIN }}.zip
|
|
brew install zig
|
|
|
|
- name: Install Scala (Mac OS)
|
|
if: matrix.os == 'macos'
|
|
uses: olafurpg/setup-scala@v10
|
|
with:
|
|
java-version: openjdk@1.11
|
|
|
|
- run: |
|
|
echo "$(pwd)/${{ env.FOMU_TOOLCHAIN }}/bin" >> $GITHUB_PATH
|
|
./.github/tests.sh
|
|
|
|
|
|
release:
|
|
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || contains(github.ref, 'refs/tags/'))
|
|
needs: [ test ]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
|
|
- uses: actions/download-artifact@v2
|
|
|
|
- uses: pyTooling/Actions/releaser@r0
|
|
with:
|
|
token: ${{ github.token }}
|
|
tag: nightly
|
|
files: ./**
|
|
|
|
|
|
container:
|
|
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || contains(github.ref, 'refs/tags/'))
|
|
needs: [ test ]
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
IMAGE_NAME: fomu-toolchain
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- uses: actions/download-artifact@v2
|
|
with:
|
|
name: fomu-toolchain-Linux
|
|
|
|
- name: Build image
|
|
run: docker build -t $IMAGE_NAME -f Dockerfile .
|
|
|
|
- name: Login to docker.io
|
|
uses: docker/login-action@v1
|
|
with:
|
|
registry: docker.pkg.github.com
|
|
username: "${{ github.actor }}"
|
|
password: "${{ github.token }}"
|
|
|
|
- name: Push image
|
|
run: |
|
|
IMAGE_ID=$(echo "docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME" | tr '[A-Z]' '[a-z]')
|
|
|
|
# Strip git ref prefix from version
|
|
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
|
|
|
|
# Strip "v" prefix from tag name
|
|
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
|
|
|
|
# Use Docker `latest` tag convention
|
|
[ "$VERSION" == "master" ] && VERSION=latest
|
|
|
|
echo IMAGE_ID=$IMAGE_ID
|
|
echo VERSION=$VERSION
|
|
|
|
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
|
|
docker push $IMAGE_ID:$VERSION
|