Build for Linux X86-64 on upstream commits #603
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: Build for Linux X86-64 on upstream commits | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '37 11 * * *' | |
jobs: | |
build-lin64: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: gh_pm45 | |
fetch-depth: 0 | |
- name: Pull | |
run: | | |
if [ "${{ github.event.schedule }}" == "" ] ; then touch _pulled_; fi | |
echo Polling upstram: `date` | |
old=`git log -1 --format=%H` | |
git config user.email "[email protected]" | |
git config user.name "Giles Atkinson" | |
git config pull.rebase false | |
git pull https://git.code.sf.net/p/ngspice/ngspice pre-master-45 | |
new=`git log -1 --format=%H` | |
if [ $new != $old ] ; then touch _pulled_; fi | |
- name: Install Dependencies | |
if: hashFiles('_pulled_') != '' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y build-essential git make bison flex libtool autoconf automake libx11-dev libxaw7-dev libreadline-dev libxmu6 libxft2 libxrender1 libfreetype6 libfontconfig | |
- name: Clean /usr/local | |
if: hashFiles('_pulled_') != '' | |
run: | | |
cd /usr | |
sudo mv local l | |
sudo mkdir -m777 local | |
- name: Build | |
if: hashFiles('_pulled_') != '' | |
run: | | |
./compile_linux.sh | |
echo Create README.ngspice | |
echo 'This binary package of ngspice was built at https://github.com/gatk555/ngspice.' > /usr/local/README.ngspice | |
echo 'The source code came from the pre-master-45 branch with head revision:' >> /usr/local/README.ngspice | |
echo >> /usr/local/README.ngspice | |
git log -1 --skip=1 >> /usr/local/README.ngspice | |
- name: Save | |
if: hashFiles('_pulled_') != '' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Ngspice pre-master-45, Linux X86-64 | |
path: /usr/local | |
- name: Push | |
if: hashFiles('_pulled_') != '' | |
run: | | |
git push https://oauth2:${{ secrets.GITHUB_TOKEN }}@github.com/gatk555/ngspice.git gh_pm45 | |
- name: Sweep | |
# Remove all but the latest failed workflow runs. | |
run: | | |
h1='--header="Accept: application/vnd.github+json"' | |
h2='--header="X-GitHub-Api-Version: 2022-11-28"' | |
h3='--header="Authorization: Bearer "'${{ secrets.GITHUB_TOKEN }} | |
for i in `wget -O - -q https://oauth2:${{ secrets.GITHUB_TOKEN }}@api.github.com/repos/gatk555/ngspice/actions/runs?status=failure | jq .workflow_runs[1:][].id` | |
do | |
echo Deleting run $i | |
eval wget -O - -q $h1 $h2 $h3 --method=DELETE https://api.github.com/repos/gatk555/ngspice/actions/runs/$i | |
done | |
- name: Deliberately fail. | |
if: hashFiles('_pulled_') == '' | |
run: false | |
- name: Trigger others | |
run: | | |
h1='--header="Accept: application/vnd.github+json"' | |
h2='--header="X-GitHub-Api-Version: 2022-11-28"' | |
h3='--header="Authorization: Bearer "'${{ secrets.GITHUB_TOKEN }} | |
eval wget -q $h1 $h2 $h3 --post-data=\''{"ref":"ci"}'\' https://api.github.com/repos/gatk555/ngspice/actions/workflows/others.yml/dispatches | |