Skip to content

Commit ef58649

Browse files
committed
Tweak workflow
1 parent 3c0c6d4 commit ef58649

File tree

1 file changed

+146
-123
lines changed

1 file changed

+146
-123
lines changed

.github/workflows/release.yml

Lines changed: 146 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -23,133 +23,156 @@ jobs:
2323
matrix:
2424
nif: ["2.15"]
2525
job:
26-
- { target: aarch64-apple-darwin , os: macos-11 }
27-
- { target: x86_64-apple-darwin , os: macos-11 }
28-
- { target: x86_64-unknown-linux-gnu , os: ubuntu-20.04 , apt: musl-tools alsa-utils alsa-tools libasound2-dev libudev-dev pkg-config portaudio19-dev build-essential libpulse-dev libdbus-1-dev llvm-dev libclang-dev clang }
29-
- { target: x86_64-unknown-linux-musl , os: ubuntu-20.04 , apt: musl-tools alsa-utils alsa-tools libasound2-dev libudev-dev pkg-config portaudio19-dev build-essential libpulse-dev libdbus-1-dev llvm-dev libclang-dev clang }
30-
- { target: aarch64-unknown-linux-gnu , os: ubuntu-22.04 , arch: aarch64 , apt: "libasound2-dev:arm64 pkg-config libgcc-s1:arm64 libc6:arm64 gcc-aarch64-linux-gnu build-essential crossbuild-essential-arm64" }
31-
- { target: aarch64-unknown-linux-musl , os: ubuntu-22.04 , arch: aarch64 , apt: "musl-tools libasound2-dev:arm64 pkg-config libgcc-s1:arm64 libc6:arm64 gcc-aarch64-linux-gnu build-essential crossbuild-essential-arm64" }
32-
- { target: riscv64gc-unknown-linux-gnu , os: ubuntu-22.04 , arch: riscv64 , apt: "wget gcc-riscv64-linux-gnu libc6-riscv64-cross crossbuild-essential-riscv64 libasound2-dev:riscv64 pkg-config" }
33-
- { target: x86_64-pc-windows-gnu , os: windows-2022 }
34-
- { target: x86_64-pc-windows-msvc , os: windows-2019 },
26+
- { target: aarch64-apple-darwin, os: macos-11 }
27+
- { target: x86_64-apple-darwin, os: macos-11 }
28+
- {
29+
target: x86_64-unknown-linux-gnu,
30+
os: ubuntu-20.04,
31+
apt: musl-tools alsa-utils alsa-tools libasound2-dev libudev-dev pkg-config portaudio19-dev build-essential libpulse-dev libdbus-1-dev llvm-dev libclang-dev clang,
32+
}
33+
- {
34+
target: x86_64-unknown-linux-musl,
35+
os: ubuntu-20.04,
36+
apt: musl-tools alsa-utils alsa-tools libasound2-dev libudev-dev pkg-config portaudio19-dev build-essential libpulse-dev libdbus-1-dev llvm-dev libclang-dev clang,
37+
}
38+
- {
39+
target: aarch64-unknown-linux-gnu,
40+
os: ubuntu-22.04,
41+
arch: aarch64,
42+
apt: "libasound2-dev:arm64 pkg-config libgcc-s1:arm64 libc6:arm64 gcc-aarch64-linux-gnu build-essential crossbuild-essential-arm64",
43+
}
44+
- {
45+
target: aarch64-unknown-linux-musl,
46+
os: ubuntu-22.04,
47+
arch: aarch64,
48+
apt: "musl-tools libasound2-dev:arm64 pkg-config libgcc-s1:arm64 libc6:arm64 gcc-aarch64-linux-gnu build-essential crossbuild-essential-arm64",
49+
}
50+
- {
51+
target: riscv64gc-unknown-linux-gnu,
52+
os: ubuntu-22.04,
53+
arch: riscv64,
54+
apt: "wget gcc-riscv64-linux-gnu libc6-riscv64-cross crossbuild-essential-riscv64 libasound2-dev:riscv64 pkg-config",
55+
}
56+
- { target: x86_64-pc-windows-gnu, os: windows-2022 }
57+
- { target: x86_64-pc-windows-msvc, os: windows-2019 }
3558
# - { cpu_info: raspberrypi_zero_w, pi_arch: armv6l, cpu: arm1176, base_image: raspios_lite:latest, os: ubuntu-22.04 }
3659
# 32 bit cross compiling not working - { target: arm-unknown-linux-gnueabihf , arch: armhf , os: ubuntu-latest , apt: "libatomic1:armhf libasound2-dev:armhf libudev-dev:armhf pkg-config build-essential crossbuild-essential-armhf" }
3760

3861
steps:
39-
- name: Checkout source code
40-
uses: actions/checkout@v3
41-
42-
- name: Extract project version
43-
shell: bash
44-
run: |
45-
# Get the project version from mix.exs
46-
echo "PROJECT_VERSION=$(sed -n 's/^ @version "\(.*\)"/\1/p' mix.exs | head -n1)" >> $GITHUB_ENV
47-
48-
- name: "Patch azure archives for [amd64, i386] use only"
49-
if: contains(fromJSON('["macos", "ubuntu"]'), matrix.job.os)
50-
shell: bash
51-
run: |
52-
sudo sed -i'' -E 's/^(deb|deb-src) http:\/\/(archive|azure.archive|security).ubuntu.com/\1 [arch=amd64,i386] http:\/\/\2.ubuntu.com/' /etc/apt/sources.list
53-
54-
- name: Set architecture for package manager
55-
if: ${{ matrix.job.arch }}
56-
continue-on-error: true
57-
shell: bash
58-
run: |
59-
# sudo apt-get clean
60-
# sudo apt-get autoclean
61-
# sudo rm -rf /var/lib/apt/lists/
62-
sudo apt-get update -y
63-
sudo dpkg --add-architecture arm64
64-
sudo dpkg --add-architecture ${{ matrix.job.arch }}
65-
# echo "deb [arch=arm64,riscv64,amd64] http://mirror.aarnet.edu.au/pub/ubuntu/ports/ jammy main" | sudo tee -a /etc/apt/sources.list
66-
# echo "deb [arch=arm64,riscv64,amd64] http://mirror.aarnet.edu.au/pub/ubuntu/ports/ jammy-updates main" | sudo tee -a /etc/apt/sources.list
67-
# echo "deb [arch=arm64,riscv64,amd64] http://mirror.aarnet.edu.au/pub/ubuntu/ports/ jammy universe" | sudo tee -a /etc/apt/sources.list
68-
# echo "deb [arch=arm64,riscv64,amd64] http://mirror.aarnet.edu.au/pub/ubuntu/ports/ jammy-updates universe" | sudo tee -a /etc/apt/sources.list
69-
# echo "deb [arch=arm64,riscv64,amd64] http://mirror.aarnet.edu.au/pub/ubuntu/ports/ jammy-security main restricted" | sudo tee -a /etc/apt/sources.list
70-
# echo "deb [arch=arm64,riscv64,amd64] http://mirror.aarnet.edu.au/pub/ubuntu/ports/ jammy-security universe" | sudo tee -a /etc/apt/sources.list
71-
# echo "deb [arch=arm64,riscv64,amd64] http://mirror.aarnet.edu.au/pub/ubuntu/ports/ jammy-security multiverse" | sudo tee -a /etc/apt/sources.list
72-
echo "deb [arch=arm64,riscv64,armhf] http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted universe" | sudo tee -a /etc/apt/sources.list
73-
echo "deb [arch=arm64,riscv64,armhf] http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted universe" | sudo tee -a /etc/apt/sources.list
74-
echo "deb [arch=arm64,riscv64,armhf] http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted universe" | sudo tee -a /etc/apt/sources.list
75-
echo "deb [arch=arm64,riscv64,armhf] http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe" | sudo tee -a /etc/apt/sources.list
76-
sudo apt-get update
77-
# sudo apt --fix-broken install
78-
79-
- name: Print apt sources
80-
if: contains(fromJSON('["macos", "ubuntu"]'), matrix.job.os)
81-
shell: bash
82-
run: cat /etc/apt/sources.list
83-
84-
- name: List architectures
85-
if: contains(fromJSON('["macos", "ubuntu"]'), matrix.job.os)
86-
shell: bash
87-
run: |
88-
sudo dpkg --print-architecture
89-
sudo dpkg --print-foreign-architectures
90-
91-
- name: Install additional apt packages
92-
if: ${{ matrix.job.apt }}
93-
continue-on-error: true
94-
shell: bash
95-
run: sudo apt install ${{ matrix.job.apt }}
96-
97-
- name: Install RISCV build tools
98-
if: ${{ matrix.job.arch == 'riscv64' }}
99-
shell: bash
100-
run: |
101-
# Download RISCV build tools precompile packaged from https://github.com/riscv-collab/riscv-gnu-toolchain/releases/
102-
wget -P ~/Downloads/ https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2023.07.07/riscv64-glibc-ubuntu-22.04-gcc-nightly-2023.07.07-nightly.tar.gz
103-
# Unzip it /opt
104-
tar -xvzf ~/Downloads/riscv64-glibc-ubuntu-22.04-gcc-nightly-2023.07.07-nightly.tar.gz -C /opt/
105-
echo PATH="/opt/riscv/bin/:$PATH" >> $GITHUB_ENV
106-
107-
- name: PKG_CONFIG_PATH package path
108-
if: contains(fromJSON('["macos", "ubuntu"]'), matrix.job.os)
109-
shell: bash
110-
run: |
111-
echo $PKG_CONFIG_PATH
112-
echo $PATH
113-
which riscv64-unknown-linux-gnu-gcc
114-
whereis riscv64-unknown-linux-gnu-gcc
115-
116-
- name: Raspberry Pi specific build
117-
if: contains('raspberrypi', matrix.job.cpu_info)
118-
uses: pguyot/arm-runner-action@v2
119-
with:
120-
base_image: ${{ matrix.job.base_image }}
121-
cpu: ${{ matrix.job.cpu }}
122-
cpu_info: ${{ matrix.job.cpu_info }}
123-
commands: |
62+
- name: Checkout source code
63+
uses: actions/checkout@v3
64+
65+
- name: Extract project version
66+
shell: bash
67+
run: |
68+
# Get the project version from mix.exs
69+
echo "PROJECT_VERSION=$(sed -n 's/^ @version "\(.*\)"/\1/p' mix.exs | head -n1)" >> $GITHUB_ENV
70+
71+
- name: "Patch azure archives for [amd64, i386] use only"
72+
if: contains(fromJSON('["macos", "ubuntu"]'), matrix.job.os)
73+
shell: bash
74+
run: |
75+
sudo sed -i'' -E 's/^(deb|deb-src) http:\/\/(archive|azure.archive|security).ubuntu.com/\1 [arch=amd64,i386] http:\/\/\2.ubuntu.com/' /etc/apt/sources.list
76+
77+
- name: Set architecture for package manager
78+
if: ${{ matrix.job.arch }}
79+
continue-on-error: true
80+
shell: bash
81+
run: |
82+
# sudo apt-get clean
83+
# sudo apt-get autoclean
84+
# sudo rm -rf /var/lib/apt/lists/
85+
sudo apt-get update -y
86+
sudo dpkg --add-architecture arm64
87+
sudo dpkg --add-architecture ${{ matrix.job.arch }}
88+
# echo "deb [arch=arm64,riscv64,amd64] http://mirror.aarnet.edu.au/pub/ubuntu/ports/ jammy main" | sudo tee -a /etc/apt/sources.list
89+
# echo "deb [arch=arm64,riscv64,amd64] http://mirror.aarnet.edu.au/pub/ubuntu/ports/ jammy-updates main" | sudo tee -a /etc/apt/sources.list
90+
# echo "deb [arch=arm64,riscv64,amd64] http://mirror.aarnet.edu.au/pub/ubuntu/ports/ jammy universe" | sudo tee -a /etc/apt/sources.list
91+
# echo "deb [arch=arm64,riscv64,amd64] http://mirror.aarnet.edu.au/pub/ubuntu/ports/ jammy-updates universe" | sudo tee -a /etc/apt/sources.list
92+
# echo "deb [arch=arm64,riscv64,amd64] http://mirror.aarnet.edu.au/pub/ubuntu/ports/ jammy-security main restricted" | sudo tee -a /etc/apt/sources.list
93+
# echo "deb [arch=arm64,riscv64,amd64] http://mirror.aarnet.edu.au/pub/ubuntu/ports/ jammy-security universe" | sudo tee -a /etc/apt/sources.list
94+
# echo "deb [arch=arm64,riscv64,amd64] http://mirror.aarnet.edu.au/pub/ubuntu/ports/ jammy-security multiverse" | sudo tee -a /etc/apt/sources.list
95+
echo "deb [arch=arm64,riscv64,armhf] http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted universe" | sudo tee -a /etc/apt/sources.list
96+
echo "deb [arch=arm64,riscv64,armhf] http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted universe" | sudo tee -a /etc/apt/sources.list
97+
echo "deb [arch=arm64,riscv64,armhf] http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted universe" | sudo tee -a /etc/apt/sources.list
98+
echo "deb [arch=arm64,riscv64,armhf] http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe" | sudo tee -a /etc/apt/sources.list
99+
sudo apt-get update
100+
# sudo apt --fix-broken install
101+
102+
- name: Print apt sources
103+
if: contains(fromJSON('["macos", "ubuntu"]'), matrix.job.os)
104+
shell: bash
105+
run: cat /etc/apt/sources.list
106+
107+
- name: List architectures
108+
if: contains(fromJSON('["macos", "ubuntu"]'), matrix.job.os)
109+
shell: bash
110+
run: |
111+
sudo dpkg --print-architecture
112+
sudo dpkg --print-foreign-architectures
113+
114+
- name: Install additional apt packages
115+
if: ${{ matrix.job.apt }}
116+
continue-on-error: true
117+
shell: bash
118+
run: sudo apt install ${{ matrix.job.apt }}
119+
120+
- name: Install RISCV build tools
121+
if: ${{ matrix.job.arch == 'riscv64' }}
122+
shell: bash
123+
run: |
124+
# Download RISCV build tools precompile packaged from https://github.com/riscv-collab/riscv-gnu-toolchain/releases/
125+
wget -P ~/Downloads/ https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2023.07.07/riscv64-glibc-ubuntu-22.04-gcc-nightly-2023.07.07-nightly.tar.gz
126+
# Unzip it /opt
127+
tar -xvzf ~/Downloads/riscv64-glibc-ubuntu-22.04-gcc-nightly-2023.07.07-nightly.tar.gz -C /opt/
128+
echo PATH="/opt/riscv/bin/:$PATH" >> $GITHUB_ENV
129+
130+
- name: PKG_CONFIG_PATH package path
131+
if: contains(fromJSON('["macos", "ubuntu"]'), matrix.job.os)
132+
shell: bash
133+
run: |
134+
echo $PKG_CONFIG_PATH
135+
echo $PATH
136+
which riscv64-unknown-linux-gnu-gcc
137+
whereis riscv64-unknown-linux-gnu-gcc
138+
139+
- name: Raspberry Pi specific build
140+
if: contains('raspberrypi', matrix.job.cpu_info)
141+
uses: pguyot/arm-runner-action@v2
142+
with:
143+
base_image: ${{ matrix.job.base_image }}
144+
cpu: ${{ matrix.job.cpu }}
145+
cpu_info: ${{ matrix.job.cpu_info }}
146+
commands: |
124147
test `uname -m` = ${{ matrix.job.pi_arch }}
125148
grep Model /proc/cpuinfo
126149
127-
- name: Install Rust toolchain
128-
uses: dtolnay/rust-toolchain@stable
129-
with:
130-
toolchain: stable
131-
target: ${{ matrix.job.target }}
132-
133-
- name: Build the project
134-
id: build-crate
135-
uses: philss/[email protected]
136-
with:
137-
project-name: midiex
138-
project-version: ${{ env.PROJECT_VERSION }}
139-
target: ${{ matrix.job.target }}
140-
nif-version: ${{ matrix.nif }}
141-
use-cross: ${{ matrix.job.use-cross }}
142-
project-dir: "native/midiex"
143-
144-
- name: Artifact upload
145-
uses: actions/upload-artifact@v3
146-
with:
147-
name: ${{ steps.build-crate.outputs.file-name }}
148-
path: ${{ steps.build-crate.outputs.file-path }}
149-
150-
- name: Publish archives and packages
151-
uses: softprops/action-gh-release@v1
152-
with:
153-
files: |
154-
${{ steps.build-crate.outputs.file-path }}
155-
if: startsWith(github.ref, 'refs/tags/')
150+
- name: Install Rust toolchain
151+
uses: dtolnay/rust-toolchain@stable
152+
with:
153+
toolchain: stable
154+
target: ${{ matrix.job.target }}
155+
156+
- name: Build the project
157+
id: build-crate
158+
uses: philss/[email protected]
159+
with:
160+
project-name: midiex
161+
project-version: ${{ env.PROJECT_VERSION }}
162+
target: ${{ matrix.job.target }}
163+
nif-version: ${{ matrix.nif }}
164+
use-cross: ${{ matrix.job.use-cross }}
165+
project-dir: "native/midiex"
166+
167+
- name: Artifact upload
168+
uses: actions/upload-artifact@v3
169+
with:
170+
name: ${{ steps.build-crate.outputs.file-name }}
171+
path: ${{ steps.build-crate.outputs.file-path }}
172+
173+
- name: Publish archives and packages
174+
uses: softprops/action-gh-release@v1
175+
with:
176+
files: |
177+
${{ steps.build-crate.outputs.file-path }}
178+
if: startsWith(github.ref, 'refs/tags/')

0 commit comments

Comments
 (0)