Nightly Build #90
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
name: Nightly Build | |
on: | |
schedule: | |
- cron: '0 1 * * *' | |
jobs: | |
activity-check: | |
runs-on: ubuntu-latest | |
name: Check if branch is stale | |
outputs: | |
stale: ${{ steps.activity_check.outputs.stale }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: show latest commit | |
run: | | |
echo ${{ github.sha }} | |
- id: activity_check | |
continue-on-error: true | |
name: check latest commit is less than a day | |
if: ${{ github.event_name == 'schedule' }} | |
run: | | |
test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "stale=true" >> "$GITHUB_OUTPUT" | |
build: | |
needs: activity-check | |
if: needs.activity-check.outputs.stale != 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: install dependencies | |
run: | | |
sudo apt update | |
sudo apt-get install -y build-essential autoconf automake autotools-dev xz-utils git libelf-dev texinfo | |
- name: build or1ksim | |
run: | | |
./configure --prefix=/opt/or1k --target=or1k-elf | |
make -j $(nproc) | |
make DESTDIR=$PWD/install install | |
- name: tarball build | |
run: tar czvf or1ksim.tar.gz -C ./install/opt/ or1k/ | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: or1ksim-nightly | |
path: or1ksim.tar.gz | |
create-release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download all artifacts to current Directory | |
uses: actions/download-artifact@v3 | |
with: | |
name: or1ksim-nightly | |
- name: Display structure of downloaded files | |
run: ls -ltr | |
- name: Run Commands to Setup Env | |
run: | | |
DATESTAMP="$(date --utc '+%Y-%m-%d')" | |
echo "Version: ${DATESTAMP}-nightly" | |
# Setup environment variables | |
echo "DATESTAMP=${DATESTAMP}" >> $GITHUB_ENV | |
echo "DATEWORD=$(date --utc '+%B %d, %Y')" >> $GITHUB_ENV | |
shell: bash | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.DATESTAMP }} | |
release_name: "Nightly: ${{ env.DATEWORD }}" | |
body: | | |
**Automated Nightly Release** | |
${{ env.DATESTAMP }}-nightly | |
draft: false | |
prerelease: true | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./or1ksim.tar.gz | |
asset_name: or1ksim-${{ env.DATESTAMP }}.tar.gz | |
asset_content_type: application/gzip |