Skip to content

Commit

Permalink
Minor changes to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
mario4tier committed Dec 20, 2024
1 parent a07080b commit 8ea0a65
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 37 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/dev-nightly-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
with:
python-version: "3.x"

- name: Create shell envs (Linux)
- name: Prepare shell envs (Linux)
if: runner.os == 'Linux'
shell: bash
run: |
Expand All @@ -52,7 +52,7 @@ jobs:
$PYTHON $GITHUB_WORKSPACE/scripts/package.py
$PYTHON $GITHUB_WORKSPACE/scripts/test-dist.py
- name: Create shell envs (Windows x64)
- name: Prepare shell envs (Windows x64)
if: runner.os == 'Windows'
shell: cmd
run: |
Expand Down
63 changes: 31 additions & 32 deletions .github/workflows/main-nightly-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,38 @@ jobs:
os: [ubuntu-latest, windows-2022]

steps:
- name: Checkout main Branch
- name: Checkout main branch
uses: actions/checkout@v4
with:
ref: main

- name: Install build tools (Linux)
if: runner.os == 'Linux'
shell: bash
run: |
sudo apt update && sudo apt install -y automake libtool autogen mcpp openjdk-21-jdk
- name: Install Rust Toolchain (Linux)
if: runner.os == 'Linux'
uses: dtolnay/rust-toolchain@stable

- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Create shell envs (Linux)
- name: Prepare shell envs (Linux)
if: runner.os == 'Linux'
shell: bash
run: |
echo "PYTHON=python3" >> $GITHUB_ENV
- name: Create shell envs (Windows)
- name: Build dist assets (Linux)
if: runner.os == 'Linux'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
sudo apt update
sudo apt install -y automake libtool autogen mcpp
sudo apt install -y openjdk-21-jdk
sudo apt install -y gcc-multilib
sudo apt install -y gcc-i686-linux-gnu
sudo apt install -y gcc-aarch64-linux-gnu
$PYTHON $GITHUB_WORKSPACE/scripts/package.py
$PYTHON $GITHUB_WORKSPACE/scripts/test-dist.py
- name: Prepare shell envs (Windows x64)
if: runner.os == 'Windows'
shell: cmd
run: |
Expand All @@ -55,35 +60,29 @@ jobs:
echo VCVARSALL=%VCVARSALL% >> %GITHUB_ENV%
echo PYTHON=python >> %GITHUB_ENV%
- name: Build dist assets (Linux)
if: runner.os == 'Linux'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
$PYTHON $GITHUB_WORKSPACE/scripts/package.py
- name: Build dist assets (Windows x64)
if: runner.os == 'Windows'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: cmd
run: |
call "%VCVARSALL%" x64
dotnet tool install --global wix
set PATH=%PATH%;%USERPROFILE%\.dotnet\tools
wix extension add --global WixToolset.UI.wixext
wix extension list --global
%PYTHON% %GITHUB_WORKSPACE%\scripts\package.py
%PYTHON% %GITHUB_WORKSPACE%\scripts\test-dist.py
- name: Test dist assets (Linux)
- name: Verify dist assets are up-to-date
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
$PYTHON $GITHUB_WORKSPACE/scripts/test-dist.py
- name: Test dist assets (Windows x64)
if: runner.os == 'Windows'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: cmd
run: |
call "%VCVARSALL%" x64
%PYTHON% %GITHUB_WORKSPACE%\scripts\test-dist.py
dist_changes=$(git status --porcelain dist/)
ta_common_changes=$(git status --porcelain include/ta_common.h)
if [ -n "$dist_changes" ] || [ -n "$ta_common_changes" ]; then
echo "Error: Unexpected changes in dist/ assets."
echo "The dev-nigthly-tests.yml should have updated these assets."
exit 1
fi
65 changes: 65 additions & 0 deletions .github/workflows/publish-step-1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Manually triggered for creating a TA-Lib release.
#
# More info: README-DEVS.md

name: publish-step-1

# Controls when the workflow will run
on:
workflow_dispatch:

jobs:
create_release:
runs-on: ubuntu-latest

steps:
- name: Checkout main branch
uses: actions/checkout@v4
with:
ref: main

- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Prepare shell envs
shell: bash
run: |
VERSION=$(cat VERSION)
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "PYTHON=python3" >> $GITHUB_ENV
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Tagging
run: |
TAG="v${{ env.VERSION }}"
if git rev-parse "$TAG" >/dev/null 2>&1; then
git tag -d "$TAG"
git push --delete origin "$TAG"
fi
git tag "$TAG"
git push origin "$TAG"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "v${{ env.VERSION }}"
release_name: "v${{ env.VERSION }}"
body: ${{ github.event.inputs.release_body }}
draft: true
prerelease: false

- name: Upload Release Assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/*
asset_name: $(basename ${{ steps.create_release.outputs.upload_url }})
asset_content_type: application/octet-stream
8 changes: 5 additions & 3 deletions README-DEVS.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,11 @@ Any dev with permission to merge to main branch can do a release.

(6) Wait up to one day for the "nightly main" Github action to succeed. This will perform a last check that all assets are OK. As needed, you can instead manually trig it.

(7) Manually trig the "publish-step-one" Github action. This will create the tag, draft release and attach all assets.
(7) Manually trig the "publish-step-1" Github action on main branch. This will create the tag, draft release and attach all assets from the dist/ directory.

(8) Edit the Release notes on the Github website.
(8) Edit the draft Release notes on the Github website.

(9) Manually trig "publish-step-two" Github action. This will make the release public.
(9) Manually trig "publish-step-2" Github action. This will make the release public.

(10) Manually trig "publish-step-3". This will submit a PR to update homebrew for macOS users:
https://github.com/Homebrew/homebrew-core/blob/30106807361198c58a395de65547694427adf229/Formula/t/ta-lib.rb

0 comments on commit 8ea0a65

Please sign in to comment.